#1064945 grub-efi-amd64: Sudden boot failures on ZFS systems

Package:
grub-efi-amd64
Source:
grub-efi-amd64
Description:
GRand Unified Bootloader, version 2 (EFI-AMD64 version)
Submitter:
John Goerzen
Date:
2024-02-28 09:30:06 UTC
Severity:
normal
Tags:
#1064945#5
Date:
2024-02-28 04:36:01 UTC
From:
To:
My system suddenly refused to start up grub.  An error message flashed by, but
too quickly for me to be able to see.  Then I got the grub emergency prompt.

Upon booting from a Debian live image to attempt to fix this, after chrooting
into an appropriately-configured filesystem from the target (with bind-mount
/proc, /sys, /dev, /boot/efi, etc), grub-install failed with:

error: compression algorithm inherit not supported

I'll note that "inherit" is not really a compression algorithm for ZFS.  (root,
and also boot, are part of ZFS on this system.)

Upon researching this, I see that https://github.com/openzfs/zfs/issues/15261
discusses the problem.  https://github.com/openzfs/zfs/issues/13873 does as
well.

https://github.com/openzfs/zfs/issues/13873#issuecomment-1905182760 suggests
that it is the ZFS feature extensible_dataset that is responsible for this.
That feature can get auto-enabled by other features at runtime.

Both of these bugs indicate that grub 2.12 contains patches to fix the issue.
Indeed, the four patches listed at
https://git.savannah.gnu.org/cgit/grub.git/log/grub-core/fs/zfs/zfs.c pertaining
to ZFS are thought to fix it.

I have built a bookworm-backports version of grub 2.12 and it does indeed solve
the problem.

I think this issue justifies backporting those ZFS patches into the version in
bookworm for stable-proposed-updates.

Thanks!

- John

#1064945#10
Date:
2024-02-28 09:28:25 UTC
From:
To:
Control: severity -1 normal
Control: tag -1 - patch

My understanding is that this happens when snapshots are used on /boot which
as you can see is not a supported configuration.

Also note that zfs on /boot is one of the file systems we are looking at
phasing out for a future Debian release because it is overly complex for
the use case and hence a significant risk factor for secure boot.
not 4, between 2.06 and 2.12

$ git shortlog grub-2.06..grub-2.12 grub-core/fs/zfs/
Darren Kenny (1):
      fs/zfs/zfs: Fix possible insecure use of chunk size in zap_leaf_array_get()

Elyes Haouas (1):
      fs: Remove trailing whitespaces

Glenn Washburn (1):
      zfs: Use grub_uint64_t instead of 1ULL in BF64_*CODE() macros

Jagannathan Raman (4):
      fs/zfs/zfs: make_mdn() - avoid pointer downcasting
      fs/zfs/zfs: zfs_mount() - avoid pointer downcasting
      fs/zfs/zfs: Pass pointer to dnode_end_t instead of value to fill_fs_info()
      fs/zfs/zfs: Update dangling dn_new pointer in dnode_get_path()

Vladimir 'phcoder' Serbinenko (1):
      Revert "zfsinfo: Correct a check for error allocating memory"

Vladimir Serbinenko (4):
      ZFS: support inode type embed into its ID
      ZFS: Fix invalid memcmp
      ZFS: Don't iterate over null objsets
      ZFS: Check bonustype in addition to dnode type

Patches welcome. I'm not sure you can pick a subset, but it's worth trying.