From 0747f72a7f33f797f081f0745faa99eaac7f04a1 Mon Sep 17 00:00:00 2001 From: coolsnowwolf Date: Wed, 29 Mar 2023 18:32:18 +0800 Subject: [PATCH] base-files: force remount ext4 rootfs when power-off by accident last time --- package/base-files/files/lib/preinit/80_mount_root | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/package/base-files/files/lib/preinit/80_mount_root b/package/base-files/files/lib/preinit/80_mount_root index c3816c2cb..788a6ba47 100644 --- a/package/base-files/files/lib/preinit/80_mount_root +++ b/package/base-files/files/lib/preinit/80_mount_root @@ -17,6 +17,10 @@ missing_lines() { do_mount_root() { mount_root boot_run_hook preinit_mount_root + have_ro_ext4=$(/bin/cat /proc/mounts |/bin/grep ' / ext4'|/bin/grep 'ro'|/usr/bin/wc -l) + if [ "$have_ro_ext4" != "0" ]; then + /usr/bin/mount -o remount,rw,noatime / + fi [ -f /sysupgrade.tgz -o -f /tmp/sysupgrade.tar ] && { echo "- config restore -" cp /etc/passwd /etc/group /etc/shadow /tmp