Bug#487755: grub2 does not install on boot sector of the current (or a mounted) partition

Holger Fischer hoo.mb at web.de
Mon Jun 23 21:48:30 UTC 2008


Package: grub2
Version: 1.96+20080621-1
Severity: important

In my mbr I installed gag. It boots from my bootable partitions.
Therfore I install grub in the boot block of a partition I want to boot
from, I find this more "sorted". This worked fine for years.

I tried it with some prior version of grub2 (I think 1.96-200805xx) on
my root (like above sda6) as follows:

grub-install /dev/sda6

This does not work. After a lot of tries and some dangerous 
grub-install /dev/sda6
grub-install /dev/sda7
dd if=/dev/sda7 of=/dev/sda6 bs=512 count=1 
actions I got it to work, but this does not always work. I think that
work's because sda7 is not mounted at this moment. (There's a longer
story behind it with checking the difference of the first 512 bytes of
sda6 and sda7 with vbindiff and finding the right jumppoint to
core.img...., if you are interested let me know)

Now I try it always with sda7 by doing
mkdir /1
mount /dev/sda7 /1
grub-install --root-directory=/1 /dev/sda7
umount /1
rmdir /1

when I then do 
kvm /dev/sda
(I know this is dangerous because sda6 is mounted as root and kvm does
not check it, but for only trying the bootloader on sda7 I won't destroy
anything on sda6)
the bootloader works flawless
when I reboot and try this from real hardware grub2 stops somewhere in
the beginning  with a short message.
When I do kvm /dev/sda after this reboot I get the same message like
from real hardware. 
My thoughts:
I think the message I get after reboot is the message from my last
successfull grub2 dd if=.. installation, because the changes that should
have been written to the 1st 512 bytes of sda7 are not written back by
grub-install, they were only cached. This only occurs when the boot
block I want grub2 boot.img install on is actually mounted (I think some
tests I did proved this, the boot sector of the partition stayed the
same after a reboot like before grub-install). Maybe this information
helps you.

There's another thing related to this:
One advantage of grub1 (or grub-legacy) was that you could install it
somewhere and then create or change the grub.conf or menu.lst without
the need of reinstalling grub or a update-grub or grub-setup

With grub2 this does not work. When I change something in the grub.cfg I
must do a grub-setup or update-grub to "apply" changes. This means, the
grub.cfg is not really used when booting?  
Did I do something wrong? Will this always be the behaviour of grub2?
(If yes, then grub2 is a big step back in the evolution of bootloader
software, it behaves like old lilo did and I don't need full size splash
images, I need easy-to-maintain software)

Best regards 

Holger Fischer

Don't make Linux too much like Windows, because I don't like Windows but
I like Linux and other ?NIX

-- Package-specific info:

*********************** BEGIN /proc/mounts
/dev/disk/by-uuid/c329d509-b7d7-4c73-a2eb-34dc2f6bd41e / ext2 rw,noatime,errors=remount-ro 0 0
/dev/disk/by-uuid/c329d509-b7d7-4c73-a2eb-34dc2f6bd41e /dev/.static/dev ext2 rw,errors=remount-ro 0 0
*********************** END /proc/mounts

*********************** BEGIN /boot/grub/device.map
(hd0)	/dev/sda
*********************** END /boot/grub/device.map

*********************** BEGIN /boot/grub/grub.cfg
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by /usr/sbin/update-grub using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
set default=0
set timeout=5
set root=(hd0,6)
search --fs-uuid --set c329d509-b7d7-4c73-a2eb-34dc2f6bd41e
if font /usr/share/grub/unicode.pff ; then
  set gfxmode=640x480
  insmod gfxterm
  insmod vbe
  terminal gfxterm
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/05_debian_theme ###
set root=(hd0,6)
search --fs-uuid --set c329d509-b7d7-4c73-a2eb-34dc2f6bd41e
insmod png
if background_image /usr/share/images/desktop-base/debian-blueish-wallpaper-640x480.png ; then
  set color_normal=black/black
  set color_highlight=magenta/black
else
  set menu_color_normal=cyan/blue
  set menu_color_highlight=white/blue
fi
### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/10_hurd ###
### END /etc/grub.d/10_hurd ###

### BEGIN /etc/grub.d/10_linux ###
set root=(hd0,6)
search --fs-uuid --set c329d509-b7d7-4c73-a2eb-34dc2f6bd41e
menuentry "Debian GNU/Linux, linux 2.6.25-2-amd64" {
	linux	/boot/vmlinuz-2.6.25-2-amd64 root=UUID=c329d509-b7d7-4c73-a2eb-34dc2f6bd41e ro iommu=soft 
	initrd	/boot/initrd.img-2.6.25-2-amd64
}
menuentry "Debian GNU/Linux, linux 2.6.25-2-amd64 (single-user mode)" {
	linux	/boot/vmlinuz-2.6.25-2-amd64 root=UUID=c329d509-b7d7-4c73-a2eb-34dc2f6bd41e ro single iommu=soft
	initrd	/boot/initrd.img-2.6.25-2-amd64
}
### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/30_os-prober ###
### END /etc/grub.d/30_os-prober ###
*********************** END /boot/grub/grub.cfg

-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.25-2-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages grub2 depends on:
ii  debconf                  1.5.22          Debian configuration management sy
ii  grub-pc                  1.96+20080621-1 GRand Unified Bootloader, version 

grub2 recommends no packages.

-- debconf information:
  grub2/numbering_scheme_transition:





More information about the Pkg-grub-devel mailing list