[Bug 2110042] Re: grub-mkconfig fails with separate ZFS /boot on EFI systems: "Warning: didn't find any valid initrd or kernel"

Louis Sautier 2110042 at bugs.launchpad.net
Tue May 6 13:47:36 UTC 2025


The following patch fixes this by excluding the efi directory from the
"ls" call. It applies on https://git.launchpad.net/~ubuntu-core-
dev/grub/+git/ubuntu/tag/?h=debian/2.12-5ubuntu10

I'm not sure it's the best solution, maybe upstream's 10_linux should be
used instead? Are there still good reasons to maintain a separate file
specifically for Ubuntu. For instance, Debian seems to handle ZFS
properly with 10_linux.

** Patch added: "0001-Fix-grub-mkconfig-with-separate-ZFS-dataset-for-boot.patch"
   https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/2110042/+attachment/5876113/+files/0001-Fix-grub-mkconfig-with-separate-ZFS-dataset-for-boot.patch

-- 
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/2110042

Title:
  grub-mkconfig fails with separate ZFS /boot on EFI systems: "Warning:
  didn't find any valid initrd or kernel"

Status in grub2 package in Ubuntu:
  New

Bug description:
  Hello,
  /etc/grub.d/10_linux_zfs fails to detect kernels when the partitions have the following layout:
  root at test ~ $ lsblk
  NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
  nvme1n1     259:0    0 476.9G  0 disk 
  ├─nvme1n1p1 259:2    0   511M  0 part 
  └─nvme1n1p2 259:3    0  20.5G  0 part 
  nvme0n1     259:1    0 476.9G  0 disk 
  ├─nvme0n1p1 259:4    0   511M  0 part /boot/efi
  ├─nvme0n1p2 259:5    0  20.5G  0 part 
  └─nvme0n1p3 259:6    0     2M  0 part 
  root at test ~ $ lsblk -f
  NAME        FSTYPE     FSVER            LABEL       UUID                                 FSAVAIL FSUSE% MOUNTPOINTS
  nvme1n1                                                                                                 
  ├─nvme1n1p1 vfat       FAT16            EFI_SYSPART 59A4-242A                                           
  └─nvme1n1p2 zfs_member 5000             zp0         7865821403877262216                                 
  nvme0n1                                                                                                 
  ├─nvme0n1p1 vfat       FAT16            EFI_SYSPART 599B-27B0                               906M    12% /boot/efi
  ├─nvme0n1p2 zfs_member 5000             zp0         7865821403877262216                                 
  └─nvme0n1p3 iso9660    Joliet Extension config-2    2025-04-30-19-10-22-00                              
  root at test ~ $ cat /etc/fstab 
  LABEL=EFI_SYSPART       /boot/efi       vfat    defaults        0       1
  root at test ~ $ zfs list
  NAME      USED  AVAIL  REFER  MOUNTPOINT
  zp0      6.66G  13.2G    24K  none
  zp0/zd0   118M   906M   118M  /boot
  zp0/zd1  6.55G  13.0G  6.55G  /

  This happens because /boot/efi is mounted before /boot, causing a /boot/efi folder to be created in the root (zp0/zd1) dataset (I deleted it and it's back at the next boot):
  root at test ~ $ mount -o noatime,zfsutil -t zfs zp0/zd1 /mnt/
  root at test ~ $ ls -la /mnt/boot/
  total 3
  drwxr-xr-x  3 root root  3 May  5 19:22 .
  drwxr-xr-x 18 root root 24 May  6 11:38 ..
  drwxr-xr-x  2 root root  2 May  5 19:22 efi
  root at test ~ $ stat /mnt/boot/efi/
    File: /mnt/boot/efi/
    Size: 2               Blocks: 1          IO Block: 131072 directory
  Device: 0,29    Inode: 99053       Links: 2
  Access: (0755/drwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
  Access: 2025-05-05 19:22:21.489078537 +0000
  Modify: 2025-05-05 19:22:21.489078537 +0000
  Change: 2025-05-05 19:22:21.489078537 +0000
   Birth: 2025-05-05 19:22:21.489078537 +0000
  root at test ~ $ journalctl -b -o short-iso-precise --grep boot-efi.mount
  2025-05-05T19:22:21.493367+00:00 test systemd[1]: Mounting boot-efi.mount - /boot/efi...
  2025-05-05T19:22:21.540543+00:00 test systemd[1]: Mounted boot-efi.mount - /boot/efi.

  The fact that the root dataset's /boot is not empty causes this condition to be valid:
  https://git.launchpad.net/~ubuntu-core-dev/grub/+git/ubuntu/tree/debian/patches/ubuntu-zfs-enhance-support.patch?h=debian/2.12-5ubuntu5.3#n277
  Because of this, the script assumes that the boot dataset is zp0/zd1 (the root dataset) instead of zp0/zd0:
  root at test ~ $ grub-mkconfig                                      
  Sourcing file `/etc/default/grub'                
  Generating grub configuration file ...
  […]
  ### BEGIN /etc/grub.d/10_linux_zfs ###
  Warning: didn't find any valid initrd or kernel.
  ### END /etc/grub.d/10_linux_zfs ###
  […]

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/2110042/+subscriptions




More information about the foundations-bugs mailing list