[Bug 1987679] Re: os-prober leaves filesystems (lvm-thin, lvm snap) mounted

Heitor Alves de Siqueira 1987679 at bugs.launchpad.net
Tue Jan 28 14:43:33 UTC 2025


Hi Simon, Aaron,

thank you both for the review! It's somewhat reassuring to see my
initial reaction to `|| true` mirrored in others hehehe.

My initial patch did follow the precedent in os-probes/, mostly out of a
concern of changing the existing codebase too much. I've tested it
extensively and found no problems with it, but maybe we can/should take
a different approach here.

I've pushed a v2 that actually guards against `grub-probe` breaking the
script, by writing "bad" to `$type`. This should keep $type always
valid, hopefully even for future changes to grub-probe. I've kept the
rest of the code as close as possible to the original, mainly the part
of manually overriding the type to fuseblk, as:

1) I'm not 100% certain other scripts or packages rely on $type=fuseblk further on, and didn't want to break those by removing it or overriding it with "bad"
2) we don't want to preemptively unmount the partition and exit if grub-probe fails

Specifically for 2), addressing Aaron's comment as well: there are
partition types that are mounted by grub-mount but fail to be recognized
by grub-probe (that's the original cause for this LP bug). Certain types
of LVM2 members seem to be affected by this, and we *do* want the script
to continue in some of these cases -- so these partitions can be picked
up by grub later on and have their own entries in grub.cfg. I wondered
if the "fuseblk" override was done for a similar reason, which is why I
didn't want to change it too much. Mounted filesystems will be unmounted
later on in the script as part of `do_unmount`, so this should also
address any leftover mounts.

Let me know what you think, and thanks again for the reviews!

** Patch added: "lp1987679-plucky-v2.debdiff"
   https://bugs.launchpad.net/ubuntu/+source/os-prober/+bug/1987679/+attachment/5853749/+files/lp1987679-plucky-v2.debdiff

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to the bug report.
https://bugs.launchpad.net/bugs/1987679

Title:
  os-prober leaves filesystems (lvm-thin, lvm snap) mounted

Status in os-prober package in Ubuntu:
  In Progress
Status in os-prober source package in Focal:
  In Progress
Status in os-prober source package in Jammy:
  In Progress
Status in os-prober source package in Kinetic:
  Won't Fix
Status in os-prober source package in Noble:
  In Progress
Status in os-prober source package in Oracular:
  In Progress
Status in os-prober source package in Plucky:
  In Progress

Bug description:
  If one happens to have by accident (or on purpose) a thick LVM snapshot, or a thin-LV with a copy of a system on it, update-grub reports
  /sbin/grub-probe: error: unknown filesystem.
  Found Ubuntu 22.04.1 LTS on /dev/mapper/vgxubuntu-s22.04
  and
  /sbin/grub-probe: error: disk `lvmid/X7waXv-rMDA-5fQA-aw6l-ei1I-8Gz3-pQl3lr/k3Ze1u-Mfwc-pxUt-7fXa-FjSZ-7IkX-HAxf3b' not found.
  Found Ubuntu 22.04.1 LTS (22.04) on /dev/mapper/vgxubuntu-XR22.04.1U

  and leaves the systems mounted rw on /var/lib/os-prober/mount.
  On subsequent invocations update-grub spews out multiple
  mdir: failed to remove '/var/lib/os-prober/mount': Device or resource busy

  I'm pretty sure this also causes a new install to hang (though a
  power-reset seems to load the new system - not sure if it is complete
  or not.)

  The missing umounts should be relatively easy to fix, but the thick
  snapshot error is particularly vague as most users (I think) would
  take the "unknown filesystem" to refer to the previous entry.

  I have been playing with grub2-common-2.06-2ubuntu7 on xubuntu
  22.04.1, though I am sure this has been around a while

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/os-prober/+bug/1987679/+subscriptions




More information about the foundations-bugs mailing list