[Pkg-sysvinit-devel] Bug#697002: [PATCH sysvinit] Add support for mount and fsck of root and /usr by an initramfs

Ben Hutchings ben at decadent.org.uk
Sun Jan 17 05:46:43 UTC 2016


Control: tag -1 patch
---
- checkroot.sh: Do nothing if /run/initramfs/fsck-root exists
- checkfs.sh: Pass -M option to fsck instead of -R (Closes: #697002)
- mountall.sh: Remount /usr if already mounted

In checkfs.sh, it might be better to run fsck once with -T -N -R to
get a list of filesystems, filter out /usr depending on the stamp
file, then run it again with the new list.  I'm not convinced that the
output of fsck -N is a stable interface though.
---
This is needed to unblock #810965 in initramfs-tools and transitively
#810860 in usrmerge.  If I don't hear any objections, I'll NMU with
these changes in a few days.

Ben.

 debian/changelog                               | 6 ++++++
 debian/src/initscripts/etc/init.d/checkfs.sh   | 4 ++--
 debian/src/initscripts/etc/init.d/checkroot.sh | 6 ++++++
 debian/src/initscripts/etc/init.d/mountall.sh  | 9 +++++++--
 4 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index b2653ab..f78cf2b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,6 +3,12 @@ sysvinit (2.88dsf-59.3) UNRELEASED; urgency=medium
   [ Samuel Thibault ]
   * /etc/init.d/rc: Mount /proc on GNU/Hurd too (Closes: #798406)
 
+  [ Ben Hutchings ]
+  * Add support for mount and fsck of root and /usr by an initramfs:
+    - checkroot.sh: Do nothing if /run/initramfs/fsck-root exists
+    - checkfs.sh: Pass -M option to fsck instead of -R (Closes: #697002)
+    - mountall.sh: Remount /usr if already mounted
+
  -- Samuel Thibault <sthibault at debian.org>  Wed, 09 Sep 2015 00:02:13 +0200
 
 sysvinit (2.88dsf-59.2) unstable; urgency=medium
diff --git a/debian/src/initscripts/etc/init.d/checkfs.sh b/debian/src/initscripts/etc/init.d/checkfs.sh
index 07302d4..3c556ef 100755
--- a/debian/src/initscripts/etc/init.d/checkfs.sh
+++ b/debian/src/initscripts/etc/init.d/checkfs.sh
@@ -97,7 +97,7 @@ Continuing with system boot in 5 seconds."
 		if [ "$VERBOSE" = no ]
 		then
 			log_action_begin_msg "Checking file systems"
-			logsave -s $FSCK_LOGFILE fsck $spinner -R -A $fix $force $FSCKTYPES_OPT
+			logsave -s $FSCK_LOGFILE fsck $spinner -M -A $fix $force $FSCKTYPES_OPT
 			FSCKCODE=$?
 
 			if [ "$FSCKCODE" -eq 32 ]
@@ -118,7 +118,7 @@ Continuing with system boot in 5 seconds."
 			else
 				log_action_msg "Will now check all file systems"
 			fi
-			logsave -s $FSCK_LOGFILE fsck $spinner -V -R -A $fix $force $FSCKTYPES_OPT
+			logsave -s $FSCK_LOGFILE fsck $spinner -V -M -A $fix $force $FSCKTYPES_OPT
 			FSCKCODE=$?
 			if [ "$FSCKCODE" -eq 32 ]
 			then
diff --git a/debian/src/initscripts/etc/init.d/checkroot.sh b/debian/src/initscripts/etc/init.d/checkroot.sh
index bce9c41..9f70527 100755
--- a/debian/src/initscripts/etc/init.d/checkroot.sh
+++ b/debian/src/initscripts/etc/init.d/checkroot.sh
@@ -152,6 +152,12 @@ Will restart in 5 seconds."
 	# See if we want to check the root file system.
 	#
 	FSCKCODE=0
+
+	if [ -e /run/initramfs/fsck-root ]
+	then
+		rootcheck=no
+	fi
+
 	if is_fastboot_active
 	then
 		[ "$rootcheck" = yes ] && log_warning_msg "Fast boot enabled, so skipping root file system check."
diff --git a/debian/src/initscripts/etc/init.d/mountall.sh b/debian/src/initscripts/etc/init.d/mountall.sh
index baaacca..cf47e70 100755
--- a/debian/src/initscripts/etc/init.d/mountall.sh
+++ b/debian/src/initscripts/etc/init.d/mountall.sh
@@ -28,8 +28,13 @@ do_start() {
 	# Mount local file systems in /etc/fstab.
 	#
 	mount_all_local() {
-	    mount -a -t nonfs,nfs4,smbfs,cifs,ncp,ncpfs,coda,ocfs2,gfs,gfs2,ceph \
-		-O no_netdev
+		if mountpoint -q /usr; then
+			# May have been mounted read-only by initramfs.
+			# Remount with unmodified options from /etc/fstab.
+			mount -o remount /usr
+		fi
+		mount -a -t nonfs,nfs4,smbfs,cifs,ncp,ncpfs,coda,ocfs2,gfs,gfs2,ceph \
+			-O no_netdev
 	}
 	pre_mountall
 	if [ "$VERBOSE" = no ]
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 811 bytes
Desc: Digital signature
URL: <http://lists.alioth.debian.org/pipermail/pkg-sysvinit-devel/attachments/20160117/85d442ad/attachment.sig>


More information about the Pkg-sysvinit-devel mailing list