From 63443f6d344f2e0f9d2d4a4f6ec03c1096828f92 Mon Sep 17 00:00:00 2001 From: Dominique Martinet Date: Mon, 16 May 2022 12:21:50 +0900 Subject: [PATCH] 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. --- init.d/root.in | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/init.d/root.in b/init.d/root.in index 045bcd0fb..7a22132dd 100644 --- a/init.d/root.in +++ b/init.d/root.in @@ -45,6 +45,21 @@ start() ;; esac + case ",$(fstabinfo -o /)," in + *,shared,*) + ebegin "Making root filesystem shared" + case "$RC_UNAME" in + Linux) + mount --make-rshared / + ;; + *) + ewarn "Ignoring 'shared' option for / on non-linux" + ;; + esac + eend $? "Root filesystem could not be mounted read/write" + ;; + esac + ebegin "Remounting filesystems" local mountpoint for mountpoint in $(fstabinfo); do