[Bug 1899372] Re: update-grub 10_linux_zfs fails when /usr is a separate filesystem

Stefano 1899372 at bugs.launchpad.net
Wed Jun 19 11:52:50 UTC 2024


I was about to file a new BUG Report.

I did a quick fix and uploaded to one of my Repositories:
https://github.com/luckylinux/grub-
scripts/commit/59f90b0f751fb1241b0243dc5700522ffe73bf8e

Basically you need to add one mount / umount command for the /usr
Dataset whenever the / and/or /etc Dataset is mounted.

One Command is probably NOT needed as it generates an "unmount Error",
but the other seems to be.

Any change of getting this (FINALLY !) Fixed and Upstreamed ?

Thanks

Before Fix:
========================================================================================================
root at LiveUbuntu02:/# update-grub
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/lubuntu-grub-theme.cfg'
Generating grub configuration file ...
/etc/grub.d/10_linux_zfs: 403: .: cannot open /tmp/zfsmnt.NYQsLe/etc/os-release: No such file
Warning: os-prober will not be executed to detect other bootable partitions.
Systems on them will not be added to the GRUB boot configuration.
Check GRUB_DISABLE_OS_PROBER documentation entry.
Adding boot menu entry for UEFI Firmware Settings ...
done
========================================================================================================


