Bug: device2grub not compatible with grub_pc

Toomas Tamm tt-fai at kky.ttu.ee
Tue Nov 16 09:41:37 CET 2010


Hello all!

According to Grub 2 (aka grub_pc) documentation 
http://www.dedoimedo.com/computers/grub-2.html :

> Critical! GRUB 2 uses PARTITION notation that starts with 1 and not 0
> like GRUB legacy! This is terribly important to remember!

However, the program device2grub which comes as part of FAI (I am using
the experimental series, version 4.0~beta2+experimental23 at the moment)
does not appear to differentiate between grub legacy and grub 2. This
program is called from scripts/GRUB_PC/10-setup and will produce
off-by-one partition numbers for grub 2.

The bug is manifested only if grub is to be installed into an unusual
paritition, like /dev/sda6 . The usual /dev/sda case is handled
gracefully because the translated name "(hd0)" does not contain a
partition number.

I was hit by this when /dev/sda6 was translated incorrectly into
"(hd0,5)" and grub2 got installed on top of an NTFS Windows partition
(/dev/sda5), destroying the filesystem structure. Luckily, I had backups
available...

I think device2grub needs a flag which would inhibit the decrement of
partition number in case it is used in conjunction with grub_pc and
scripts/GRUB_PC/10-setup needs to make use of this flag.

I also think that this should be fixed before squeeze is released (do I
need to file a bug report into Debian BTS to make it official?) because
grub_pc is the default bootloader for squeeze and this bug has potential
of corrupting unsuspecting people's data if they install dual-boot
systems.

-- 
Toomas Tamm                                 e-mail: tt-fai (at) kky.ttu.ee
Chair of Inorganic Chemistry                voice:  INT+372-620-2810
Tallinn University of Technology            fax:    INT+372-620-2828
Ehitajate tee 5, EE-19086 Tallinn, Estonia  http://www.kk.ttu.ee/toomas/



More information about the linux-fai mailing list