[systemd-devel] initrd mount wrongly unmounted during bootup

Andrei Borzenkov arvidjaar at gmail.com
Wed Mar 11 20:44:28 PDT 2015

В Wed, 11 Mar 2015 11:26:52 -0700
Aaron_Wright at selinc.com пишет:

> I'm working with an embedded device that mounts / and /var in initrd. It 
> then switches root and fires up systemd. Early in the boot, after paths 
> target, /var gets unmounted. I want systemd to not do that, but I can't 
> figure out how to stop it.
> I would like systemd to leave /var mounted, but still unmount it during 
> shutdown. I would rather not move the mounting of /var out of initrd. Is 
> this possible?
> I'm trying to use a very stripped down systemd. As minimal as possible. 

Do you use udev in initrd?

> I'm using systemd-219. The logs say that var.mount is bound to an inactive 
> unit, and it is stopping too. I assume that is why /var gets unmounted, 
> but I don't know what to do to stop it. There is no /etc/fstab file. There 
> is no var.mount file.
> I assume I'm either missing something simple, or it is not possible.

Did you try this commit?

commit 628c89cc68ab96fce2de7ebba5933725d147aecc
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Feb 27 21:55:08 2015 +0100

    core: rework device state logic
    This change introduces a new state "tentative" for device units. Device
    units are considered "plugged" when udev announced them, "dead" when
    they are not available in the kernel, and "tentative" when they are
    referenced in /proc/self/mountinfo or /proc/swaps but not (yet)
    announced via udev.
    This should fix a race when device nodes (like loop devices) are created
    and immediately mounted. Previously, systemd might end up seeing the
    mount unit before the device, and would thus pull down the mount because
    its BindTo dependency on the device would not be fulfilled.

More information about the systemd-devel mailing list