Public bug reported:

Hello,
/etc/grub.d/10_linux_zfs fails to detect kernels when the partitions have the 
following layout:
root@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@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@test ~ $ cat /etc/fstab 
LABEL=EFI_SYSPART       /boot/efi       vfat    defaults        0       1
root@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@test ~ $ mount -o noatime,zfsutil -t zfs zp0/zd1 /mnt/
root@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@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@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@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 ###
[…]

** Affects: grub2 (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to 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"

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


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to