认识
官网:https://wiki.gnome.org/Projects/GDM
文档:https://help.gnome.org/admin/gdm/
仓库:https://gitlab.gnome.org/GNOME/gdm
组成
命令程序 and 配置文件
# apt-file list gdm3 # 2025-10-23 Ubuntu 25.04
/etc/gdm3/*
/etc/init.d/gdm3
/etc/insserv.conf.d/gdm3
/etc/pam.d/gdm-autologin
/etc/pam.d/gdm-fingerprint
/etc/pam.d/gdm-launch-environment
/etc/pam.d/gdm-password
/etc/pam.d/gdm-smartcard-pkcs11-exclusive
/etc/pam.d/gdm-smartcard-sssd-exclusive
/etc/pam.d/gdm-smartcard-sssd-or-password
/usr/bin/gdm-config
/usr/lib/systemd/system/gdm.service
/usr/lib/systemd/system/gdm3.service
/usr/lib/systemd/user/gnome-session@gnome-login.target.d/session.conf
/usr/lib/udev/rules.d/61-gdm.rules
/usr/lib/x86_64-linux-gnu/security/pam_gdm.so
/usr/libexec/gdm-auth-config-debian
/usr/libexec/gdm-host-chooser
/usr/libexec/gdm-runtime-config
/usr/libexec/gdm-session-worker
/usr/libexec/gdm-simple-chooser
/usr/libexec/gdm-wayland-session
/usr/libexec/gdm-x-session
/usr/sbin/gdm3
/usr/share/dbus-1/system.d/gdm.conf
/usr/share/dconf/profile/Debian-gdm
/usr/share/dconf/profile/gdm
/usr/share/doc/gdm3/*
/usr/share/gdm/dconf/00-upstream-settings
/usr/share/gdm/dconf/90-debian-settings
/usr/share/gdm/dconf/locks/00-upstream-settings-locks
/usr/share/gdm/default.pa
/usr/share/gdm/gdb-cmd
/usr/share/gdm/gdm.schemas
/usr/share/gdm/generate-config
/usr/share/gdm/greeter-dconf-defaults
/usr/share/gdm/greeter.dconf-defaults
/usr/share/gdm/greeter.dconf-defaults.md5sum
/usr/share/gdm/greeter/applications/mime-dummy-handler.desktop
/usr/share/gdm/greeter/applications/mimeapps.list
/usr/share/gdm/greeter/autostart/orca-autostart.desktop
/usr/share/gdm/locale.alias
/usr/share/gnome-session/sessions/gnome-login.session
/usr/share/help/*
/usr/share/lintian/overrides/gdm3
/usr/share/man/man8/gdm3.8.gz
/usr/share/polkit-1/rules.d/20-gdm.rules
构建
apt-cache show gdm3 # 2025-10-23 Ubuntu 25.04
# /usr/sbin/gdm3 –version
GDM 48.0
应用
在 GDM3 中,修改用户头像
Change your login screen photo
Where is the user’s profile picture stored in Gnome 3?
按照 Change your login screen photo 中的说明,修改用户头像;
通常两种方法:
1)在 GNOME Control Center / Users 中设置;
2)使用 users-admin 程序,修改自己的头像;
但是,第一种方法不显示 ROOT 用户,而第二种方法,当以 ROOT 用户登录时,启动它,界面一直出于加载中的状态;
(亲测有效)我们可以手动修改/var/lib/AccountsService/users/root文件,内容大致如下:
[User] Icon=/var/lib/AccountsService/icons/root Language= XSession= SystemAccount=true
主要是 Icon= 行,它的值是 /var/lib/AccountsService/icons/root 图片。!!!修改之后需要重新登录!!!
修改登录界面背景图
thiggy01/gdm-background: A simple graphical tool to change the GDM 3 background of Ubuntu or Pop OS 20.04 and 20.10
juhaku/loginized: Gnome GDM Login Theme Manager. Easy and Fast Login Theme Manipulation
# 07/28/2021 在 Ubuntu 21.04 中,无法通过上面的两个应用修改 GDM 背景;
改进
Oh no! Something has gone wrong error
GNOME HELP/Troubleshooting
GNOME HELP/Configuration
BASH MANUAL/6.11 Bash POSIX Mode
How to disable an option with a bash script?
在安装 GDM 之后,启动服务(systemctl start gdm3.service),此时显示错误信息:
Oh no! Something has gone wrong error
或者,在输入用户名与密码之后,不断的退到登录界面;
原因分析
1)修改 /etc/gdm/custom.conf 文件,加入如下行:
[debug] Enable=true
2)同时我们还要启动 syslog 服务(该服务通常是默认启动的);
3)然后,重启 GDM 服务(systemctl restart gdm3.service),再次进行登录
4)此时,日志将写入 /var/log/message 中;
每个人原因都不相同,下面是我们的个人原因:
在我们的情景中,之所以无法登录,是因为:它在登录的时候,会执行 $HOME/.profile 文件,而文件中存在语法错误。准确的说是:与执行的 Shell 不兼容;
脚本的执行是由 /etc/gdm3/Xsession 触发的,所使用的 Shell 程序是 /bin/sh(脚本第一行)。在我们的环境中,它被软链接到 /bin/bash 命令。当 Bash 被软链接到 sh 后(即以 sh 调用),将进入「POSIX 模式」。如果我们的脚本不符合 POSIX 的规范,比如命名中存在非法字符,都会导致错误;
解决办法
- 调整脚本,使其符合 POSIX 规范。但是,实际情况复杂:1)脚本多,工作量大;2)规范里的功能少,不能满足某些需要;
- 所以,我们的解决办法就是从 POSIX 模式中退出来:在脚本的第一行加入 set +o posix 命令,管理 POSIX 模式;
[DONE] … Module nvidia not found in directory /lib/modules/6.14.0-33-generic …
... ... gdm3[3711]: GLib: Source ID 239 was not found when attempting to remove it ... gnome-shell[5584]: loading default theme (Adwaita) ... NetworkManager[1551]: <info> [1760929888.8839] agent-manager: agent[7dd570a2b8fd2ac3,:1.125/org.gnome.Shell.NetworkAgent/1000]: agent registered ... gnome-shell[5584]: percentage lengths not currently supported ... gnome-shell[670678]: The XKEYBOARD keymap compiler (xkbcomp) reports: ... gnome-shell[670678]: > Warning: Unsupported maximum keycode 708, clipping. ... gnome-shell[670678]: > X11 cannot support keycodes above 255. ... gnome-shell[670678]: > Warning: Could not resolve keysym XF86KbdInputAssistPrevgrou ... gnome-shell[670678]: > Warning: Could not resolve keysym XF86KbdInputAssistNextgrou ... gnome-shell[670678]: Errors from xkbcomp are not fatal to the X server ... gdm-session-worker[670703]: modprobe: FATAL: Module nvidia not found in directory /lib/modules/6.14.0-33-generic ... kernel: workqueue: pm_runtime_work hogged CPU for >10000us 35 times, consider switching to WQ_UNBOUND ... systemd[1]: fprintd.service: Deactivated successfully. ... systemd[5281]: Started vte-spawn-07797ead-b17f-4021-a338-f60f32a1e445.scope - VTE child process 671020 launched by org.gnome.Terminal process 6373. ...
执行 ubuntu-drivers autoinstall 命令,来自动安装驱动。