[systemd-devel] [PATCH] Re: fstab mounts get unmounted during boot (.device unit bouncing?) -- solution

Martin Pitt martin.pitt at ubuntu.com
Thu Feb 12 01:40:15 PST 2015


Hello again,

Martin Pitt [2015-02-11 23:42 +0100]:
> Lennart Poettering [2015-02-11 17:05 +0100]:
> > Actually, the fact that the unit changes directly from "dead" to
> > "mounted" is interesting. The unit does not go through "mounting",
> > which means that it's not the unit that is invoking the /bin/mount
> > command for this but something else.. Do you see anything about this
> > in the logs?
> 
> Thanks for that hint, that's really useful.

So it was! I looked again at the debug output, and this looked really
fishy:

[    5.627882] donald systemd[1]: Successfully created private D-Bus server.
[    5.627887] donald systemd[1]: var-tmp.mount changed dead -> mounted
[    5.628023] donald systemd[1]: run-user-115.mount changed dead -> mounted
[    5.628120] donald systemd[1]: home-martin.mount changed dead -> mounted
[    5.628202] donald systemd[1]: dev-mqueue.mount changed dead -> mounted
[    5.628285] donald systemd[1]: dev-hugepages.mount changed dead -> mounted
[    5.628367] donald systemd[1]: sys-fs-fuse-connections.mount changed dead -> mounted
[    5.628448] donald systemd[1]: -.mount changed dead -> mounted
[    5.628528] donald systemd[1]: srv.mount changed dead -> mounted
[    5.628609] donald systemd[1]: Unit srv.mount is bound to inactive service. Stopping, too.

So right after we popped out of initramfs (which doesn't have an
fstab, nor /etc/mtab, nor does it do anything else than mouting /
read-only) we see all these mounts which can't possibly happen that
early -- e. g. run-user-115.mount or /home/martin (which is on
ecryptfs). So I finally discovered that a packaging bug in
lxcfs turned /etc/mtab from a /proc/mounts symlink back into a file,
and mount_load_proc_self_mountinfo() parsed that to instantiate all
those mounts from the previous boot into mount unit, causing that
effect.

So of course we'll fix that packaging bug, but there are still times
when /etc/mtab might be a file; e. g. the first time you boot systemd
after an upgrade.

To make systemd robust against this, I fixed
mount_load_proc_self_mountinfo() to actually do what it intends to do,
instead of loading /etc/mtab (which is still util-linux' default for
mnt_table_parse_mtab()).

Et voilĂ , boot now always works again!

Martin

-- 
Martin Pitt                        | http://www.piware.de
Ubuntu Developer (www.ubuntu.com)  | Debian Developer  (www.debian.org)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-core-mount-ensure-that-we-parse-proc-self-mountinfo.patch
Type: text/x-diff
Size: 1327 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20150212/289f2aa0/attachment-0001.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20150212/289f2aa0/attachment-0001.sig>


More information about the systemd-devel mailing list