help-grub
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Problem with booting Windows 7 from grub 2


From: Peter Asplund
Subject: Problem with booting Windows 7 from grub 2
Date: Tue, 18 Oct 2011 16:13:28 +0200

Hi, I've tried migrating to Grub 2, and I can't get the Windows 7
partition to boot. I'm on Gentoo and since Grub 2 isn't officially the
"bootloader of choice" it's a bit hard to get support there.

OS-proper seems to do the job, but Windows just refuses to boot. It
does work by changing the boot setup in BIOS, so there does not seem
to be anything wrong with the Windows MBR.

My disks are set up as (sorry about the Swedish):

Enhet Start     Början        Slut     Block    Id  System
/dev/sda1   *          63   308817494   154408716    b  W95 FAT32
/dev/sda2       308817495   625137344   158159925   83  Linux

    Enhet Start     Början        Slut     Block    Id  System
/dev/sdb1   *        2048   416098303   208048128    7  HPFS/NTFS/exFAT
/dev/sdb2       416099565  1446910289   515405362+  83  Linux
/dev/sdb3      1446910290  2191555169   372322440   83  Linux
/dev/sdb4      2191555170  2930272064   369358447+  83  Linux

    Enhet Start     Början        Slut     Block    Id  System
/dev/sdc1   *          63      208844      104391   83  Linux
/dev/sdc2          208845     4353614     2072385   82  Linux swap
/dev/sdc3         4353615    24836489    10241437+  83  Linux
/dev/sdc4        24836490   488392064   231777787+   5  Extended
/dev/sdc5        24836553   129082274    52122861   83  Linux
/dev/sdc6       129082338   488392064   179654863+  83  Linux


So let me try to explain this
sdc1 is the partition were grub is located. This is also '/boot'.
sdc5 is the '/' partition
sda1 is the Windows MBR (since it needs to be on the first partition
on the first drive. Or it used to, I had XP before I switched to Win
7).
sdb1 is the actual Windows installation.

I've labeled all drives, and used to use UUID/Labels to boot in
grub-legacy and it worked well. My output of blkid is (with irrelevant
drives removed):

$ blkid
/dev/sda1: LABEL="rand" UUID="46BB-2319" TYPE="vfat"
/dev/sdc1: LABEL="boot" UUID="0fbf4cbc-e910-4607-a91d-9a4995498b53" TYPE="ext2"
/dev/sdc2: LABEL="Swap" UUID="138a24a0-64a0-4c02-9c48-b5cafae186a1" TYPE="swap"
/dev/sdb1: UUID="4E7E79F57E79D5E5" TYPE="ntfs"
/dev/sdc3: LABEL="portage" UUID="f8561fd7-f45e-4098-a465-ae55a3472659"
TYPE="ext2"
/dev/sdc6: LABEL="home" UUID="cd057f76-9c6e-4e0a-9308-6dfad0803f57"
SEC_TYPE="ext2" TYPE="ext3"
/dev/sdc5: LABEL="root" UUID="cf869dfa-1fae-47bf-a678-bbc5128c4df3" TYPE="ext3"


This is my setup from Grub legacy:

title=Gentoo KMS
root (hd0,0)
kernel /boot/vmlinuz root=LABEL=root
initrd /boot/my-initramfs.cpio.gz

title=Windows 7
rootnoverify (hd1,0)
map (hd0) (hd1)
map (hd1) (hd0)
makeactive
chainloader +1

When translating this to grub2.cfg, the automatic output is:

menuentry 'Gentoo KMS' {
  set root='(hd0,1)'; set legacy_hdbias='0'
  legacy_kernel   '/boot/vmlinuz' '/boot/vmlinuz' 'root=LABEL=root'
  legacy_initrd '/boot/my-initramfs.cpio.gz' '/boot/my-initramfs.cpio.gz'

}

menuentry 'Windows 7' {
  set root='(hd1,1)'; set legacy_hdbias='0'
  drivemap '(hd0)' '(hd1)'
  drivemap '(hd1)' '(hd0)'
  parttool "$root" boot+
  chainloader  '+1'

}

If I try to boot using this, I get

error: hd1 cannot get C/H/S values.
error: hd1 cannot get C/H/S values.

The one that grub2-mkconfig outputs is simpler, and just says

menuentry "Windows 7 (loader) (on /dev/sda1)" --class windows --class os {
   insmod part_msdos
   insmod fat
   set root='(hd0,msdos1)'
   search --no-floppy --fs-uuid --set=root 46bb-2319
   chainloader +1
}


and that says "No such drive: 46bb-2319" or something like it. I've
tried putting together my own variations (lots of them by now, going
through Ubuntu/Arch/Linux Mint/Debian/Gentoo forums, the Grub manual,
guides etc) and for now I'm at this point, which of course doesn't
work either:

menuentry "Windows 7 (loader) (on /dev/sda1)" --class windows --class os {
   insmod part_msdos
   insmod fat
   insmod ntfs
   set root='(hd0,1)'
   drivemap -s '(hd0)' '(hd1)'
   parttool "$root" boot+
   chainloader '+1'
}


This one just stops at an empty screen saying "GRUB _" at the top left
corner. I am confused.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]