fsck: Mention file system name in failed identification warning

`update-initramfs` might be unable to identify the file system type of
the root file system:

```
$ update-initramfs -u
update-initramfs: Generating /boot/initrd.img-5.15.0-1059-kvm
W: Couldn't identify type of root file system for fsck hook
```

This error message can be confusing and misleading for the user. The
Ubuntu bug reported initially assumed it to be a bug in initramfs-tools
but later found out that the file system missed the label.

Mention the file system name in failed identification warning to help
the user finding the reason.

Bug-Ubuntu: https://launchpad.net/bugs/2068077
Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
This commit is contained in:
Benjamin Drung 2024-06-10 22:52:46 +02:00
parent 84e5c0f7da
commit a3428db010

View File

@ -44,6 +44,7 @@ _read_fstab_entry () {
# Find a specific fstab entry and print its type (if found, and pass != 0)
# $1=mountpoint
get_fsck_type_fstab () {
local device
eval "$(_read_fstab_entry "$1")"
# Not found by default.
@ -51,11 +52,11 @@ get_fsck_type_fstab () {
# Ignore filesystem type for /, as it is not available and
# therefore never used at boot time
if [ "${MNT_DIR}" = "/" ] || [ "${MNT_TYPE}" = "auto" ]; then
MNT_FSNAME="$(resolve_device "${MNT_FSNAME}")"
device="$(resolve_device "${MNT_FSNAME}")"
# shellcheck disable=SC2317
fstype() { "/usr/lib/klibc/bin/fstype" "$@"; }
if ! get_fstype "${MNT_FSNAME}"; then
echo "W: Couldn't identify type of $2 file system for fsck hook" >&2
if ! get_fstype "${device}"; then
echo "W: Couldn't identify type of $2 file system '$MNT_FSNAME' for fsck hook" >&2
fi
unset -f fstype
else