Bug#403435: Questionable behavior of update-grub when root device does not exist

Jurij Smakov jurij at wooyd.org
Sun Dec 17 08:12:59 CET 2006


Package: grub
Version: 0.97-20
Severity: wishlist

Hi,

I recently needed to use update-grub while recovering a system. I've 
booted from a live CD and started LVM, which hosts the root filesystem 
on a logical volume, then mounted root on /mnt and chrooted into it. 
Running update-grub in a chroot resulted in a broken menu.lst file for 
the following reason: the root device, extracted by update-grub from 
/etc/fstab (/dev/mapper/rootvg-rootlv) was not present inside the 
chroot, so even though the root device name was correctly determined 
in the find_device() function, it was later discarded due to

device=`readlink -f "$device"`

line, since readlink returns an empty string for a non-existent file. 
As a result I ended up with fallback root=/dev/hda1 entries in my 
kernel lines, which is really suboptimal.

I see at least two different ways to resolve the problem. One is to 
run readlink only on devices which are symbolic links (maybe even a 
check that it exists is sufficient). Another is to prompt user whether 
it is ok to use a non-existent device as root=. Either way, if there 
is information about the root device available in fstab, there is no 
good reason to toss it out in favour of most-probably-wrong /dev/hda1 
fallback.

Best regards,
-- 
Jurij Smakov                                           jurij at wooyd.org
Key: http://www.wooyd.org/pgpkey/                      KeyID: C99E03CC




More information about the Pkg-grub-devel mailing list