[Bug 1849347] Re: /etc/grub.d/10_linux_zfs gives up if any checked /etc/fstab entry is invalid

Launchpad Bug Tracker 1849347 at bugs.launchpad.net
Mon Nov 25 08:31:27 UTC 2019


This bug was fixed in the package grub2 - 2.04-1ubuntu14

---------------
grub2 (2.04-1ubuntu14) focal; urgency=medium

  * debian/patches/ubuntu-zfs-enhance-support.patch:
    - Handle the case where grub-probe returns several devices for a single
      pool (LP: #1848856). Thanks jpb for the report and the proposed patch.
    - Add savedefault to non-recovery entries (LP: #1850202). Thanks Deltik
      for the patch.
    - Do not crash on invalid fstab and report the invalid entry.
      (LP: #1849347) Thanks Deltik for the patch.
    - When a pool fails to import, catch and display the error message and
      continue with other pools. Import all the pools in readonly mode so we
      can import other pools with unsupported features (LP: #1848399) Thanks
      satmandu for the investigation and the proposed patch

 -- Jean-Baptiste Lallement <jean-baptiste.lallement at ubuntu.com>  Mon,
18 Nov 2019 11:22:43 +0100

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

Title:
  /etc/grub.d/10_linux_zfs gives up if any checked /etc/fstab entry is
  invalid

Status in grub2 package in Ubuntu:
  Fix Released
Status in grubzfs-testsuite package in Ubuntu:
  Fix Released
Status in grub2 source package in Eoan:
  Triaged
Status in grubzfs-testsuite source package in Eoan:
  Triaged
Status in grub2 source package in Focal:
  Fix Released
Status in grubzfs-testsuite source package in Focal:
  Fix Released

Bug description:
  [Impact]
  Ubuntu's ZFS boot support (`/etc/grub.d/10_linux_zfs`) will fail to generate any GRUB entries for ZFS roots if any of the checked `/etc/fstab` entries fails to mount.  This includes all past ZFS snapshots.

  [Test Case]
  1. On a system that has a ZFS root (e.g. one installed with zsys), run `sudo update-grub`.

  2. Verify that there are GRUB boot entries for ZFS:

      sed -n '/^### BEGIN \/etc\/grub\.d\/10_linux_zfs ###$/,/^### END
  \/etc\/grub\.d\/10_linux_zfs ###$/p;/^### END
  \/etc\/grub\.d\/10_linux_zfs ###$/q' /boot/grub/grub.cfg

  3. To reproduce the problem, create or edit a `/boot` entry that will
  fail mounting.  (Back up the existing line if you have one and are
  working on a real system.)  Example:

      echo 'UUID=deaddead-dead-4ead-dead-deaddeaddead /boot
  ext2    discard,nofail        0       2' | sudo tee -a /etc/fstab

  4. (Optional) Take a ZFS snapshot of the dataset that provides `/etc`:

      sudo zfs snap "$(df /etc -t zfs | sed '/^Filesystem/d' | awk
  '{print $1}')"@repro

  5. If you performed step 4, restore the `/etc/fstab` back to its
  original working condition:

      sudo sed -i '/^UUID=deaddead-dead-4ead-dead-deaddeaddead/d'
  /etc/fstab

  6. Run `sudo update-grub` again.

  7. See that the GRUB boot entries for ZFS roots have been wiped out:

      sed -n '/^### BEGIN \/etc\/grub\.d\/10_linux_zfs ###$/,/^### END
  \/etc\/grub\.d\/10_linux_zfs ###$/p;/^### END
  \/etc\/grub\.d\/10_linux_zfs ###$/q' /boot/grub/grub.cfg

  [Regression Potential]
  The patch adds a sanity check for a mount that could fail.  The sanity check prevents the entire `/etc/grub.d/10_linux_zfs` from being wiped out from that failed mount.

  The new behavior causes the `get_system_directory()` function in
  `/etc/grub.d/10_linux_zfs` to act as if the bad mount didn't exist.
  The function would then continue to the next case, which is currently
  documented as "Handle zfs case, which can be a snapshots."

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



More information about the foundations-bugs mailing list