[systemd-devel] cryptsetup vs. swapon/fsck (some kind of race condition)

Lennart Poettering lennart at poettering.net
Thu May 15 14:38:26 PDT 2014


On Thu, 15.05.14 23:15, Andy Kittner (andy.kittner at gmail.com) wrote:

> | May 15 22:06:47 pinky systemd[1]: Mounted Runtime Directory.
> | May 15 22:06:47 pinky systemd[1]: Mounted Lock Directory.

This looks like remains from a *really* old systemd version. THis does not
exist anymore. What distribution is this?

This used to bind mount /run to /var/run, and similar for /var/lock.

> | May 15 22:06:47 pinky systemd[1]: Started udev Kernel Device Manager.
> | May 15 22:06:47 pinky systemd-cryptsetup[2433]: AKI DEBUG udev: open_queue_file failed with errno 2
> | May 15 22:06:47 pinky systemd-cryptsetup[2433]: AKI DEBUG libdm:_check_udev_is_running: Udev is not running. Not using udev synchronisation code.
> 
> So the udev queue file does not yet exist, libdm thinks the system is
> not running udev and things go wrong...

This really should be turned off in libdm. It's really stupid and
broken. We start these things in parallel, they create these races
without reason. Since ages we don't support non-devtmpfs kernels
anymore, so it's *always* wrong to invoke mknod(), since the kernel will
create the device nodes. Unless you run an early 2.6 kernels this is
completely wrong. I'd recommend filing a bug against the distribution to
remove this old crap from libdm. 

What does libdm even check there precisely?

> The main difference I spot is a longer interval between starting udev
> and the udev_is_running() check.
> Also, I guess "Mounted Runtime Directory" refers to /run, where the file
> in question resides? In the "bad" case this happens in the same second
> as the cryptsetup call...

/run is since a long time mounted from within PID 1 very early on, as
part of its initial setup, before running any unit or forking off any
other process.

> Anyway, my conclusion from this is that either the LVM guys need to
> use another method to detect that udev is running, or systemd should
> not start the cryptsetup stuff until udev is fully initialized.

Nope, we don't need more synchronization. The LVM guys should stop doing
mknod() on their own. And if they insist, your distro should turn that
off, or patch it out.

> Should I open a bug for LVM or for systemd?

Certainly not systemd.

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list