Public bug reported:
In a custom install of Ubuntu 21.10 beta, both hardware and VM installs suffer from a bug in the grub.d/10_linux and 10_linux_zfs scripts. (For comparison, Debian Bullseye, running a similar version of grub, doesn't have this issue.) Unique to Ubuntu, there's this block in 10_linux: xzfs) # We have a more specialized ZFS handler, with multiple system in # 10_linux_zfs. if [ -e "`dirname $(readlink -f $0)`/10_linux_zfs" ]; then echo "zoinks!" >> /tmp/foo exit 0 fi This looks at the root filesystem, and if it's ZFS, it shunts kernel discovery and entry population off to 10_linux_zfs. This subsequent script assumes that the default/automated Ubuntu ZFS layout is in effect, and if it's not, the end result is that 10_linux doesn't add an entry because there is ZFS present, and 10_linux_zfs doesn't add a kernel stanza either, evidently because /boot isn't in a pool. (I haven't tracked the logic in 10_linux_zfs fully but given time pressure I wanted to get this bug in so someone could look at it.) With this combination of events, the resulting grub.cfg has no kernel stanzas at all, leaving the user at a grub> prompt. Manual configuration and booting from the prompt works from this point, but it's obvious not ideal. In testing, commenting out the "exit" in the code block noted above resulted in correct stanzas being generated, in this case with /boot being on ext4 atop MD-RAID1. Rather than exiting if the root is on ZFS, correct behaviour would occur in more cases if we check for /boot being on ZFS or not. A simple check (untested) might be: if ! grep -q '[[:space:]]/boot[[:space:]]' /etc/fstab; then exit 0 fi This doesn't check for 10_linux_zfs existing, but that check is perhaps redundant given that the file is installed alongside 10_linux and thus will always exist, as packaged. This instead checks to see if there's a /boot in /etc/fstab, which if present should indicate that /boot is not going to be found on a ZFS dataset. (Certainly, traditional filesystems can exist on zvols and legacy-mount datasets exist, and both of these can appear in fstab, but neither of those is possible for a working /boot.) ** Affects: grub (Ubuntu) Importance: Undecided Status: New ** Description changed: + In a custom install of Ubuntu 21.10 beta, both hardware and VM installs suffer from a bug in the grub.d/10_linux and 10_linux_zfs scripts. (For comparison, Debian Bullseye, running a similar version of grub, doesn't have this issue.) Unique to Ubuntu, there's this block in 10_linux: - xzfs) + xzfs) # We have a more specialized ZFS handler, with multiple system in # 10_linux_zfs. if [ -e "`dirname $(readlink -f $0)`/10_linux_zfs" ]; then echo "zoinks!" >> /tmp/foo exit 0 fi - This looks at the root filesystem, and if it's ZFS, it shunts kernel - discovery and entry population off to 10_linux_zfs. This subsequent script - assumes that the default/automated Ubuntu ZFS layout is in effect, and if - it's not, the end result is that 10_linux doesn't add an entry because - there is ZFS present, and 10_linux_zfs doesn't add a kernel stanza either, - evidently because /boot isn't in a pool. (I haven't tracked the logic in - 10_linux_zfs fully but given time pressure I wanted to get this bug in so - someone could look at it.) With this combination of events, the resulting - grub.cfg has no kernel stanzas at all, leaving the user at a grub> prompt. - Manual configuration and booting from the prompt works from this point, but - it's obvious not ideal. + This looks at the root filesystem, and if it's ZFS, it shunts kernel + discovery and entry population off to 10_linux_zfs. This subsequent + script assumes that the default/automated Ubuntu ZFS layout is in + effect, and if it's not, the end result is that 10_linux doesn't add an + entry because there is ZFS present, and 10_linux_zfs doesn't add a + kernel stanza either, evidently because /boot isn't in a pool. (I + haven't tracked the logic in 10_linux_zfs fully but given time pressure + I wanted to get this bug in so someone could look at it.) With this + combination of events, the resulting grub.cfg has no kernel stanzas at + all, leaving the user at a grub> prompt. Manual configuration and + booting from the prompt works from this point, but it's obvious not + ideal. - In testing, commenting out the "exit" in the code block noted above - resulted in correct stanzas being generated, in this case with /boot being - on ext4 atop MD-RAID1. Rather than exiting if the root is on ZFS, correct - behaviour would occur in more cases if we check for /boot being on ZFS or - not. A simple check (untested) might be: - + In testing, commenting out the "exit" in the code block noted above + resulted in correct stanzas being generated, in this case with /boot + being on ext4 atop MD-RAID1. Rather than exiting if the root is on ZFS, + correct behaviour would occur in more cases if we check for /boot being + on ZFS or not. A simple check (untested) might be: + if ! grep -q '[[:space:]]/boot[[:space:]]' /etc/fstab; then exit 0 fi This doesn't check for 10_linux_zfs existing, but that check is perhaps - redundant given that the file is installed alongside 10_linux and thus will - always exist, as packaged. This instead checks to see if there's a /boot in - /etc/fstab, which if present should indicate that /boot is not going to be - found on a ZFS dataset. (Certainly, traditional filesystems can exist on - zvols and legacy-mount datasets exist, and both of these can appear in - fstab, but neither of those is possible for a working /boot.) + redundant given that the file is installed alongside 10_linux and thus + will always exist, as packaged. This instead checks to see if there's a + /boot in /etc/fstab, which if present should indicate that /boot is not + going to be found on a ZFS dataset. (Certainly, traditional filesystems + can exist on zvols and legacy-mount datasets exist, and both of these + can appear in fstab, but neither of those is possible for a working + /boot.) -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1945874 Title: 21.10 beta, errors in 10-linux and 10_linux_zfs To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/grub/+bug/1945874/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs