I had a similar problem after copying all files from the root partition
/dev/sda1 to another partition /dev/sdb1 and trying to tell grub to boot
from there now.

I digged into problem a little bit...
When i run `update-grub` it runs each of the files in `/etc/grub.d/`, my linux 
copy (Ubuntu in this case) gets detected by `30_os-prober`. This will run 
`/usr/bin/os-prober`. This works fine. In the `for OS in ${OSPROBED} ` loop it 
goes into the linux) branch, but somehow sets the $LPARAMS variable wrong. This 
is due to the sometimes-wrong output of `/usr/bin/linux-boot-prober`. In that 
script, there is a loop `for test in /usr/lib/linux-boot-probes/mounted/*`, 
which runs the file `40grub2` from there in my case. (I know that from the 
debug output flooding syslog.) This script calls its `parse_grub_menu` function 
with some parameters, and parses "$mpoint/boot/grub/grub.cfg", where $mpoint is 
the mount point of /dev/sdb1. However, the grub.cfg in there contains the old 
UUID of /dev/sda1, because it is just a binary copy and does not come from a 
fresh install.

My plan A was to fix this, take the correct UUID from the device (here:
/dev/sdb1), corresponding to the mapping from  /dev/disk/by-uuid/ and
post a patch. But the inner works of grub seem to complicated for me. I
lost motivation to do that.

Now that I know what the problem is, I took plan B, and chrooted into 
/dev/sdb1, ran update-grub in there, and reboot. You only need to do that once, 
afterwards the files are okay.
(...btw, for similar setups: you might want to have two different /etc/fstab on 
each of the partitions.)
This is somewhat a workaround. But here it goes:

mount /dev/sdb1 /mnt/disk
mount -o bind /dev /mnt/disk/dev
mount -o bind /sys /mnt/disk/sys
mount -t proc /proc /mnt/disk/proc
cp /proc/mounts /mnt/disk/etc/mtab

chroot /mnt/disk /bin/bash
grub-install /dev/sdb
update-grub
exit


(Plan C would have been to update the grub.cfg with the correct UUID manually.)

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

Title:
  update-grub sets wrong root argument

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

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to