Bug#876994: initramfs-tools: fsck return code 2 is ignored
Package: initramfs-tools
Version: 0.130
Severity: normal
Dear Maintainer,
I took a look at the scripts/functions file and it seems that in
_checkfs_once() the return code 2 is considered as "File system check
failed but did not detect errors" and the initramfs is not panicing.
>From the fsck manpage:
The exit code returned by fsck is the sum of the following conditions:
2 System should be rebooted
I think the initramfs should not try to mount and use the filesystem
after this error occurs and therefor it should panic.
I attached a patch to fix the problem.
Regards,
Sven
*** patch
--- a/scripts/functions Wed Sep 27 10:25:28 2017 +0200
+++ b/scripts/functions Wed Sep 27 15:37:12 2017 +0200
@@ -345,6 +345,7 @@
fi
FSCK_LOGFILE=/run/initramfs/fsck.log
FSCK_STAMPFILE=/run/initramfs/fsck-${NAME#/}
+ FSCK_REBOOT=/run/initramfs/fsck-reboot
TYPE=$(get_fstype "$1")
@@ -392,11 +393,17 @@
# NOTE: "failure" is defined as exiting with a return code of
# 4, possibly or-ed with other flags. A return code of 1
# indicates that file system errors were corrected but that
- # the boot may proceed.
+ # the boot may proceed. A return code of 2, possibly or-ed with other flags,
+ # indicates that the system should be rebooted.
#
if [ "$FSCKCODE" -eq 32 ]
then
log_warning_msg "File system check was interrupted by user"
+ elif [ $((FSCKCODE & 2)) -eq 2 ]
+ then
+ log_failure_msg "File system check of the $NAME filesystem failed. Needs reboot."
+ > /run/initramfs/fsck-reboot
+ return 1
elif [ $((FSCKCODE & 4)) -eq 4 ]
then
log_failure_msg "File system check of the $NAME filesystem failed"
Reply to: