[Bug 1867910] [NEW] Generated grub.cfg is invalid when booting from ZFS with /boot on multiple physical devices
Clemens Lang
neverpanic at gmail.com
Wed Mar 18 11:20:34 UTC 2020
*** This bug is a duplicate of bug 1848856 ***
https://bugs.launchpad.net/bugs/1848856
Public bug reported:
When updating to Ubuntu 19.10 from Ubuntu 18.10 setup according to the
popular ZFS root howto at
https://github.com/openzfs/zfs/wiki/Ubuntu-18.04-Root-on-ZFS, 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
/dev/sda2
/dev/sdb2
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.
Replacing
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
** Affects: grub2 (Ubuntu)
Importance: Undecided
Status: New
** Tags: amd64 apport-bug eoan grub wayland-session zfs
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to grub2 in Ubuntu.
https://bugs.launchpad.net/bugs/1867910
Title:
Generated grub.cfg is invalid when booting from ZFS with /boot on
multiple physical devices
Status in grub2 package in Ubuntu:
New
Bug description:
When updating to Ubuntu 19.10 from Ubuntu 18.10 setup according to the
popular ZFS root howto at
https://github.com/openzfs/zfs/wiki/Ubuntu-18.04-Root-on-ZFS, 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
/dev/sda2
/dev/sdb2
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.
Replacing
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
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/1867910/+subscriptions
More information about the foundations-bugs
mailing list