在带有 lightdm 和自动登录帐户的 Ubuntu 16.04 上,我可以使用命令重新启动图形会话:
sudo service lightdm restart
账户自动登录。
在 Ubuntu 18.04(以及 19.04)上,设置了相同的自动登录帐户,但命令:
sudo service gdm3 restart
无法自动登录,并将显示带至登录页面。
在 gdm 日志中,我可以找到
systemd[1]: gdm.service: Succeeded.
systemd[1]: Stopped GNOME Display Manager.
systemd[1]: Starting GNOME Display Manager...
systemd[1]: Started GNOME Display Manager.
gdm-autologin][4091]: gkr-pam: no password is available for user
gdm-autologin][4091]: pam_unix(gdm-autologin:session): session opened for user screen by (uid=0)
gdm-autologin][4091]: gkr-pam: couldn't unlock the login keyring.
如何正确重新启动用户会话,自动登录用户在 ubuntu 18.04 上登录?
答案1
遇到了同样的问题,我通过在 /etc/gdm3/custom.conf 文件中启用“定时登录”解决了该问题。我的看起来像:
# GDM configuration storage
#
# See /usr/share/gdm/gdm.schemas for a list of available options.
[daemon]
AutomaticLoginEnable=true
AutomaticLogin=username
# Uncoment the line below to force the login screen to use Xorg
#WaylandEnable=false
# Enabling automatic login
# Enabling timed login
TimedLoginEnable = true
TimedLogin = username
TimedLoginDelay = 10
[security]
[xdmcp]
[chooser]
[debug]
# Uncomment the line below to turn on debugging
# More verbose logs
# Additionally lets the X server dump core if it crashes
#Enable=true
答案2
对上述 Celly 的回答稍作修改。默认或 OOB 的 custom.conf 文件已注释掉 AutomaticLoginEnable 和 AutomaticLogin 参数。我将这些参数注释掉,并取消注释/设置 TimedLoginEnable、TimedLogin 和 TimedLoginDelay。它仍然有效。谢谢 Celly!
答案3
这似乎已在 Ubuntu 20.04 上修复:gdm3 服务重启将导致自动登录成功。