After Fix:
========================================================================================================
root at LiveUbuntu02:/# update-grub
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/lubuntu-grub-theme.cfg'
Sourcing file `/etc/default/grub.d/zfs.cfg'
Generating grub configuration file ...
Found linux image: vmlinuz-6.8.0-35-generic in rpool/ROOT/ubuntu
Found initrd image: initrd.img-6.8.0-35-generic in rpool/ROOT/ubuntu
Found linux image: vmlinuz-6.5.0-14-generic in rpool/ROOT/ubuntu
Found initrd image: initrd.img-6.5.0-14-generic in rpool/ROOT/ubuntu
umount: /tmp/zfsmnt.Q0TA2T/usr: not mounted.
Found linux image: vmlinuz-6.8.0-35-generic in rpool/ROOT/ubuntu at zfs-auto-snap_frequent-2023-12-31-1715
Found initrd image: initrd.img-6.8.0-35-generic in rpool/ROOT/ubuntu at zfs-auto-snap_frequent-2023-12-31-1715
Found linux image: vmlinuz-6.5.0-14-generic in rpool/ROOT/ubuntu at zfs-auto-snap_frequent-2023-12-31-1715
Found initrd image: initrd.img-6.5.0-14-generic in rpool/ROOT/ubuntu at zfs-auto-snap_frequent-2023-12-31-1715
umount: /tmp/zfsmnt.Q0TA2T/usr: not mounted.
Found linux image: vmlinuz-6.8.0-35-generic in rpool/ROOT/ubuntu at zfs-auto-snap_hourly-2023-12-31-1717
Found initrd image: initrd.img-6.8.0-35-generic in rpool/ROOT/ubuntu at zfs-auto-snap_hourly-2023-12-31-1717
Found linux image: vmlinuz-6.5.0-14-generic in rpool/ROOT/ubuntu at zfs-auto-snap_hourly-2023-12-31-1717
Found initrd image: initrd.img-6.5.0-14-generic in rpool/ROOT/ubuntu at zfs-auto-snap_hourly-2023-12-31-1717
umount: /tmp/zfsmnt.Q0TA2T/usr: not mounted.
Found linux image: vmlinuz-6.8.0-35-generic in rpool/ROOT/ubuntu at install
Found initrd image: initrd.img-6.8.0-35-generic in rpool/ROOT/ubuntu at install
Found linux image: vmlinuz-6.5.0-14-generic in rpool/ROOT/ubuntu at install
Found initrd image: initrd.img-6.5.0-14-generic in rpool/ROOT/ubuntu at install
umount: /tmp/zfsmnt.Q0TA2T/usr: not mounted.
Found linux image: vmlinuz-6.8.0-35-generic in rpool/ROOT/ubuntu at zfs-auto-snap_frequent-2023-12-31-1730
Found initrd image: initrd.img-6.8.0-35-generic in rpool/ROOT/ubuntu at zfs-auto-snap_frequent-2023-12-31-1730
Found linux image: vmlinuz-6.5.0-14-generic in rpool/ROOT/ubuntu at zfs-auto-snap_frequent-2023-12-31-1730
Found initrd image: initrd.img-6.5.0-14-generic in rpool/ROOT/ubuntu at zfs-auto-snap_frequent-2023-12-31-1730
umount: /tmp/zfsmnt.Q0TA2T/usr: not mounted.
Found linux image: vmlinuz-6.8.0-35-generic in rpool/ROOT/ubuntu at zfs-auto-snap_frequent-2023-12-31-1745
Found initrd image: initrd.img-6.8.0-35-generic in rpool/ROOT/ubuntu at zfs-auto-snap_frequent-2023-12-31-1745
Found linux image: vmlinuz-6.5.0-14-generic in rpool/ROOT/ubuntu at zfs-auto-snap_frequent-2023-12-31-1745
Found initrd image: initrd.img-6.5.0-14-generic in rpool/ROOT/ubuntu at zfs-auto-snap_frequent-2023-12-31-1745
umount: /tmp/zfsmnt.Q0TA2T/usr: not mounted.
/etc/grub.d/10_linux_zfs: 406: .: cannot open /.zfs/snapshot/20240619_fix_nested_zfs_datasets/etc/os-release: No such file
Warning: os-prober will not be executed to detect other bootable partitions.
Systems on them will not be added to the GRUB boot configuration.
Check GRUB_DISABLE_OS_PROBER documentation entry.
Adding boot menu entry for UEFI Firmware Settings ...
done
========================================================================================================


EDIT 1: on one system, my proposed fix performed correctly. On another one, it failed with
========================================================================================================
/etc/grub.d/10_linux_zfs: 406: .: cannot open /.zfs/snapshot/20240619_fix_nested_zfs_datasets/etc/os-release: No such file
========================================================================================================

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

Title:
  update-grub 10_linux_zfs fails when /usr is a separate filesystem

Status in grub2 package in Ubuntu:
  Incomplete
Status in grubzfs-testsuite package in Ubuntu:
  Confirmed

Bug description:
  Description:    Ubuntu 20.04.1 LTS
  Release:        20.04
  grub-common: 2.04-1ubuntu26.4

  I expect grub-update to create grub.cfg with Linux entries for ZFS.
  Instead I am left with an empty list and an unbootable OS.

  The output from update-grub:
  Sourcing file `/etc/default/grub'
  Sourcing file `/etc/default/grub.d/init-select.cfg'
  Sourcing file `/etc/default/grub.d/kdump-tools.cfg'
  Generating grub configuration file ...
  /etc/grub.d/10_linux_zfs: 404: .: Can't open /tmp/zfsmnt.stGSQC/etc/os-release
  Found memtest86+ image: /memtest86+.elf
  Found memtest86+ image: /memtest86+.bin
  done

  This is failing because I have a separate ZFS filesystem for /usr.
  The 10_linux_zfs script is gathering information from /etc/os-release
  which is a symlink to ../usr/lib/os-release.

  The first issue I see in 10_linux_zfs is under function get_dataset_info() at line 382:
  mount -o noatime,zfsutil -t zfs "${base_dataset}" "${mntdir}"

  Since /usr is under a separate filesystem, the symlink would be broken
  and the script fails.  This should mount /usr as well if it is a
  separate filesystem.

  The next issue I see is when the script iterates the zsys snapshots at line 514:
  for snapshot_dataset in $(zfs list -H -o name -t snapshot "${dataset}"); do
      boot_list="${boot_list}$(get_dataset_info ${snapshot_dataset} ${mntdir})\n"
  done

  You would get a similar error message about os-release.
  /etc/grub.d/10_linux_zfs: 410: .: Can't open /.zfs/snapshot/autozsys_oiimb5/etc/os-release

  Again, the script should consider reading the /usr snapshot as well if
  it is a separate filesystem.

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




More information about the foundations-bugs mailing list