Published on

Switch From GDM to LightDM Due to GDM Wayland Session Issue

Authors
  • avatar
    Name
    ttyS3
    Twitter

工作电脑是双屏, 自动切换到 Wayland 之后, GDM 就没消停过.

经常性的从锁屏界面切回来后 GNOME 桌面会话退出了, 然后登录进去所有用户进程都结束了, 就跟重启后首次登录一样.

看 gdm 的日志也没看出啥. 家里的电脑同样是 Arch, 并且同样是 Nvidia 显卡, 唯一的不同时, 家里的是一个屏. 但是基本上家里的电脑就很少有放一段时间后再登录桌面会话消失的情况.

今天无意中在这 https://ask.fedoraproject.org/t/external-monitor-with-wayland-and-two-gpus-notebok/20387/3 看到一个解决方案: "I read from other forum that the problem actually are with GDM (Gnome login screen). You could try to switch to lightdm."

所以, 是 GDM 的 bug, 换一个 DM 就好了. LightDM 虽然有点丑和简陋, 不过好歹解决了基本的使用问题.

丑点就丑点吧, 又不是不能用. GDM 再漂亮, 解决不了实际问题.

paru -S lightdm lightdm-gtk-greeter

sudo systemctl disable gdm
sudo systemctl mask gdm
sudo systemctl enable lightdm

测试了一天, 基本上确定 LightDM 解决了使用 GDM 时 Wayland session 经常被搞丢的问题.

锁屏问题

dm-tool switch-to-greeterdm-tool lock 区别是, switch-to-greeter 会锁定然后回到登录界面, lock 会锁定并关闭显示器.

去 Keyboard -> Custom Shortcuts 自己加个锁屏快捷键即可.

HiDPI 问题

编辑 /etc/lightdm/lightdm-gtk-greeter.conf

[greeter]
xft-dpi=192

SDDM: 折腾以失败告终, 最终退回 LightDM

SDDM 这个东西最近几个月基本上都没人提交代码, 并且对于 Wayland 的支持并不太好. 要用开发分支才有 Wayland 支持.

# 安装  archlinuxcn/sddm-git 0.19.0.141.ge67307e-1
# e67307e 是 https://github.com/sddm/sddm/commits/develop 的最新提交.
paru -S sddm-git

# 安装点主题啥的
paru -S sddm-sugar-dark sddm-nordic-theme-git archlinux-themes-sddm

The default configuration file for SDDM can be found at /usr/lib/sddm/sddm.conf.d/default.conf. For any changes, create configuration file(s) in /etc/sddm.conf.d/. See sddm.conf(5) for all options.

sudo mkdir /etc/sddm.conf.d/

预览主题效果:

sddm-greeter --test-mode --theme /usr/share/sddm/themes/archlinux-soft-grey

sddm-greeter --test-mode --theme /usr/share/sddm/themes/elarun

sddm-greeter --test-mode --theme /usr/share/sddm/themes/maldives

sddm-greeter --test-mode --theme /usr/share/sddm/themes/maya

然后就是按 https://wiki.archlinux.org/title/SDDM 配置了.

最终没能到达显示登录界面:

Auth: sddm-helper exited with 3 Greeter stopped. SDDM::Auth::HELPER_OTHER_ERROR

去 Github issue 看了下, 好像蛮多 Wayland 遇到这个问题的.

sddm[45447]: Initializing...
sddm[45447]: Starting...
sddm[45447]: Logind interface found
sddm[45447]: Adding new display...
sddm[45447]: Loading theme configuration from ""
sddm[45447]: Using VT 3
sddm[45447]: Display server started.
sddm[45447]: Socket server starting...
sddm[45447]: Socket server started.
sddm[45447]: Loading theme configuration from "/usr/share/sddm/themes/maldives/theme.conf"
sddm[45447]: Greeter starting...
sddm-helper[45449]: [PAM] Starting...
sddm-helper[45449]: [PAM] Authenticating...
sddm-helper[45449]: pam_unix(sddm-greeter:session): session opened for user sddm(uid=950) by root(uid=0)
sddm-helper[45449]: [PAM] returning.
sddm[45447]: Greeter session started successfully
sddm-helper[45449]: [PAM] Closing session
sddm-helper[45449]: pam_unix(sddm-greeter:session): session closed for user sddm
sddm-helper[45449]: [PAM] Ended.
sddm[45447]: Auth: sddm-helper exited with 3
sddm[45447]: Greeter stopped. SDDM::Auth::HELPER_OTHER_ERROR
sddm[45447]: Signal received: SIGTERM

有没有可能是 theme 的问题? 没去试了.

但我猜测, 可能是 Wayland Compositor 的问题. SDDM 自身也同样是运行在 Wayland 下的, 当桌面登录还没启动的时候, SDDM 需要一个 Wayland Compositor 来启动它的 greeter. 我用的是它默认的 weston, 我不是 KDE, 并没有 kwin.

Refs

https://wiki.archlinux.org/title/LightDM

https://wiki.archlinux.org/title/Display_manager#Graphical

https://wiki.archlinux.org/title/SDDM

https://github.com/sddm/sddm/issues/1537