update-grub: mess in menuentry in grub.cfg

Bug #1379262 reported by midenok
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
grub2 (Ubuntu)
Expired
Undecided
Unassigned

Bug Description

After `update-grub` the following output is generated:

```
 menuentry 'Ubuntu, with Linux 2.6.35-22-generic (on /dev/mapper/vvg0-root)'\'' --class gnu-linux --class gnu --class os $menuentry_id_option '\''osprober-gnulinux-/boot/vmlinuz-2.6.35-22-generic--0ed5e93c-99f4-48ec-8b13-1b34b52852f5 (on /dev/mapper/vvg0-root)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-2.6.35-22-generic--0ed5e93c-99f4-48ec-8b13-1b34b52852f5' {
  insmod lvm
  insmod lvm
  insmod ext2
  set root='lvmid/ODtXBF-9DiG-LZ2p-dI92-qJZc-9G9g-XBmgcH/grLDh5-eAcC-DEZU-gEcc-QoBR-OUlI-ik2t1l'
  if [ x$feature_platform_search_hint = xy ]; then
    search --no-floppy --fs-uuid --set=root --hint='lvmid/ODtXBF-9DiG-LZ2p-dI92-qJZc-9G9g-XBmgcH/grLDh5-eAcC-DEZU-gEcc-QoBR-OUlI-ik2t1l' 0ed5e93c-99f4-48ec-8b13-1b34b52852f5
  else
    search --no-floppy --fs-uuid --set=root 0ed5e93c-99f4-48ec-8b13-1b34b52852f5
  fi
  linux /boot/vmlinuz-2.6.35-22-generic root=UUID=e673fbdf-b413-4ac9-b05c-574aa15535e4 ro vga=normal nomodeset crashkernel=384M-2G:64M,2G-:128M nosplash
  initrd /boot/initrd.img-2.6.35-22-generic
 }
```

Note, that 'insmod lvm' is done two times. $root variable is ignored! root option is passed like 'root=UUID=e673fbdf-b413-4ac9-b05c-574aa15535e4', all root magic from above is ignored which leads to wrong mounted root filesystem.

The proper menuentry should look like:

```
 menuentry 'Ubuntu, with Linux 2.6.35-22-generic (on /dev/mapper/vvg0-root)'\'' --class gnu-linux --class gnu --class os $menuentry_id_option '\''osprober-gnulinux-/boot/vmlinuz-2.6.35-22-generic--0ed5e93c-99f4-48ec-8b13-1b34b52852f5 (on /dev/mapper/vvg0-root)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-2.6.35-22-generic--0ed5e93c-99f4-48ec-8b13-1b34b52852f5' {
  insmod lvm
  insmod ext2
  set root='lvmid/ODtXBF-9DiG-LZ2p-dI92-qJZc-9G9g-XBmgcH/grLDh5-eAcC-DEZU-gEcc-QoBR-OUlI-ik2t1l'
  if [ x$feature_platform_search_hint = xy ]; then
    search --no-floppy --fs-uuid --set=root --hint=$root 0ed5e93c-99f4-48ec-8b13-1b34b52852f5
  else
    search --no-floppy --fs-uuid --set=root $root
  fi
  linux /boot/vmlinuz-2.6.35-22-generic root=$root ro vga=normal nomodeset crashkernel=384M-2G:64M,2G-:128M nosplash
  initrd /boot/initrd.img-2.6.35-22-generic
 }
```

I would want to ask people, who did such artful programming: do you look at the output of your scripts at all?

Version: 2.02~beta2-9ubuntu1

Revision history for this message
midenok (midenok) wrote :

Don't quite understand to do first `set root='lvmid/ODtXBF-9DiG-LZ2p-dI92-qJZc-9G9g-XBmgcH/grLDh5-eAcC-DEZU-gEcc-QoBR-OUlI-ik2t1l'` and then check $feature_platform_search_hint. Where is the logic?

description: updated
midenok (midenok)
description: updated
description: updated
description: updated
Revision history for this message
midenok (midenok) wrote :

The output came from 30_os-prober. Please, forward bug to upstream.

Revision history for this message
midenok (midenok) wrote :
Steve Langasek (vorlon)
affects: grub (Ubuntu) → grub2 (Ubuntu)
Revision history for this message
Phillip Susi (psusi) wrote :

The root variable is used by grub to find files. Its form is that of a grub device name, which the kernel does not understand, therefore it can not be passed to the kernel as its root argument.

Changed in grub2 (Ubuntu):
status: New → Invalid
Revision history for this message
midenok (midenok) wrote :

1. Variables get expanded before executing line. No one tries to "pass" variable to kernel.
2. 'Mess' is in wrong root= parameter (UUID=e673fbdf-b413-4ac9-b05c-574aa15535e4), should be lvmid/ODtXBF-9DiG-LZ2p-dI92-qJZc-9G9g-XBmgcH/grLDh5-eAcC-DEZU-gEcc-QoBR-OUlI-ik2t1l

Changed in grub2 (Ubuntu):
status: Invalid → New
Revision history for this message
midenok (midenok) wrote :

Ok, if format of $root variable is incompatible with root= parameter (which is at least weird), then root= parameter should be set to correct boot device (/dev/mapper/vvg0-root). It just boots wrong device (/dev/sda1).

Revision history for this message
Phillip Susi (psusi) wrote :

Normally if the root is on an lvm volume, /etc/grub.d/10_linux passes the lvm name instead of the UUID to the kernel. Did you originally have this sytem installed on a plain volume and then migrate it to a logical volume? If so, you will need to edit the the grub.cfg in that volume to change it to point to the lvm name and then re-run update-grub to pick up the change into your master grub.cfg.

Revision history for this message
Mathieu Trudel-Lapierre (cyphermox) wrote :

What do 'blkid' and 'blkid -U e673fbdf-b413-4ac9-b05c-574aa15535e4' report? Are all the values matching?

We seem to not be using LVM UUIDs and instead taking the device mapper paths now; perhaps this was fixed in a newer release?

Changed in grub2 (Ubuntu):
status: New → Incomplete
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for grub2 (Ubuntu) because there has been no activity for 60 days.]

Changed in grub2 (Ubuntu):
status: Incomplete → Expired
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.