[Bug 1945874] Re: 21.10 beta, errors in 10-linux and 10_linux_zfs
Mason Loring Bliss
1945874 at bugs.launchpad.net
Thu Nov 18 17:41:04 UTC 2021
I haven't had a chance to dig deeper, but I just noticed this same issue in
Focal Fossa.
If I get a chance to debug this I'll submit a patch here. I might get a
chance over the next week, during Thanksgiving break.
--
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/1945874
Title:
21.10 beta, errors in 10-linux and 10_linux_zfs
Status in grub2 package in Ubuntu:
New
Bug description:
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
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 obviously 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.)
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/1945874/+subscriptions
More information about the foundations-bugs
mailing list