canonical / lightdm

Display Manager
GNU General Public License v3.0
815 stars 137 forks source link

logind-check-graphical=true causes lightdm in LXC container to fail to start #263

Open tangruize opened 2 years ago

tangruize commented 2 years ago

Hello! I'm running Fedora 36 in an LXC/LXD container with NVIDIA GPU pass through. Today I upgraded LightDM from version 1.30.0 to 1.32.0. I found that Xorg didn't start, but systemctl showed that the LightDM service started successfully.

This is the LightDM log of the failed startup. ``` [+0.00s] DEBUG: Logging to /var/log/lightdm/lightdm.log [+0.00s] DEBUG: Starting Light Display Manager 1.32.0, UID=0 PID=191 [+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-backup-logs.conf [+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-minimum-vt.conf [+0.00s] DEBUG: Loading configuration from /usr/share/lightdm/lightdm.conf.d/50-run-directory.conf [+0.00s] DEBUG: Loading configuration from /usr/share/lightdm/lightdm.conf.d/50-session-wrapper.conf [+0.00s] DEBUG: Loading configuration from /usr/share/lightdm/lightdm.conf.d/50-user-authority-in-system-dir.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 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: [SeatDefaults] is now called [Seat:*], please update this configuration [+0.00s] DEBUG: Registered seat module local [+0.00s] DEBUG: Registered seat module xremote [+0.00s] DEBUG: Using D-Bus name org.freedesktop.DisplayManager [+0.00s] DEBUG: _g_io_module_get_default: Found default implementation local (GLocalVfs) for ‘gio-vfs’ [+0.00s] DEBUG: Monitoring logind for seats [+0.00s] DEBUG: Acquired bus name org.freedesktop.DisplayManager [+0.01s] DEBUG: Loading users from org.freedesktop.Accounts [+0.01s] DEBUG: User /org/freedesktop/Accounts/User1000 added [+109.64s] DEBUG: Got signal 15 from process 1 [+109.64s] DEBUG: Caught Terminated signal, shutting down [+109.64s] DEBUG: Stopping display manager [+109.64s] DEBUG: Display manager stopped [+109.64s] DEBUG: Stopping daemon [+109.64s] DEBUG: Exiting with return value 0 ```
This is the LightDM configuration. ``` [Seat:*] B allow-guest=false E session-wrapper=/etc/X11/xinit/Xsession G xserver-command=X -core -noreset I greeter-session=lightdm-gtk-greeter I autologin-user=fedora [LightDM] I minimum-vt=8 D run-directory=/run/lightdm F user-authority-in-system-dir=true I minimum-display-number=8 Sources: A /usr/share/lightdm/lightdm.conf.d/50-backup-logs.conf B /usr/share/lightdm/lightdm.conf.d/50-disable-guest.conf C /usr/share/lightdm/lightdm.conf.d/50-minimum-vt.conf D /usr/share/lightdm/lightdm.conf.d/50-run-directory.conf E /usr/share/lightdm/lightdm.conf.d/50-session-wrapper.conf F /usr/share/lightdm/lightdm.conf.d/50-user-authority-in-system-dir.conf G /usr/share/lightdm/lightdm.conf.d/50-xserver-command.conf H /usr/share/lightdm/lightdm.conf.d/60-lightdm-gtk-greeter.conf I /etc/lightdm/lightdm.conf ```
This is the raw.lxc configuration. ``` raw.lxc: |- lxc.mount.entry=/dev/nvidia0 dev/nvidia0 none bind,optional,create=file lxc.mount.entry=/dev/nvidiactl dev/nvidiactl none bind,optional,create=file lxc.mount.entry=/dev/nvidia-modeset dev/nvidia-modeset none bind,optional,create=file lxc.cgroup.devices.allow=c 195:* rwm lxc.mount.entry=/dev/nvidia-uvm dev/nvidia-uvm none bind,optional,create=file lxc.mount.entry=/dev/nvidia-uvm-tools dev/nvidia-uvm-tools none bind,optional,create=file lxc.cgroup.devices.allow=c 507:* rwm lxc.mount.entry=/dev/dri/card0 dev/dri/card0 none bind,optional,create=file lxc.mount.entry=/dev/dri/renderD128 dev/dri/renderD128 none bind,optional,create=file lxc.cgroup.devices.allow=c 226:* rwm lxc.mount.entry=/dev/tty15 dev/tty0 none bind,optional,create=file lxc.mount.entry=/dev/tty15 dev/tty8 none bind,optional,create=file lxc.cgroup.devices.allow=c 4:15 rwm ```

I compared the config changes of the two versions (diff lightdm.conf lightdm.conf.rpmnew):

24,25c24,25
< minimum-display-number=8
< minimum-vt=8
---
> #minimum-display-number=0
> #minimum-vt=7
29c29
< #logind-check-graphical=false
---
> #logind-check-graphical=true
164,167d163
< 
< [SeatDefaults]
< greeter-session=lightdm-gtk-greeter
< autologin-user=fedora

And found that logind-check-graphical is set to true by default. After changing to false, Xorg started successfully.

I don't know what this option does. It seems to prevent the system from booting so fast that LightDM starts before loading the graphics driver. But in my use case (although it may be rare), I think LightDM is not properly checking the loading status of the graphics driver. Or is my configuration wrong?

ghostplant commented 1 year ago

For https://github.com/canonical/lightdm/issues/165, logind-check-graphical=true doesn't even help to prevent booting before graphic session is done. In Ubuntu 22.04, seems like graphical.target is wrong to report the graphic completion, still making lightdm to start up too early, and triggering Xorg's sigabrt or black screen.

netfab commented 1 year ago

I found that Xorg didn't start, but systemctl showed that the LightDM service started successfully.

I'm getting the same behavior on gentoo with openrc and nvidia-drivers since upgrade to LightDM-1.32. With logind-check-graphical=false lightdm is starting fine.

With logind-check-graphical=true the service starts successfully, but lightdm does not appear on screens. When this happens, I noticed that nvidia and nvidia-drm modules are not loaded. If I load them manually \:

# modprobe nvidia-drm nvidia

lightdm is automagically appearing on screens without restarting the service.

ghostplant commented 1 year ago

I am not 100% sure but a workaround currently working for me is to wait module drm_kms_helper to complete loaded and this checking script is added in ExeStartPre.

netfab commented 1 year ago

I tried to force drm_kms_helper loading at early boot, but it changed nothing for me. However I found out that disabling Kernel Mode Setting (KMS) entirely by appending nomodeset to the kernel parameters makes lightdm start successfully with logind-check-graphical=true.

ghostplant commented 1 year ago

Then you can consider try sleep 20s in ExecStartPre instead.

steev commented 11 months ago

I run into the same issue here on RaspberryPi devices both 32bit and 64bit on a 5.15 kernel, even with sleep 20s added in. The only thing that works for me is to flip the true back to false like it was previously.

Additionally... a 20 second pause at startup??? That is not a good workaround at all for a system, and leads to users thinking something is wrong with their devices.