:: [devuan-dev] bug#932: init scripts …
Startseite
Nachricht löschen
Nachricht beantworten
Autor: Walter Alejandro Iglesias
Datum:  
To: Mark Hindley, 932-quiet, Thorsten Glaser
CC: 932, 932-submitter
Betreff: [devuan-dev] bug#932: init scripts fail when /var is in a separate partition
Hi Mark,

On Thu, Jan 08, 2026 at 03:11:16PM +0000, Mark Hindley wrote:
> Control: forwarded -1 https://bugs.debian.org/1106830
> Control: fixed -1 3.15-5devuan1
>
> Walter,
>
> This is Debian bug #1106830[1]. It was fixed in sysvinit/3.15-4, and
> sysvinit/3.15-5devuan1. However that version is not in excalibur.
> [...]
>
> [1] https://bugs.debian.org/1106830
>
> Mark


I finally could find your patch.

https://salsa.debian.org/debian/sysvinit/-/commit/d2cc1a71d27f2dc5b0d28dcd36c2246dd46bfb0b

I see that you just reverted a check added by Thorsten Glaser (sending a
copy of this message to him).

Consider my solution, please. It allows restoring that check, this time
won't fail since it's done once all partitions are mounted. It also
removes the logsave_best_effort() function from
/usr/lib/init/mount-funcionts.sh, which, as the author himself admits in
the comment, is a "duct-tape solution".

In the diff I sent you in the previous message I made a slip. In one
of the conditionals I was still using the variable FSCK_LOGFILE I had
deleted. Below, a corrected version with some comments added.


--- /etc/init.d/checkroot.sh.orig    2026-01-09 11:33:58.455918953 +0100
+++ /etc/init.d/checkroot.sh    2026-01-09 11:24:01.383928064 +0100
@@ -14,7 +14,6 @@
 # Include /usr/bin in path to find on_ac_power if /usr/ is on the root
 # partition.
 PATH=/usr/bin:/sbin:/bin
-FSCK_LOGFILE=/var/log/fsck/checkroot
 [ "$FSCKFIX" ] || FSCKFIX=no
 [ "$SULOGIN" ] || SULOGIN=no
 . /lib/init/vars.sh
@@ -166,23 +165,6 @@ Will restart in 5 seconds."
 #        fi
 #    fi


-    #
-    # See if we want to check the root file system.
-    #
-    FSCKCODE=0
-
-    if [ -e /run/initramfs/fsck-root ]
-    then
-        rootcheck=no
-        # logsave_best_effort but do not display again
-        if [ -x /sbin/logsave ] && [ -e "${FSCK_LOGFILE}" ]; then
-            logsave -s "${FSCK_LOGFILE}" >/dev/null \
-                cat /run/initramfs/fsck.log
-        else
-            log_failure_msg "Cannot persist initramfs fsck.log"
-        fi
-    fi
-
     if is_fastboot_active
     then
         [ "$rootcheck" = yes ] && log_warning_msg "Fast boot enabled, so skipping root file system check."
@@ -224,8 +206,10 @@ Will restart in 5 seconds."
     fi


     #
-    # The actual checking is done here.
+    # See if we want to check the root file system.
     #
+    FSCKCODE=0
+
     if [ "$rootcheck" = yes ]
     then
         force=""
@@ -248,12 +232,12 @@ Will restart in 5 seconds."
         then
             spinner=""
         fi
-        
+
         if [ "$VERBOSE" = no ]
         then
             log_action_begin_msg "Checking root file system"
             $setterm --msg off
-            logsave_best_effort fsck $spinner $force $fix -T -t $roottype $rootdev
+            fsck $spinner $force $fix -T -t $roottype $rootdev
             FSCKCODE=$?
             $setterm --msg on
             if [ "$FSCKCODE" = 0 ]
@@ -264,7 +248,7 @@ Will restart in 5 seconds."
             fi
         else
             log_daemon_msg "Will now check root file system"
-            logsave_best_effort fsck $spinner $force $fix -T -V -t $roottype $rootdev
+            fsck $spinner $force $fix -T -V -t $roottype $rootdev
             FSCKCODE=$?
             log_end_msg $FSCKCODE
         fi
--- /etc/init.d/checkfs.sh.orig    2026-01-08 15:42:23.179988644 +0100
+++ /etc/init.d/checkfs.sh    2026-01-08 16:28:02.315992670 +0100
@@ -98,7 +98,7 @@ Continuing with system boot in 5 seconds
         then
             log_action_begin_msg "Checking file systems"
             $setterm --msg off
-            logsave_best_effort fsck $spinner -T -M -A $fix $force $FSCKTYPES_OPT
+            fsck $spinner -T -M -A $fix $force $FSCKTYPES_OPT
             FSCKCODE=$?
             $setterm --msg on


@@ -120,7 +120,7 @@ Continuing with system boot in 5 seconds
             else
                 log_action_msg "Will now check all file systems"
             fi
-            logsave_best_effort fsck $spinner -V -T -M -A $fix $force $FSCKTYPES_OPT
+            fsck $spinner -V -T -M -A $fix $force $FSCKTYPES_OPT
             FSCKCODE=$?
             if [ "$FSCKCODE" -eq 32 ]
             then
--- /etc/init.d/mountall.sh.orig    2026-01-08 15:40:33.167990323 +0100
+++ /etc/init.d/mountall.sh    2026-01-09 11:33:56.895918977 +0100
@@ -48,11 +48,33 @@ do_start() {
     fi
     post_mountall


-    # Instances of savelog(8), started from {checkroot} and {checkfs} will
-    # wait for /var/log/fsck to appear to write logs there. If /var/log is
-    # tmpfs, we have to make /var/log/fsck appear here. (see #524007)
+    # Save fsck logs to /var/log/fsck.  This was in checkroot and
+    # checkfs, moving it here allows to check if those log files are
+    # available when /var is in a separate partition (and not
+    # pre-mounted by initramfs).
+
+    # If /var/log is tmpfs, we have to make /var/log/fsck appear
+    # here. (see #524007)
     mkdir -p /var/log/fsck


+    if [ -e /run/initramfs/fsck-root ]
+    then
+        rootcheck=no
+        if [ -x /sbin/logsave ] && [ -e /var/log/fsck/checkroot ]; then
+            logsave -s /var/log/fsck/checkroot >/dev/null \
+                cat /run/initramfs/fsck.log
+        else
+            log_failure_msg "Cannot persist initramfs fsck.log"
+        fi
+    fi
+    if [ -x /sbin/logsave ] && [ -e /var/log/fsck/checkfs ]; then
+        logsave -s /var/log/fsck/checkfs >/dev/null \
+            cat /run/initramfs/fsck.log
+    else
+        log_failure_msg "Cannot persist the following output on disc"
+        "$@"
+    fi
+
     # We might have mounted something over /run; see if
     # /run/initctl is present.  Look for
     # /usr/share/sysvinit/update-rc.d to verify that sysvinit (and
--- /usr/lib/init/mount-functions.sh.orig    2026-01-08 16:15:21.223989620 +0100
+++ /usr/lib/init/mount-functions.sh    2026-01-08 16:15:31.967989456 +0100
@@ -723,14 +723,3 @@ is_fastboot_active() {
     done
     return 1
 }
-
-# This function does not actually belong here; it is duct-tape solution
-# for #901289.
-logsave_best_effort() {
-    if [ -x /sbin/logsave ] && [ -e "${FSCK_LOGFILE}" ]; then
-        logsave -s "${FSCK_LOGFILE}" "$@"
-    else
-        log_failure_msg "Cannot persist the following output on disc"
-        "$@"
-    fi
-}



--
Walter