Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 19158 - Read-only mounting of the root directory from fstab fails due to over-assumptious init script
Summary: Read-only mounting of the root directory from fstab fails due to over-assumpt...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: x86 Linux
: High major
Assignee: Martin Schlemmer (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-04-11 14:25 UTC by no_bs
Modified: 2003-05-04 03:06 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description no_bs 2003-04-11 14:25:02 UTC
The root filesystem is always mounted read-write even when instructed otherwise
(ro flag in /etc/fstab). This is due to the checkroot init script remounting the
root directory read-write without regard to what mounting option is specified in
/etc/fstab. This shouldn't be the case.

Reproducible: Always
Steps to Reproduce:
Set the mounting option for your root file system to "ro" in /etc/fstab.
Actual Results:  
On the next boot-up you can see that root gets still mounted read-write.

Expected Results:  
Respected the mounting option in /etc/fstab!

This is a basic Gentoo 1.4 RC3 install.
Comment 1 Martin Schlemmer (RETIRED) gentoo-dev 2003-04-27 13:24:17 UTC
Ok, this should fix it:

---------------------------------------------------------------------
Index: init.d/checkroot
===================================================================
RCS file: /home/cvsroot/gentoo-src/rc-scripts/init.d/checkroot,v
retrieving revision 1.29
diff -u -r1.29 checkroot
--- init.d/checkroot	9 Mar 2003 21:45:22 -0000	1.29
+++ init.d/checkroot	27 Apr 2003 17:21:08 -0000
@@ -44,14 +44,19 @@
 		fi
 	fi
 
-	ebegin "Remounting root filesystem read/write"
-	mount / -n -o remount,rw &>/dev/null
-	if [ "$?" -ne 0 ]
+	# Should we mount root rw ?
+	if mount -vf -o remount / 2> /dev/null | \
+			awk '{ if ($6 ~ /rw/) exit 0; else exit 1; }'
 	then
-		eend 2 "Root filesystem could not be mounted R/W :("
-		/sbin/sulogin ${CONSOLE}
-	else
-		eend 0
+		ebegin "Remounting root filesystem read/write"
+		mount / -n -o remount,rw &>/dev/null
+		if [ "$?" -ne 0 ]
+		then
+			eend 2 "Root filesystem could not be mounted read/write:("
+			/sbin/sulogin ${CONSOLE}
+		else
+			eend 0
+		fi
 	fi
 
 	if [ "${BOOT}" = "yes" ]
Comment 2 Martin Schlemmer (RETIRED) gentoo-dev 2003-04-27 17:17:45 UTC
This is fixed in baselayout-1.8.6.6; please test and let me know.
Comment 3 Martin Schlemmer (RETIRED) gentoo-dev 2003-05-04 03:06:40 UTC
Should be fixed.