Bug#1106830: initscripts: checkroot.sh returns error and does not attem
From
Bartos-Elekes Zsolt@21:1/5 to
All on Fri May 30 09:50:02 2025
Package: initscripts
Version: 3.14-4
Dear maintainer,
checkroot.sh returns error and does not even attempt to save logs if logfile does not exist - for example, when /var/log
is on a different partition, which is not yet mounted.
[root@debian13 ~]# ls -l /var/log/fsck
ls: cannot access '/var/log/fsck': No such file or directory
[root@debian13 ~]# /etc/init.d/checkroot.sh start
Will now check root file system:Cannot persist the following output on disc ... failed!
[/sbin/fsck.ext4 (1) -- /] fsck.ext4 -a -C0 /dev/sda1
/dev/sda1: clean, 28655/524288 files, 374797/2096896 blocks
The culprit is the logsave_best_effort function in mount-functions.sh, which only runs logsave if the logfile exists,
defeating the very purpose of logsave.
I suggest the following patch:
--- old/mount-functions.sh
+++ new/mount-functions.sh
@@ -727,7 +727,7 @@
# 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
+ if [ -x /sbin/logsave ]; then
logsave -s "${FSCK_LOGFILE}" "$@"
else
log_failure_msg "Cannot persist the following output on disc"
And maybe we should change the log severity to warning - the important part is actually running the command (in our
case: fsck), not saving the log; and perhaps changing "disc" to "disk" in the error message (AFAIK "disc" refers to
optical media).
--- old/mount-functions.sh
+++ new/mount-functions.sh
@@ -730,7 +730,7 @@
if [ -x /sbin/logsave ]; then
logsave -s "${FSCK_LOGFILE}" "$@"
else
- log_failure_msg "Cannot persist the following output on disc"
+ log_warning_msg "Cannot persist the