[Bug 2068077] Re: initramfs-tools reports "can't identify type of root filesystem" when label is missing

Benjamin Drung 2068077 at bugs.launchpad.net
Mon Jun 10 16:14:00 UTC 2024


Suggestion:

```
diff --git a/hooks/fsck b/hooks/fsck
index f6348e81..5e5b6aae 100755
--- a/hooks/fsck
+++ b/hooks/fsck
@@ -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,9 +52,9 @@ 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}")"
-                       if ! get_fstype "${MNT_FSNAME}"; then
-                               echo "W: Couldn't identify type of $2 file system for fsck hook" >&2
+                       device="$(resolve_device "${MNT_FSNAME}")"
+                       if ! get_fstype "${device}"; then
+                               echo "W: Couldn't identify type of $2 file system '$MNT_FSNAME' for fsck hook" >&2
                        fi
                else
                        echo "${MNT_TYPE}"
```

This would change the error message to:

```
$ sudo update-initramfs -u
update-initramfs: Generating /boot/initrd.img-6.8.0-22-generic
W: Couldn't identify type of root file system 'LABEL=foo' for fsck hook
```

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to initramfs-tools in Ubuntu.
https://bugs.launchpad.net/bugs/2068077

Title:
  initramfs-tools reports "can't identify type of root filesystem" when
  label is missing

Status in initramfs-tools package in Ubuntu:
  New

Bug description:
  When I attempt to regenerate an initramfs for a new root filsystem,
  update-initramfs is unable to identify the filesystem type of this
  initramfs.

  ```
  # 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
  W: mkconf: MD subsystem is not loaded, thus I cannot scan for arrays.
  W: mdadm: failed to auto-generate temporary mdadm.conf file.
  ```

  the mounted filesystem:
  ```
  # cat /proc/mounts | grep xfs
  /dev/sda1 / xfs rw,relatime,attr2,inode64,logbufs=8,logbsize=32k,noquota 0 0
  ```

  fstab:
  ```
  # cat /etc/fstab | grep xfs
  LABEL=cloudimg-rootfs	/	 xfs    defaults	0 1
  ```

  cmdline:
  ```
  BOOT_IMAGE=/boot/vmlinuz-5.15.0-1059-kvm root=PARTUUID=575c9681-fb9d-457c-a3b5-407dda61a919 ro console=tty1 console=ttyS0 panic=-1
  ```

  
  The failure is in hooks/fsck when it calls resolve_device(). The function returns 1 and echos nothing because it has a LABEL, not a UUID or PARTUUID.

  ProblemType: Bug
  DistroRelease: Ubuntu 22.04
  Package: initramfs-tools 0.140ubuntu13.4
  ProcVersionSignature: Ubuntu 5.15.0-1059.64-kvm 5.15.149
  Uname: Linux 5.15.0-1059-kvm x86_64
  ApportVersion: 2.20.11-0ubuntu82.5
  Architecture: amd64
  CasperMD5CheckResult: unknown
  Date: Wed Jun  5 01:25:29 2024
  PackageArchitecture: all
  ProcEnviron:
   TERM=vt220
   PATH=(custom, no user)
   XDG_RUNTIME_DIR=<set>
   LANG=C.UTF-8
   SHELL=/bin/bash
  SourcePackage: initramfs-tools
  UpgradeStatus: No upgrade log present (probably fresh install)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/initramfs-tools/+bug/2068077/+subscriptions




More information about the foundations-bugs mailing list