Gentoo Archives: gentoo-dev

From: Patrick Lauer <patrick@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] rfc: Does OpenRC really need mount-ro
Date: Tue, 16 Feb 2016 19:33:15
Message-Id: 56C3792A.3010602@gentoo.org
In Reply to: [gentoo-dev] rfc: Does OpenRC really need mount-ro by William Hubbs
1 On 02/16/2016 07:05 PM, William Hubbs wrote:
2 > All,
3 >
4 > I have a bug that points out a significant issue with
5 > /etc/init.d/mount-ro in OpenRC.
6 >
7 > Apparently, there are issues that cause it to not work properly for file
8 > systems which happen to be pre-mounted from an initramfs [1].
9 I don't understand how this fails, how does mounting from the initramfs
10 cause issues?
11
12 The failure message comes from rc-mount.sh when the list of PIDs using a
13 mountpoint includes "$$" which is shell shorthand for self. How can the
14 current shell claim to be using /usr when it is a shell that only has
15 dependencies in $LIBDIR ?
16 As far as I can tell the code at this point calls fuser -k ${list of
17 pids}, and fuser outputs all PIDs that still use it. I don't see how $$
18 can end up in there ...
19
20 >
21 > This service only exists in the Linux world; there is no equivalent in
22 > OpenRC for any other operating systems we support.
23 >
24 > The reason it exists is very vague to me; I think it has something to do
25 > with claims of data loss in the past.
26 Yes, if you just shut down without unmounting file systems -
27 (1) you may throw away data in the FS cache that hasn't ended up on disk yet
28 (2) the filesystem has no chance to mark itself cleanly unmounted, so
29 you will trigger journal replay or fsck or equivalent on boot
30
31 That's why sysvinit had a random "sleep(1)" in the halt and "sleep(2)"
32 in the reboot function, to give computers more of a chance to shutdown
33 and reboot sanely.
34
35 The changes in sysvinit-2.88-r8 and later add the "-n" option:
36 -n Don't sync before reboot or halt. Note that the kernel and
37 storage drivers may still sync.
38
39 This was added *because* we can guarantee that filesystems are
40 consistent enough with mount-ro. If you wish to remove it you need to
41 reconsider all these little details ...
42 >
43 > I'm asking for more specific information, and if there is none, due to
44 > the bug I lincluded in this message, I am considering removing this
45 > service in 0.21 since I can't find an equivalent anywhere else.
46 Please don't just remove things you don't understand.
47 >
48 > Thanks,
49 >
50 > William
51 >
52 > [1] https://bugs.gentoo.org/show_bug.cgi?id=573760
53
54 Looking at the init script as of openrc-0.20.5:
55
56 ~line32:
57 # Bug 381783
58 local rc_svcdir=$(echo $RC_SVCDIR | sed
59 's:/lib\(32\|64\)\?/:/lib(32|64)?/:g')
60 This looks relatively useless with everything migrated to /run and can
61 most likely be removed
62
63 ~line35:
64 local
65 m="/dev|/dev/.*|/proc|/proc.*|/sys|/sys/.*|/run|${rc_svcdir}" x= fs=
66 Since this is a regexp it can be cut down to something more simple - why
67 /dev and /dev/* when the second one is already excluded by the first
68 one. Also rc_svcdir is most likely a subdir of /run ...

Replies

Subject Author
Re: [gentoo-dev] rfc: Does OpenRC really need mount-ro Rich Freeman <rich0@g.o>