Ubuntuの設定画面→詳細→ユーザーから、あるユーザーにおける自動ログイン(Automatic Login)を有効にしても、自動ログインできないことがあった。
結果的に理由は単純で、自動ログインの設定後、デスクトップサービスをデフォルトのdgm3ではなくlightdmに変更したため、lightdmの設定ファイル内に自動ログインの設定が記述されていなかった。
まずは、lightdmのログを確認してみる。
sudo cat /var/log/lightdm/lightdm.log
後半は省略するが、こちらの環境では以下のように出力されていた。
[+0.00s] DEBUG: Logging to /var/log/lightdm/lightdm.log [+0.00s] DEBUG: Starting Light Display Manager 1.26.0, UID=0 PID=1313 [+0.00s] DEBUG: Loading configuration dirs from /usr/share/lightdm/lightdm.conf.d [+0.00s] DEBUG: Loading configuration from /usr/share/lightdm/lightdm.conf.d/50-disable-guest.conf [+0.00s] DEBUG: Loading configuration from /usr/share/lightdm/lightdm.conf.d/50-disable-log-backup.conf [+0.00s] DEBUG: Loading configuration from /usr/share/lightdm/lightdm.conf.d/50-greeter-wrapper.conf [+0.00s] DEBUG: Loading configuration from /usr/share/lightdm/lightdm.conf.d/50-guest-wrapper.conf [+0.00s] DEBUG: Loading configuration from /usr/share/lightdm/lightdm.conf.d/50-ubuntu.conf [+0.00s] DEBUG: Loading configuration from /usr/share/lightdm/lightdm.conf.d/50-unity-greeter.conf [+0.00s] DEBUG: Loading configuration from /usr/share/lightdm/lightdm.conf.d/50-xserver-command.conf [+0.00s] DEBUG: Loading configuration from /usr/share/lightdm/lightdm.conf.d/60-lightdm-gtk-greeter.conf [+0.00s] DEBUG: Loading configuration from /usr/share/lightdm/lightdm.conf.d/90-nvidia.conf [+0.00s] DEBUG: [SeatDefaults] is now called [Seat:*], please update this configuration [+0.00s] DEBUG: Loading configuration dirs from /usr/local/share/lightdm/lightdm.conf.d [+0.00s] DEBUG: Loading configuration dirs from /etc/xdg/lightdm/lightdm.conf.d [+0.00s] DEBUG: Loading configuration from /etc/lightdm/lightdm.conf [+0.00s] DEBUG: Registered seat module local 以下省略
ここで重要なのは最後の方の /etc/lightdm/lightdm.conf
という設定ファイル。当方の環境ではこの設定ファイルに何も書かれていなかった。そこで、下記の記事を参考に
Ubuntu 16.04の自動ログインが効かなくなった。 – Yuji Noizumi's blog
[Seat:*] autologin-guest=false autologin-user-timeout=0 autologin-session=lightdm-autologin autologin-user=administrator
と書いてみた。当方の環境での自動ログイン用ユーザーはadministrator
なので適宜置き換えてほしい。これで次の再起動後から、自動ログオンが有効になった。