Gentoo Archives: gentoo-dev

From: "Steven J. Long" <slong@××××××××××××××××××.uk>
To: gentoo-dev@l.g.o
Subject: [gentoo-dev] Re: rfc: converting /etc/mtab to a symlink
Date: Mon, 14 Oct 2013 01:33:56
Message-Id: 20131014014026.GA2828@rathaus.eclipse.co.uk
In Reply to: Re: [gentoo-dev] rfc: converting /etc/mtab to a symlink by Patrick Lauer
1 On Mon, Oct 14, 2013 at 07:38:19AM +0800, Patrick Lauer wrote:
2 > On 10/14/2013 07:29 AM, Mike Gilbert wrote:
3 > > On Sun, Oct 13, 2013 at 7:21 PM, Patrick Lauer <patrick@g.o> wrote:
4 > >> On 10/14/2013 03:32 AM, William Hubbs wrote:
5 > >>> All,
6 > >>>
7 > >>> from what I'm seeing, we should look into converting /etc/mtab to a
8 > >>> symlink to /proc/self/mounts.
9 > >>>
10 > >>> Are there any remaining concerns about doing this?
11 > >>
12 > >> Apart from breaking umount -a and some other things?
13
14 What "other things"? AFAICT from the debian bug report[1] problems are far
15 much more likely when it's not a symlink, unless you're on kernel <2.6.26
16 (which is admittedly more likely for a Gentoo user, but it would not be the
17 mainstream Gentoo user, by any stretch of the imagination.)
18
19 > >> (The breakage is visible e.g. with umount -a tmpfs, which used to be
20 > >> quite useful if you had a few chroots with /var/tmp/portage as tmpfs and
21 > >> wanted to reset them. Now it'll also punt random things like /run if
22 > >> you're lucky - and in the past it knocked out the OpenRC state directory
23 > >> reliably)
24 > >>
25 > >
26 > > I don't follow this: it seems like umount -a is supposed to unmount
27 > > all filesystems. umount -a -t tmpfs would unmount all tmpfs
28 > > filesystems. /run should be included in that set, even if mtab is a
29 > > regular file.
30 > >
31 >
32 > And the magic trick is to keep "system mounts" like /run out of
33 > /etc/mtab (willful desynchronization) so that umount -a doesn't nuke
34 > them by accident.
35 >
36 > ... why else would you keep such data in two non-synchronized locations?! :D
37 >
38
39 You wouldn't: the only reason I've clung to the idea of a file, are the
40 transitional problems mentioned in the debian bug, ie information not available
41 in /proc/mounts that is available in /etc/mtab. Clearly that was fixed 2 years
42 ago, including for NFS and smb.
43
44 Given the CLONE_NEWNS issue (which one might use in the situation you describe):
45 "At this point, /etc/mtab *must* be a symlink to avoid breakage. Note that
46 /proc/mounts is now a symlink to /proc/self/mounts for this reason: each process
47 has potentially different mounts"; going forward it really does not seem like a
48 good idea not to default to the symlink.
49
50 I agree it should not be forced on existing installs, nor on an admin who wants
51 to do something funky (or is using an ancient kernel for some reason.) However
52 I would definitely support a news item about the default change, along with
53 a recommendation for existing installs also to change, unless the admin has
54 a reason not to.
55
56 Just as a heads-up, that the ground has changed, and the vast majority really
57 do not want to be running without that symlink.
58
59 And yeah, script that properly (or a new namespace if it works) you lazy git ;p
60
61 Regards,
62 steveL.
63
64 [1] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=494001
65
66 --
67 #friendly-coders -- We're friendly, but we're not /that/ friendly ;-)