[systemd-devel] Starting Display Managers

Alexander E. Patrakov patrakov at gmail.com
Mon Aug 20 22:09:10 PDT 2012


Hello.

Several days ago I stumbled upon an interesting race condition (which
is not a bug in systemd) that I want to share now.

To reproduce: install lxdm, and the following (buggy) unit to start
lxdm on boot:

[Unit]
Description=LXDE Display Manager

[Service]
ExecStart=/usr/sbin/lxdm
# After each successful logout, lxdm terminates
Restart=on-success

[Install]
WantedBy=graphical.target

Note that, as compared to the Arch Linux unit, this misses the
dependency on systemd-user-sessions.service, but in fact the race
condition is deeper. The problem is that lxdm starts the X server, and
it has certain /dev requirements that vary with hardware and, at least
from my first impression, not known in advance.

If the user has a graphics card supported by open-source DRI-based
drivers with mandatory KMS, then /dev/dri/card0 (or maybe card1 in
dual-gfx setups) is needed. And for Radeon TURKS cards, this only
appears after loading firmware (which takes some time). If this is a
tablet using the "fbdev" driver, then /dev/fb0 is needed. And with
yet-unsupported graphics cards, the vesa driver only needs /dev/mem or
something like that which is always present given a devtmpfs.

The question is: how does one write this dependency information, so
that lxdm is not attempted to be started before udev creates the
necessary device node? Yes, I understand that GPU hotplug in Xorg is
the real answer, but we don't have that now, and I don't know how it
would cover vesa-based screens.

This is not exactly a theoretical question. While I could not
reproduce this race using a RAID0 setup made from two Samsung SATA-III
SSDs, it does trigger reliably (even with an Intel card) if one puts
the entire system into an initramfs and makes the /init ->
usr/bin/systemd symlink.

-- 
Alexander E. Patrakov


More information about the systemd-devel mailing list