zbm-dev/zfsbootmenu

Incompatible with recommended upstream and Ubuntu dataset layout

almereyda opened this issue · 4 comments

In openzfs/zfs#15261 it was suggested to switch to ZFSBootMenu for recovering a failed GRUB boot.

Suggestion: Switch to ZFSBootMenu and forget about GRUB (and its inability to fully deal with ZFS features).

Unfortunately ZFSBootMenu does not support to separate bpool and rpool. As per https://docs.zfsbootmenu.org/en/latest/man/zfsbootmenu.7.html the kernel root dataset is inferred from the boot environment and assumed to be on the same dataset, with no manual override foreseen:

Never set the root= argument; ZFSBootMenu always sets this option based on the selected boot environment.

It is possible to install ZFSBootMenu on Ubuntu, which uses the recommended file system layout for ZFS, with following only the last steps from the Ubuntu UEFI instructions and manually mounting (+ unmounting) the ESP:

Yet it will crash into the ZFSBootMenu recovery console.

Patching the zkexec command is needed to allow to boot the Kernel, since there is an assumption that the boot environment is to be found in a boot subdirectory of the dataset in question, and not at it's root, as is the case with Ubuntu.

Still this will not allow to sufficiently set the root= parameter, directly crashing into the Kernel's BusyBox ash:

cp /usr/sbin/zkexec /usr/sbin/zkexec2
sed 's|/boot||g' -i /usr/sbin/zkexec2
zkexec2 bpool/BOOT/ubuntu_abcdef vmlinuz-6.5.0-9-generic initrd.img-6.5.0-9-generic

https://docs.zfsbootmenu.org/en/v2.2.x/guides/general/bootenvs-and-you.html

We will never support a separate boot pool. It's a terrible idea that leads to misery. Copy the files from your boot filesystem to /boot on your root.

OK, thanks.

Are there some references why this is "a terrible idea that leads to misery" and a discussion with ZFS upstream, who recommend just that?

Else I'm happy to trust your judgment.

You should know that the guides hosted by OpenZFS are written by third parties, not by the ZFS team. I don't know whether the ZFS team has a position on any pool or file system layout, but in any case it wouldn't be relevant here.

Read our primer for a discussion on the merits of atomicity and, if you need some corroborating evidence, browse r/zfs on Reddit for the smorgasbord of "screwed by GRUB" posts. ZFSBootMenu exists precisely because the desire for GRUB compatibility leads to nothing but heartache.

Thank you for the hints!

Edit: Copying /boot worked. In addition for others who come here, this step may as well be accompagnied by removing the bpool altogether and permanently setting ZFSBootMenu as the main UEFI boot option, which may also involve removing GRUB from the system.