initrdscripts: mount / as read-only when live-booting
RFC PATCH 1/1 initrdscripts: mount / as read-only when live-booting
Hi,
I noticed that our live image boot mounts / as read-write straight away, which seems to be the wrong thing to do as it means init can't do a fsck if required. From what I can tell both our sysvinit and systemd boots remount as rw once they've started so this should be safe, but I've not given this massive amounts of testing yet.
Consider this a Request For Comments/Testing, mainly as I'm going away for a few days from tomorrow.
Ross
PATCH 1/1 initrdscripts: mount / as read-only when live-booting
So that the root filesystem can be fsck'd properly, mount it read only. Either initscripts or systemd will re-mount as read-write in early boot.
Signed-off-by Ross Burton <[email protected]>
--- meta/recipes-core/initrdscripts/files/init-live.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
meta/recipes-core/initrdscripts/files/init-live.sh +3 -3
@@ -157,7 +157,7 @@ mount_and_boot() { case $union_fs_type in "overlayfs") mkdir -p /rootfs.ro /rootfs.rw - if ! mount -o rw,loop,noatime,nodiratime /media/$i/$ISOLINUX/$ROOT_IMAGE /rootfs.ro; then + if ! mount -o ro,loop,noatime,nodiratime /media/$i/$ISOLINUX/$ROOT_IMAGE /rootfs.ro; then rm -rf /rootfs.ro /rootfs.rw fatal "Could not mount rootfs image" else
@@ -170,7 +170,7 @@ mount_and_boot() { ;; "aufs") mkdir -p /rootfs.ro /rootfs.rw - if ! mount -o rw,loop,noatime,nodiratime /media/$i/$ISOLINUX/$ROOT_IMAGE /rootfs.ro; then + if ! mount -o ro,loop,noatime,nodiratime /media/$i/$ISOLINUX/$ROOT_IMAGE /rootfs.ro; then rm -rf /rootfs.ro /rootfs.rw fatal "Could not mount rootfs image" else
@@ -182,7 +182,7 @@ mount_and_boot() { fi ;; "") - if ! mount -o rw,loop,noatime,nodiratime /media/$i/$ISOLINUX/$ROOT_IMAGE $ROOT_MOUNT ; then + if ! mount -o ro,loop,noatime,nodiratime /media/$i/$ISOLINUX/$ROOT_IMAGE $ROOT_MOUNT ; then fatal "Could not mount rootfs image" fi ;;
Signature · 1 line
1.7.10.4