Public bug reported:
[ Impact ]
os-prober leads to invalid entries in the grub config file, typically with LVM
snapshots. There was an earlier issue in os-prober which caused hanging mounts
under /var/lib/os-prober/mount. This issue has been addressed as part of
https://bugs.launchpad.net/ubuntu/+source/os-prober/+bug/1987679
The change introduced a regression by adding invalid entries into
grub.cfg instead of exiting from the execution. Comment #19 on Launchpad
bug highlights this issue and proposes a fix, which is the purpose of
this SRU.
Change is to address the hanging mounts, by not defaulting unknown file
systems to fuseblk. Instead leave those as ‘bad’ type and not set the
mounted flag, so that the subsequent process does not pick up the file
system and add entries to the grub menu. This fixes the original root
cause of the problem of hanging mounts gracefully and does not cause any
side effects.
[ Test plan ]
I was able to reproduce this by having one of the LVs contain snapshots of the
Ubuntu rootfs.
To reproduce the issue:
1.Setup a VM with LVM enabled and then create snapshots of an Ubuntu install
2. Create a snapshot using:
sudo lvcreate -L 2G -s -n rootfs-snap /dev/ubuntu-vg/ubuntu-lv
# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 0 54.9G 0 disk
├─sda1 8:1 0 1M 0 part
├─sda2 8:2 0 2G 0 part /boot
└─sda3 8:3 0 52.9G 0 part
├─ubuntu--vg-ubuntu--lv-real 252:0 0 26.5G 0 lvm
│ ├─ubuntu--vg-ubuntu--lv 252:1 0 26.5G 0 lvm /
│ └─ubuntu--vg-rootfs--snap 252:3 0 26.5G 0 lvm
└─ubuntu--vg-rootfs--snap-cow 252:2 0 2G 0 lvm
└─ubuntu--vg-rootfs--snap 252:3 0 26.5G 0 lvm
sr0 11:0 1 1024M 0 rom
2. Enable os-prober by adding `GRUB_DISABLE_OS_PROBER=false` to
/etc/default/grub
# echo GRUB_DISABLE_OS_PROBER=false >> /etc/default/grub
3. Run update-grub, Ubuntu install is recognised on ubuntu--vg-rootfs--snap
snapshot
~$ sudo update-grub
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/kdump-tools.cfg'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-7.0.0-22-generic
Found initrd image: /boot/initrd.img-7.0.0-22-generic
Warning: os-prober will be executed to detect other bootable partitions.
Its output will be used to detect bootable binaries on them and create new boot
entries.
grub-probe: error: unknown filesystem.
Found Ubuntu 26.04 LTS (26.04) on /dev/mapper/ubuntu--vg-rootfs--snap
Adding boot menu entry for UEFI Firmware Settings ...
done
4. Check /etc/grub.d/30_os-prober section in grub.cfg. The main menuentry
points to the snapshot file, while the actual kernel image points to the
original lv itself, hence this is duplicate and redundant:
~$ sudo awk '/### BEGIN \/etc\/grub.d\/30_os-prober ###/,/### END
\/etc\/grub.d\/30_os-prober ###/' /boot/grub/grub.cfg
### BEGIN /etc/grub.d/30_os-prober ###
menuentry 'Ubuntu 26.04 LTS (26.04) (on /dev/mapper/ubuntu--vg-rootfs--snap)'
--class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option
'osprober-gnulinux-simple-/dev/mapper/ubuntu--vg-rootfs--snap' {
insmod part_gpt
insmod ext2
set root='hd0,gpt2'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2
--hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2
edc41acf-8195-4671-8012-71ffcafe8607
else
search --no-floppy --fs-uuid --set=root
edc41acf-8195-4671-8012-71ffcafe8607
fi
linux /vmlinuz-7.0.0-22-generic root=/dev/mapper/ubuntu--vg-ubuntu--lv
ro crashkernel=2G-4G:320M,4G-32G:512M,32G-64G:1024M,64G-128G:2048M,128G-:4096M
initrd /initrd.img-7.0.0-22-generic
}
submenu 'Advanced options for Ubuntu 26.04 LTS (26.04) (on
/dev/mapper/ubuntu--vg-rootfs--snap)' $menuentry_id_option
'osprober-gnulinux-advanced-/dev/mapper/ubuntu--vg-rootfs--snap' {
menuentry 'Ubuntu (on /dev/mapper/ubuntu--vg-rootfs--snap)' --class
gnu-linux --class gnu --class os $menuentry_id_option
'osprober-gnulinux-/vmlinuz-7.0.0-22-generic--/dev/mapper/ubuntu--vg-rootfs--snap'
{
insmod part_gpt
insmod ext2
set root='hd0,gpt2'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2
--hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2
edc41acf-8195-4671-8012-71ffcafe8607
else
search --no-floppy --fs-uuid --set=root
edc41acf-8195-4671-8012-71ffcafe8607
fi
linux /vmlinuz-7.0.0-22-generic
root=/dev/mapper/ubuntu--vg-ubuntu--lv ro
crashkernel=2G-4G:320M,4G-32G:512M,32G-64G:1024M,64G-128G:2048M,128G-:4096M
initrd /initrd.img-7.0.0-22-generic
}
menuentry 'Ubuntu, with Linux 7.0.0-22-generic (on
/dev/mapper/ubuntu--vg-rootfs--snap)' --class gnu-linux --class gnu --class os
$menuentry_id_option
'osprober-gnulinux-/vmlinuz-7.0.0-22-generic--/dev/mapper/ubuntu--vg-rootfs--snap'
{
insmod part_gpt
insmod ext2
set root='hd0,gpt2'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2
--hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2
edc41acf-8195-4671-8012-71ffcafe8607
else
search --no-floppy --fs-uuid --set=root
edc41acf-8195-4671-8012-71ffcafe8607
fi
linux /vmlinuz-7.0.0-22-generic
root=/dev/mapper/ubuntu--vg-ubuntu--lv ro
crashkernel=2G-4G:320M,4G-32G:512M,32G-64G:1024M,64G-128G:2048M,128G-:4096M
initrd /initrd.img-7.0.0-22-generic
}
menuentry 'Ubuntu, with Linux 7.0.0-22-generic (recovery mode) (on
/dev/mapper/ubuntu--vg-rootfs--snap)' --class gnu-linux --class gnu --class os
$menuentry_id_option
'osprober-gnulinux-/vmlinuz-7.0.0-22-generic-root=/dev/mapper/ubuntu--vg-ubuntu--lv
ro recovery nomodeset dis_ucode_ldr-/dev/mapper/ubuntu--vg-rootfs--snap' {
insmod part_gpt
insmod ext2
set root='hd0,gpt2'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2
--hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2
edc41acf-8195-4671-8012-71ffcafe8607
else
search --no-floppy --fs-uuid --set=root
edc41acf-8195-4671-8012-71ffcafe8607
fi
linux /vmlinuz-7.0.0-22-generic
root=/dev/mapper/ubuntu--vg-ubuntu--lv ro recovery nomodeset dis_ucode_ldr
initrd /initrd.img-7.0.0-22-generic
}
}
set timeout_style=menu
if [ "${timeout}" = 0 ]; then
set timeout=10
fi
### END /etc/grub.d/30_os-prober ###
Post the fix, this entry would not be added to the grub menu.
[ Where problems could occur ]
If grub-probe fails to recognize any other file system type, other than
snapshots, that would be ignored, while earlier fuseblk defaulting might have
tried to find the Ubuntu install. With this change, there is no way for
os-prober to even search in unknown file mounts.
os-prober is disabled by default, so the change would not cause major
regression issues in existing installs
[ Other info ]
Since snapshots are identical to the original volumes and these are
unrecognized by grub-probe, this change would not cause any other effect for
snapshots
The original issue of hanging mounts has been fixed in Resolute, but has
not been backported to Noble and Jammy. Once this is SRUed, the latest
os-prober version should also be backported to those
** Affects: os-prober (Ubuntu)
Importance: Undecided
Assignee: Bhavya Dokuru (dokurb)
Status: New
** Affects: os-prober (Ubuntu Jammy)
Importance: Undecided
Status: New
** Affects: os-prober (Ubuntu Noble)
Importance: Undecided
Status: New
** Affects: os-prober (Ubuntu Resolute)
Importance: Undecided
Assignee: Bhavya Dokuru (dokurb)
Status: New
** Changed in: os-prober (Ubuntu)
Assignee: (unassigned) => Bhavya Dokuru (dokurb)
** Also affects: os-prober (Ubuntu Resolute)
Importance: Undecided
Status: New
** Also affects: os-prober (Ubuntu Noble)
Importance: Undecided
Status: New
** Also affects: os-prober (Ubuntu Jammy)
Importance: Undecided
Status: New
** Changed in: os-prober (Ubuntu Resolute)
Assignee: (unassigned) => Bhavya Dokuru (dokurb)
--
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2155998
Title:
Handle invalid grub config entries due to os-prober defaulting
unidentified file system types
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/os-prober/+bug/2155998/+subscriptions
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs