Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Unable to boot Windows 7 from Grub-1.99-r2
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Unsupported Software
View previous topic :: View next topic  
Author Message
azp
Guru
Guru


Joined: 16 Nov 2003
Posts: 432
Location: Stockholm, Sweden

PostPosted: Tue Sep 13, 2011 10:56 pm    Post subject: Unable to boot Windows 7 from Grub-1.99-r2 Reply with quote

Hi, I've tried migrating to Grub 2, and except not seeing any functional improvements what-so-ever, I can't get the Windows 7 partition to boot. 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):
Code:

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 (this is kind of the reason why I don't see the gain of grub 2) and it worked well. My output of blkid is (with irrelevant drives removed):
Code:

$ 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:
Code:
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:
Code:
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
Code:
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
Code:

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:
Code:

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. :?
_________________
Weeks of coding can save you hours of planning.
Back to top
View user's profile Send private message
Belliash
Advocate
Advocate


Joined: 24 Nov 2004
Posts: 2428
Location: Wroclaw, Poland

PostPosted: Wed Sep 14, 2011 7:18 am    Post subject: Reply with quote

This works for me:

Code:
menuentry "Microsoft Windows 7" --class windows --class os {
        insmod ntfs
        insmod part_msdos
        set root='(hd0,msdos1)'
        chainloader +1
}

_________________
Asio Software Technologies
Belliash IT Weblog
Back to top
View user's profile Send private message
azp
Guru
Guru


Joined: 16 Nov 2003
Posts: 432
Location: Stockholm, Sweden

PostPosted: Wed Sep 14, 2011 8:44 am    Post subject: Reply with quote

Do you have the Windows MBR and the actual installation on different drives or partitions? I that is one of the things that is causing the issue, but I'm not sure.
_________________
Weeks of coding can save you hours of planning.
Back to top
View user's profile Send private message
tclover
Guru
Guru


Joined: 10 Apr 2011
Posts: 516

PostPosted: Fri Sep 23, 2011 2:37 pm    Post subject: Grub4dos Reply with quote

This is a real issue... I cannot boot w7 either with grub-1.99-r2 because of an "invalid signature" error. The thing is I'm just trying to boot w7 from the disk MBR which is a TureCrypt boot loader. I've already known that, even with grub-0.97 that trying to boot a w7 crypted partion with TrueCrypt was already an issue so I've never tried to set up any disk with grub-0.97 to begin with nor with grub-1.99-r2. What I had always did to boot was to boot from a USB (vfat) PENDRIVE because my rootfs is on LVM and the PVs are crypted with LUKS, so I needed an encrypted key (from a removable media) to boot anyway, so I've set up a pendrive with grub-0.97 to boot from before and now with grub-1.99-r2. The thing is I've planned for a long while ago to remove any MBR on the disks hosting Linux or w7. So I could boot TrueCrypt boot loader directly (with the .raw rescue image) with grub-0.97 but cannot do the same thing with grub-1.99-r2. There's a bug in launchpad about that. So the only viable solution is "chainload" GRUB4DOS from grup-1.99-r2 and get something very similar to grub[-0.97] legacy.

One will need something like:
Quote:
menuentry "GUB4DOS" {
linux /grub4dos-0.4.4/grub.exe --config-file=/menu.lst
}

To "chainload" grub4dos boot loader, one need grub.exe, grldr in the `/' root of your removable media or boot partition and a menu.lst very similar to what you had with grub[-0.97] legacy. And everything is setup to "chainload" GRUB4DOS bootloader.

So now I can chainload a rescue .raw image of TureCrypt boot loader to boot w7 from an encrypted partion with GRUB4DOS. This is really a shame that one cannot "chainload" another bootloader or iso/raw image as one used to with grub[-0.97] legacy even if now one can boot Linux/Unix easily from a live dvd/cd.

And one need something like this to boot w7 with a .raw rescue image of TrueCrypt from a removable media, a pendrive for example, in your menu.lst with GUB4DOS:
Quote:
title W7
find --set-root /path/to/<TueCrypt rescue image>.raw[|iso]
map --mem /path/to/<TueCrypt rescue image>.raw[|iso] (hd32)
map (hd0) (hd1)
map (hd1) (hd0)
map --hook
root (hd32)
chainloader (hd32)

EDIT: This obviously works with grub[-0.97] legacy! The issue booting a live cd/dvd like that is, after the kernel and initrd are successfully loaded the initialization started, the boot process somewhat fails because there's no real cd/dvd mounted... so the boot up just fails like that. I tried to append a "root no verify" or "ramdisk" options but it doesnt work either. I can boot gentoo live cd like that after mounting the iso image in a rescue shell, because, yeah, one would be dropped there because of a missing cd/dvd!
Back to top
View user's profile Send private message
azp
Guru
Guru


Joined: 16 Nov 2003
Posts: 432
Location: Stockholm, Sweden

PostPosted: Wed Oct 05, 2011 12:40 pm    Post subject: Reply with quote

I don't think my issue has anything to do with yours since I'm not using any kind of encryption on my drives.
_________________
Weeks of coding can save you hours of planning.
Back to top
View user's profile Send private message
tclover
Guru
Guru


Joined: 10 Apr 2011
Posts: 516

PostPosted: Wed Oct 05, 2011 4:43 pm    Post subject: Reply with quote

I was just giving you hints if you need GRUB2 and still be able to boot W7. So you're saying your issue is different from mine? Oh well, you make me learn something new that I naturally have no idea of... I will surely help you next time, on another issue, naturally. Take care, until next time.
Back to top
View user's profile Send private message
azp
Guru
Guru


Joined: 16 Nov 2003
Posts: 432
Location: Stockholm, Sweden

PostPosted: Thu Oct 06, 2011 7:53 am    Post subject: Reply with quote

tclover wrote:
I was just giving you hints if you need GRUB2 and still be able to boot W7. So you're saying your issue is different from mine? Oh well, you make me learn something new that I naturally have no idea of... I will surely help you next time, on another issue, naturally. Take care, until next time.


Well it's very nice of you to try to help me, but I don't see the relevance in your post. It feels more like you are just telling me about some issue you've had without addressing me or my issue at all. But perhaps I'm interpreting your answer incorrectly, in that case I'm sorry.
_________________
Weeks of coding can save you hours of planning.
Back to top
View user's profile Send private message
tclover
Guru
Guru


Joined: 10 Apr 2011
Posts: 516

PostPosted: Thu Oct 06, 2011 9:57 am    Post subject: Reply with quote

azp wrote:
Well it's very nice of you to try to help me, but I don't see the relevance in your post. It feels more like you are just telling me about some issue you've had without addressing me or my issue at all. But perhaps I'm interpreting your answer incorrectly, in that case I'm sorry.

I did not post the specific code to chainload directly M$ W7, but with what I posted above, if you need GRUB2 and still be able to boot it, you can pretty much easily adapt the second quote to your case because it's much simpler than chainloading TrueCrypt rescue image. But hey, what's wrong with not delivering "the solution" for your issue but gives more than enough elements for a workaround? If you needed help or the whole code for your issue, you could have asked me and I would have helped/posted the whole menu.lst entry. Anyway, now, I couldn't care less about that.
Back to top
View user's profile Send private message
azp
Guru
Guru


Joined: 16 Nov 2003
Posts: 432
Location: Stockholm, Sweden

PostPosted: Fri Oct 07, 2011 10:36 am    Post subject: Reply with quote

tclover wrote:
azp wrote:
Well it's very nice of you to try to help me, but I don't see the relevance in your post. It feels more like you are just telling me about some issue you've had without addressing me or my issue at all. But perhaps I'm interpreting your answer incorrectly, in that case I'm sorry.

I did not post the specific code to chainload directly M$ W7, but with what I posted above, if you need GRUB2 and still be able to boot it, you can pretty much easily adapt the second quote to your case because it's much simpler than chainloading TrueCrypt rescue image. But hey, what's wrong with not delivering "the solution" for your issue but gives more than enough elements for a workaround? If you needed help or the whole code for your issue, you could have asked me and I would have helped/posted the whole menu.lst entry. Anyway, now, I couldn't care less about that.


I don't know if you read my first post, but the setup I had with Grub legacy worked very well, and doesn't differ a lot from your setup. Thank you for your input!
_________________
Weeks of coding can save you hours of planning.
Back to top
View user's profile Send private message
katabami
n00b
n00b


Joined: 11 Jul 2009
Posts: 40

PostPosted: Mon Oct 10, 2011 1:34 am    Post subject: Reply with quote

How about adding "drivemap" to grub2-mkconfig output?
Back to top
View user's profile Send private message
azp
Guru
Guru


Joined: 16 Nov 2003
Posts: 432
Location: Stockholm, Sweden

PostPosted: Tue Oct 11, 2011 4:11 pm    Post subject: Reply with quote

katabami wrote:
How about adding "drivemap" to grub2-mkconfig output?


Yeah, I've tried that as well... If you check my first post, the last code segment in it has drivemap as well:

Code:
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'
}


It does also have parttool, but I'm pretty sure that I've tried without that. Perhaps I should just try to get in touch with the grub devs? Their mailing-list or something.
_________________
Weeks of coding can save you hours of planning.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Unsupported Software All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum