[PATCH] base-files: force /overlay to be remounted ro during shutdown.

Alec Panoviciu apanovic at infiniphy.com
Tue Oct 10 13:05:56 PDT 2023


When using overlayfs the '/bin/umount -a -d -r' command doesn't
actually unmount the upper fs as it's still referenced by the
overlay. This workaround makes the upper fs appear busy so it
at least gets remounted readonly.

Signed-off-by: Alec Panoviciu <apanovic at infiniphy.com>
---
 package/base-files/files/etc/init.d/umount | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/package/base-files/files/etc/init.d/umount b/package/base-files/files/etc/init.d/umount
index b764ae1..1776adc 100755
--- a/package/base-files/files/etc/init.d/umount
+++ b/package/base-files/files/etc/init.d/umount
@@ -9,5 +9,6 @@ restart() {
 
 stop() {
 	sync
-	/bin/umount -a -d -r
+	# force /overlay to be remounted ro if present
+	(cd /overlay ; /bin/umount -a -d -r )
 }
-- 
2.30.2




More information about the openwrt-devel mailing list