Generated grub.cfg is invalid when booting from ZFS with /boot on multiple physical devices

Bug #1867910 reported by Clemens Lang on 2020-03-18
This bug affects 1 person
Affects Status Importance Assigned to Milestone
grub2 (Ubuntu)

Bug Description

When updating to Ubuntu 19.10 from Ubuntu 18.10 setup according to the popular ZFS root howto at, update-grub generates an invalid grub.cfg, which renders the system unbootable.

This happens because the /boot partition is physically located on multiple devices (due to the ZFS mirror configuration setup). This causes /etc/grub.d/10_linux_zfs to detect the $initrd_device in get_dataset_info() incorrectly. grub-probe --target=device /boot prints multiple lines on such systems, e.g. in my case it prints

 $> grub-probe --target=device /boot

Because newlines are used as record separation character for the results printed by get_dataset_info() in bootlist(), this causes the detected record to be truncated early and any information that would have come after $initrd_device (initrd_list, kernel_list, last_booted_kernel) to be lost.


  initrd_device=$(${grub_probe} --target=device "${boot_dir}")

in line 415 with

  initrd_device=$(${grub_probe} --target=device "${boot_dir}" | head -1)

seems to solve this issue.

Since the root-on-ZFS howto linked above is the defacto standard, this likely affects everybody using ZFS upgrading to 19.10.

ProblemType: Bug
DistroRelease: Ubuntu 19.10
Package: grub-common 2.04-1ubuntu12.1
ProcVersionSignature: Ubuntu 5.3.0-42.34-generic 5.3.18
Uname: Linux 5.3.0-42-generic x86_64
NonfreeKernelModules: zfs zunicode zavl icp zcommon znvpair nvidia_modeset nvidia
ApportVersion: 2.20.11-0ubuntu8.5
Architecture: amd64
CurrentDesktop: GNOME
Date: Wed Mar 18 12:10:39 2020
SourcePackage: grub2
UpgradeStatus: Upgraded to eoan on 2020-03-17 (0 days ago)
modified.conffile..etc.logrotate.d.apport: [modified]
mtime.conffile..etc.grub.d.10_linux_zfs: 2020-03-17T21:33:09.441008
mtime.conffile..etc.logrotate.d.apport: 2019-09-05T11:36:37.998463

Clemens Lang (neverpanic) wrote :
Clemens Lang (neverpanic) wrote :

Possible duplicate of 1855605.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers