grub-probe fails in the presence of snapshot logical volumes

Bug #1287436 reported by LaMont Jones
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
grub2 (Ubuntu)
Undecided
Unassigned

Bug Description

Found in: 2.02~beta2-6

My upgrade from saucy to trusty ran into problems, with grub-probe failing with "unknown filesystem", which propogated up to cause the kernel install to fail, resulting in a machine where I cannot install packages. After some debugging:

(missing here is the trace of it failing with the original snapshot in place, that I created to give me a way back in the event that trusty hated me horribly.)

-rover3(root) 351 : update-grub
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.13.0-13-generic
Found initrd image: /boot/initrd.img-3.13.0-13-generic
Found linux image: /boot/vmlinuz-3.11.0-17-generic
Found initrd image: /boot/initrd.img-3.11.0-17-generic
Found memtest86+ image: /memtest86+.elf
Found Ubuntu 12.04.1 LTS (12.04) on /dev/mapper/rover3-p
Found Ubuntu 13.04 (13.04) on /dev/mapper/rover3-root
Found Ubuntu 13.10 (13.10) on /dev/mapper/rover3-saucy--that--was
done
-rover3(root) 352 : lvcreate -s /dev/rover3/saucy -L 30G -n saucy-save
  Logical volume "saucy-save" created
-rover3(root) 353 : update-grub
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.13.0-13-generic
Found initrd image: /boot/initrd.img-3.13.0-13-generic
Found linux image: /boot/vmlinuz-3.11.0-17-generic
Found initrd image: /boot/initrd.img-3.11.0-17-generic
Found memtest86+ image: /memtest86+.elf
grub-probe: error: unknown filesystem.
Found Ubuntu 12.04.1 LTS (12.04) on /dev/mapper/rover3-p
Found Ubuntu 13.04 (13.04) on /dev/mapper/rover3-root
/usr/sbin/grub-probe: error: unknown filesystem.
-rover3(root) 354 :

Bug # 563895 may or may not be relevant.

Revision history for this message
LaMont Jones (lamont) wrote :

Here is the output of: grub-probe -d -vv --target=fs_uuid --device /dev/mapper/rover3-saucy--save

Revision history for this message
Colin Watson (cjwatson) wrote :

I initially thought that this was due to the LVM metadata parsing improvements in 2.02~beta2, but upon inspection the low-level tools were producing the same results in both 2.00 and 2.02~beta2. In fact this bug was introduced by 55e706c918922def17f5012c23cfe88c4c645208, which caused /etc/grub.d/30_os-prober to fail if --target=fs_uuid fails. I'll make it tolerate this instead, which is closer to what it did before.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package grub2 - 2.02~beta2-9

---------------
grub2 (2.02~beta2-9) unstable; urgency=medium

  * Backport from upstream:
    - Tolerate devices with no filesystem UUID returned by os-prober
      (LP: #1287436).

 -- Colin Watson <email address hidden> Thu, 10 Apr 2014 17:34:44 +0100

Changed in grub2 (Ubuntu):
status: New → Fix Released
Revision history for this message
Mastakilla (masta-killa) wrote :

I have similar issue on Ubuntu 12.04 when running an "apt-get dist-upgrade"...

At some point iI get an output very similar to the reproduced:

root@dcmilphlum173:~# grub-mkconfig -o /boot/grub/grub.cfg
Generating grub.cfg ...
Warning: Setting GRUB_TIMEOUT to a non-zero value when GRUB_HIDDEN_TIMEOUT is set is no longer supported.
Found linux image: /boot/vmlinuz-3.2.0-80-generic
Found initrd image: /boot/initrd.img-3.2.0-80-generic
Found linux image: /boot/vmlinuz-2.6.32-73-generic
Found initrd image: /boot/initrd.img-2.6.32-73-generic
Found memtest86+ image: /memtest86+.bin
rmdir: failed to remove `/var/lib/os-prober/mount': Device or resource busy
rmdir: failed to remove `/var/lib/os-prober/mount': Device or resource busy
grub-probe: error: unknown filesystem.
grub-probe: error: unknown filesystem.
done

The below 4 errors do not occur without the 2 snapshots that I created before running "apt-get dist-upgrade".

root@dcmilphlum173:~# lvs
  LV VG Attr LSize Origin Snap% Move Log Copy% Convert
  datavol vgapp -wi-ao 678.00g
  homevol vgos -wi-ao 1.86g
  rootsnapvol vgos swi-a- 3.00g rootvol 61.85
  rootvol vgos owi-ao 13.97g
  swapvol vgos -wi-ao 7.45g
  tmpvol vgos -wi-ao 1.86g
  varsnapvol vgos swi-a- 2.00g varvol 51.57
  varvol vgos owi-ao 7.45g

Could this be related to the above issue?
I see that the issue from this thread was solved in grub2 (2.02~beta2-9), but the latest version available to precise is the one I have (see below)

root@dcmilphlum173:~# dpkg -l |grep grub
ii grub-common 1.99-21ubuntu3.19 GRand Unified Bootloader (common files)
ii grub-gfxpayload-lists 0.6 GRUB gfxpayload blacklist
ii grub-pc 1.99-21ubuntu3.19 GRand Unified Bootloader, version 2 (PC/BIOS version)
ii grub-pc-bin 1.99-21ubuntu3.19 GRand Unified Bootloader, version 2 (PC/BIOS binaries)
ii grub2-common 1.99-21ubuntu3.19 GRand Unified Bootloader (common files for version 2)

I currently haven't seen any crash or boot failure because of these issues yet, but still I'd like to solve or get around this issue...

Revision history for this message
Mastakilla (masta-killa) wrote :
Download full text (4.7 KiB)

1)
Warning: Setting GRUB_TIMEOUT to a non-zero value when GRUB_HIDDEN_TIMEOUT is set is no longer supported.

This warning is because of https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/1258597
I was able to solve it by:

function Fix_grub_config() {
  if grep -q "^GRUB_HIDDEN_TIMEOUT=0$" /etc/default/grub || grep -q "^GRUB_HIDDEN_TIMEOUT_QUIET=true$" /etc/default/grub; then
    echo -en "ACTION:\tFixing Grub config... "
    sed -i "s/^GRUB_HIDDEN_TIMEOUT=0$/#GRUB_HIDDEN_TIMEOUT=0/" /etc/default/grub
   sed -i "s/^GRUB_HIDDEN_TIMEOUT_QUIET=true$/#GRUB_HIDDEN_TIMEOUT_QUIET=true/" /etc/default/grub
    echo "Done."
  fi
}

But this fix brings up a new issue for me personally. When running the dist-upgrade, it now shows a pop-up from "grub-pc config", complaining that I modified /etc/default/grub asking me what to do.
As I'm trying to run the dist-upgrade non-interactively, this is a bigger issue for me than the warning, so I will not perform this fix...

2)
rmdir: failed to remove `/var/lib/os-prober/mount': Device or resource busy

By using set -xv I was able to track down this issue a bit further:

/usr/sbin/grub-mkconfig -o /boot/grub/grub.cfg
--> /etc/grub.d/30_os-prober
--> OSPROBED="`os-prober | tr ' ' '^' | paste -s -d ' '`"
--> /usr/bin/os-prober
--> /usr/lib/os-probes/50mounted-tests /dev/sda5

if [ "$mounted" ]; then
                for test in /usr/lib/os-probes/mounted/*; do
                                debug "running subtest $test"
                                if [ -f "$test" ] && [ -x "$test" ]; then
                                                if "$test" "$partition" "$tmpmnt" "$type"; then
                                                                debug "os found by subtest $test"
                                                                if ! umount "$tmpmnt"; then
                                                                                warn "failed to umount $tmpmnt"
                                                                fi
                                                                case "$type" in
                                                                    btrfs)
                                                                                # umount to account for the bind-mount
                                                                                if [ -x "$tmpmnt/@/lib" ] && \
                                                                                   ! umount $tmpmnt; then
                                                                                                warn "failed to umount $tmpmnt"
                                                                                fi
                                                                                ;;
                                                                esac
                                                                rmdir "$tmpmnt" || true
                                                                exit 0
                                                fi
                                fi
                done
                if ! umount "$tmpmnt"; then
                     ...

Read more...

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Related questions