[Bug 508901] Re: update-grub sets wrong root argument

Ulli Horlacher 508901 at bugs.launchpad.net
Sat Apr 5 09:10:49 UTC 2025


As a workaround I have written a new update-grub which corrects this
bug:


root at fextest01:~# type -a update-grub
update-grub is /usr/local/sbin/update-grub
update-grub is /usr/sbin/update-grub

root at fextest01:~# update-grub
/usr/local/sbin/update-grub: workaround for https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/508901
Sourcing file `/etc/default/grub'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-6.8.0-57-generic
Found initrd image: /boot/initrd.img-6.8.0-57-generic
Found linux image: /boot/vmlinuz-6.8.0-56-generic
Found initrd image: /boot/initrd.img-6.8.0-56-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.
Found Ubuntu 24.04.2 LTS (24.04) on /dev/mapper/ubuntu--vg-ubuntu--lv
Adding boot menu entry for UEFI Firmware Settings ...
done

/boot/grub/grub.cfg contains now the correct root= parameter


** Attachment added: "update-grub"
   https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/508901/+attachment/5869622/+files/update-grub

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

Title:
  update-grub sets wrong root argument

Status in grub2 package in Ubuntu:
  Confirmed

Bug description:
  Binary package hint: grub2

  I've made a backup of my system with dd and then changed the UUID and
  label of the drive.  I would like to be able to boot from either the
  main system or the backup, ideally regardless of whether the backup is
  in a USB enclosure or mounted internally.

  When I run update-grub, even though it correctly finds the backup and
  uses its UUID as a parameter for the search command, it still sets the
  root= argument of the linux command to the main system.  This makes
  the backup unusable.

  So in my setup, the original drive is
  7f0e857e-6118-4696-bdc6-7c51b31e1002, and the backup is
  9de2fc84-1128-41eb-9c1b-a444d070d415.  Each one has its fstab set up
  to mount itself as root.  The generated boot options look like this:

  ### BEGIN /etc/grub.d/10_linux ###
  menuentry "Ubuntu, Linux 2.6.31-17-generic" {
          recordfail=1
          if [ -n ${have_grubenv} ]; then save_env recordfail; fi
  	set quiet=1
  	insmod ext2
  	set root=(hd0,1)
  	search --no-floppy --fs-uuid --set 7f0e857e-6118-4696-bdc6-7c51b31e1002
  	linux	/boot/vmlinuz-2.6.31-17-generic root=/dev/sda1 ro   quiet splash
  	initrd	/boot/initrd.img-2.6.31-17-generic
  }
  ...
  ### BEGIN /etc/grub.d/30_os-prober ###
  menuentry "Ubuntu, Linux 2.6.31-17-generic (on /dev/sdb1)" {
  	insmod ext2
  	set root=(hd1,1)
  	search --no-floppy --fs-uuid --set 9de2fc84-1128-41eb-9c1b-a444d070d415
  	linux /boot/vmlinuz-2.6.31-17-generic root=UUID=7f0e857e-6118-4696-bdc6-7c51b31e1002 ro quiet splash
  	initrd /boot/initrd.img-2.6.31-17-generic
  }

  I tried uncommenting the GRUB_DISABLE_LINUX_UUID=true" line in
  /etc/default/grub, but it only affects the output of 10_linux, not
  30_os-prober.

  ProblemType: Bug
  Architecture: i386
  Date: Sun Jan 17 21:07:18 2010
  DistroRelease: Ubuntu 9.10
  Package: grub2 1.97~beta4-1ubuntu4.1
  ProcEnviron:
   LANGUAGE=en_GB.UTF-8
   PATH=(custom, user)
   LANG=en_GB.UTF-8
   SHELL=/bin/bash
  ProcVersionSignature: Ubuntu 2.6.31-17.54-generic
  SourcePackage: grub2
  Uname: Linux 2.6.31-17-generic i686

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




More information about the foundations-bugs mailing list