Patchwork initrdscripts: mount / as read-only when live-booting

login
register
mail settings
Submitter Ross Burton
Date July 18, 2013, 1:59 p.m.
Message ID <1374155982-23797-2-git-send-email-ross.burton@intel.com>
Download mbox | patch
Permalink /patch/53963/
State Accepted
Commit 7af92f8fa3a12fc8fcb22dbd12f87d89768b2d39
Headers show

Comments

Ross Burton - July 18, 2013, 1:59 p.m.
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 <ross.burton@intel.com>
---
 meta/recipes-core/initrdscripts/files/init-live.sh |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Patch

diff --git a/meta/recipes-core/initrdscripts/files/init-live.sh b/meta/recipes-core/initrdscripts/files/init-live.sh
index 890c562..c56c79a 100644
--- a/meta/recipes-core/initrdscripts/files/init-live.sh
+++ b/meta/recipes-core/initrdscripts/files/init-live.sh
@@ -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
 	    ;;