Skip to content

Commit 63443f6

Browse files
committed
init.d/root: add support for 'shared' fstab option on /
containers on linux might require filesystems to be mounted with different propagation than the kernel default of 'private': by setting 'shared' in fstab for / options, one can now make the fs hierarchy shared. Note we use 'rshared' to make other existing mounts shared as well because the setting is contagious and it seemed more logical to behave as if the setting was set on / immediately (and thus inherited by other mounts) This fixes #525.
1 parent 98d2b43 commit 63443f6

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

init.d/root.in

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,21 @@ start()
4545
;;
4646
esac
4747

48+
case ",$(fstabinfo -o /)," in
49+
*,shared,*)
50+
ebegin "Making root filesystem shared"
51+
case "$RC_UNAME" in
52+
Linux)
53+
mount --make-rshared /
54+
;;
55+
*)
56+
ewarn "Ignoring 'shared' option for / on non-linux"
57+
;;
58+
esac
59+
eend $? "Root filesystem could not be mounted read/write"
60+
;;
61+
esac
62+
4863
ebegin "Remounting filesystems"
4964
local mountpoint
5065
for mountpoint in $(fstabinfo); do

0 commit comments

Comments
 (0)