Package: initscripts
Version: 2.88dsf-59.9
Severity: serious
Tags: patch

Hi,


Reason for Severity=serious: This leaves /var (or other
filesystems) in an unclean state, so could possibly lead to
data loss!
(not to mention the lengthy fsck at every boot.)


umountfs in stretch changed the sed-calculation of
ROTECTED_MOUNTS. The new one includes /var on my system:

# sed -n ':a;/^[^ ]* \(\/\|\/usr\) /!{H;n;ba};{H;s/.*//;x;s/\n//;p}' 
/proc/mounts
/dev/root / ext2 rw,relatime,errors=continue 0 0
sysfs /sys sysfs rw,nosuid,nodev,noexec,relatime 0 0
tmpfs /run tmpfs rw,nosuid,noexec,relatime,size=305176k,mode=755 0 0
tmpfs /run/lock tmpfs rw,nosuid,nodev,noexec,relatime,size=5120k 0 0
proc /proc proc rw,nosuid,nodev,noexec,relatime 0 0
devtmpfs /dev devtmpfs rw,relatime,size=10240k,nr_inodes=381118,mode=755 0 0
tmpfs /run/shm tmpfs rw,nosuid,nodev,noexec,relatime,size=610340k 0 0
devpts /dev/pts devpts rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000 0 0
/dev/mapper/intvg1-sys_var /var ext2 rw,relatime,errors=continue 0 0
/dev/md3 /boot ext2 ro,relatime,errors=continue 0 0
/dev/mapper/intvg1-sys_usr /usr ext2 rw,relatime,errors=continue 0 0

The new sed was likely changed to include /usr in the list
of protected filesystems (it's remounted ro later).
But the new version basicly means (at least, I understand
it that way): Include all filesystems in ROTECTED_MOUNTS,
that are above the last mention of / or /usr.  While the
old one was about / only.


I propose to undo the sed changes and include /usr in the
specific list of filesystems to exclude from unmounting.

See attached patch.


Can you please try to include a fix in the next point
release of stretch?


Cheers

    Elrond
--- umountfs.orig	2017-07-20 09:23:26.000000000 +0200
+++ umountfs	2017-08-13 19:24:16.000000000 +0200
@@ -17,7 +17,7 @@
 umask 022
 
 do_stop () {
-	PROTECTED_MOUNTS="$(sed -n ':a;/^[^ ]* \(\/\|\/usr\) /!{H;n;ba};{H;s/.*//;x;s/\n//;p}' /proc/mounts)"
+	PROTECTED_MOUNTS="$(sed -n ':a;/^[^ ]* \/ /!{H;n;ba};{H;s/.*//;x;s/\n//;p}' /proc/mounts)"
 	WEAK_MTPTS="" # be gentle, don't use force
 	REG_MTPTS=""
 	TMPFS_MTPTS=""
@@ -25,7 +25,7 @@
 	do
 		echo "$PROTECTED_MOUNTS" | grep -qs "^$DEV $MTPT " && continue
 		case "$MTPT" in
-		  /|/proc|/dev|/.dev|/dev/pts|/dev/shm|/dev/.static/dev|/proc/*|/sys|/sys/*|/run|/run/*|/dev/vcs)
+		  /|/usr|/proc|/dev|/.dev|/dev/pts|/dev/shm|/dev/.static/dev|/proc/*|/sys|/sys/*|/run|/run/*|/dev/vcs)
 			continue
 			;;
 		esac

Reply via email to