[systemd-devel] dev-root.device is not active, results in an umount spree

Andrei Borzenkov arvidjaar at gmail.com
Thu May 14 04:24:13 PDT 2015

В Thu, 14 May 2015 12:51:37 +0200
Martin Pitt <martin.pitt at ubuntu.com> пишет:

> Hello all,
> Dimitri John Ledkov [2015-05-13 12:48 +0100]:
> > I am booting without initramfs, using a plan9 filesystem as rootfs in a kvm.
> > 
> > Thus my /proc/cmdline has:
> > root=/dev/root rootflags=rw,trans=virtio,version=9p2000.L rootfstype=9p
> > 
> > # mount
> > /dev/root on / type 9p
> > (rw,relatime,sync,dirsync,rw,trans=virtio,version=9p2000.L)
> > 
> > Yet, dev-root.device is dead:
> > # systemctl status dev-root.device
> > ● dev-root.device
> >    Loaded: loaded
> >    Active: inactive (dead)
> > 
> > This is very bad. As a harmless action like following:
> > 
> > # mount --bind /opt /opt
> > 
> > Results in opt.mount unit to be generated which BindsTo
> > dev-root.device, which is inactive, thus systemd tries to stop that
> > unit straight away, and umount fails and is retried infinitely...
> > effectively DoSing init.
> As I mentioned before, simply ignoring /dev/root doesn't help in all
> cases, and hardcoding it in the code is a bit ugly.
> The attached patch is a more general solution which stops creating
> dead stub .device units for devices which don't exist at all. I. e.
> while in your case -.mount was probably BindsTo=dev-root.device (or in
> my case, in my container I had mnt.mount BindsTo=dev-sda3.device,
> which exists on the host but not in the container), but with this
> patch it should now not be bound to anything.

Will it be "rebound" when device appears? Otherwise any mount that
happens before udev is started/happens to notice device will not be
associated with device. Most common case is probably mounts inherited
from initrd.

> Lennart, if you don't like this there is an alternative, and more
> complicated solution: We could instead teach device_found_node() to
> actually do create a proper .device with the passed DeviceFound (which
> is "MOUNT"), resulting in creating a state "tentative" device. I have
> a half-working patch for this, but it's brittle as with pretty much
> any uevent or moutinfo change the status changes back to "dead",
> causing the unmount attempt. IMHO this approach isn't conceptually
> correct either -- in such containers, if don't have the corresponding
> device nodes at all, we shouldn't try to react to hotplug events and
> clean up mounts. I. e. the "tentative" concept does not really apply
> there. But I have misunderstood the intent.
> Thanks for considering,
> Martin

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20150514/2c4deca2/attachment.sig>

More information about the systemd-devel mailing list