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)
From 4d3bcd8cec801d7a2a773388ae281ca692a7f2d5 Mon Sep 17 00:00:00 2001
From: Martin Pitt <martin.p...@ubuntu.com>
Date: Thu, 12 Feb 2015 10:30:00 +0100
Subject: [PATCH] core/mount: ensure that we parse /proc/self/mountinfo

util-linux' mnt_table_parse_mtab() still defaults to parsing /etc/mtab. So if
that is a file [1] , we parse outdated information during boot, leading to creating
mount units for nonexisting mounts which later have to get cleaned up. The
cleanup races with mounting them from fstab, which sometimes causes fstab
mounts to get unmounted again during boot.

So explicitly specify the file that we actually want to parse.

[1] first boot after a distro upgrade, or a package bug, or administrators
    configuring it explicitly for some reason

https://launchpad.net/bugs/1419623
---
 src/core/mount.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/core/mount.c b/src/core/mount.c
index f3977e6..61fd526 100644
--- a/src/core/mount.c
+++ b/src/core/mount.c
@@ -1566,7 +1566,7 @@ static int mount_load_proc_self_mountinfo(Manager *m, bool set_flags) {
         if (!tb || !itr)
                 return log_oom();
 
-        r = mnt_table_parse_mtab(tb, NULL);
+        r = mnt_table_parse_mtab(tb, "/proc/self/mountinfo");
         if (r < 0)
                 return r;
 
-- 
2.1.4

Attachment: signature.asc
Description: Digital signature

_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to