Public bug reported:

Hi there,

There is a missing functionality in the following file: /usr/share
/initramfs-tools/hooks/cryptroot

resulting in the following error message:

cryptsetup: ERROR: Couldn't resolve device <zfs-mountpoint>
cryptsetup: WARNING: Couldn't determine root device

under the following condition:

update-initramfs -c -k all

when:

trying to resolve for encrypted zfs devices

so here is a patch to solve it, based off

Package: cryptsetup-initramfs
Version: 2:2.1.0-1ubuntu1

diff -Naur a/usr/share/initramfs-tools/hooks/cryptroot 
b/usr/share/initramfs-tools/hooks/cryptroot
--- a/usr/share/initramfs-tools/hooks/cryptroot 2019-05-22 18:34:12.116097472 
+0100
+++ b/usr/share/initramfs-tools/hooks/cryptroot 2019-05-22 20:13:02.159138688 
+0100
@@ -72,19 +72,28 @@
             # take the last mountpoint if used several times (shadowed)
             unset -v devnos
             spec="$(printf '%b' "$spec")"
-            resolve_device "$spec" || continue # resolve_device() already 
warns on error
             fstype="$(printf '%b' "$fstype")"
-            if [ "$fstype" = "btrfs" ]; then
-                # btrfs can span over multiple devices
-                if uuid="$(device_uuid "$DEV")"; then
-                    for dev in "/sys/fs/$fstype/$uuid/devices"/*/dev; do
-                        devnos="${devnos:+$devnos }$(cat "$dev")"
-                    done
-                else
-                    cryptsetup_message "ERROR: $spec: Couldn't determine UUID"
+            if [ "$fstype" = "zfs" ]; then
+                # zfs can span over multiple devices
+                for dev in $(zpool status -L -P | grep -o "/dev/[^ ]*"); do
+                    MAJ="$(printf "%d\n" 0x$(stat -L -c"%t" -- "$dev"))"
+                    MIN="$(printf "%d\n" 0x$(stat -L -c"%T" -- "$dev"))"
+                    devnos="${devnos:+$devnos }$MAJ:$MIN"
+                done
+            else
+                resolve_device "$spec" || continue # resolve_device() already 
warns on error
+                if [ "$fstype" = "btrfs" ]; then
+                    # btrfs can span over multiple devices
+                    if uuid="$(device_uuid "$DEV")"; then
+                        for dev in "/sys/fs/$fstype/$uuid/devices"/*/dev; do
+                            devnos="${devnos:+$devnos }$(cat "$dev")"
+                        done
+                    else
+                        cryptsetup_message "ERROR: $spec: Couldn't determine 
UUID"
+                    fi
+                elif [ -n "$fstype" ]; then
+                    devnos="$MAJ:$MIN"
                 fi
-            elif [ -n "$fstype" ]; then
-                devnos="$MAJ:$MIN"
             fi
         fi
     done </proc/mounts


Which works, I have tested it. However by solving this error message, the 
script can now continue further. And it then prints out some new messages that 
should not be there either. Unfortunately I could not track down the source of 
those subsequent warnings!

They say:

# update-initramfs -c -k all
update-initramfs: Generating /boot/initrd.img-5.0.0-15-generic
cryptsetup: WARNING: crypt_rpool1: ignoring unknown option 'nofail'
cryptsetup: WARNING: crypt_rpool1: ignoring unknown option 
    'x-systemd.device-timeout'


So clearly there is something which does not recognize the fstab mounting 
options of:

'nofail'
and
'x-systemd.device-timeout'

However those options are indeed valid, and were found to have a working
effect. They were tested also. So the warning is something else,
somewhere else. And I cannot grep it. Cannot google it. Nothing
happening in strace. It is pretty mysterious, as to where it is come
from. Mysterious messages!

Anyhow please take the first patch if you can. Or use those lines to
make your own version to improve as you please.

** Affects: cryptsetup (Ubuntu)
     Importance: Undecided
         Status: New

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

Title:
  patch for finding zfs, solves:  cryptsetup: WARNING: Couldn't
  determine root device

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/cryptsetup/+bug/1830110/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to