Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Unsupported Software
  • Search

Unable to boot Windows 7 from Grub-1.99-r2

This forum covers all Gentoo-related software not officially supported by Gentoo. Ebuilds/software posted here might harm the health and stability of your system(s), and are not supported by Gentoo developers. Bugs/errors caused by ebuilds from overlays.gentoo.org are covered by this forum, too.
Post Reply
Advanced search
11 posts • Page 1 of 1
Author
Message
azp
Guru
Guru
Posts: 457
Joined: Sun Nov 16, 2003 5:48 pm
Location: Sweden
Contact:
Contact azp
Website

Unable to boot Windows 7 from Grub-1.99-r2

  • Quote

Post by azp » Tue Sep 13, 2011 10:56 pm

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: Select all

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: Select all

$ 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: Select all

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: Select all

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: Select all

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: Select all

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: Select all

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.
Top
Belliash
Advocate
Advocate
User avatar
Posts: 2503
Joined: Wed Nov 24, 2004 1:39 pm
Location: Wroclaw, Poland
Contact:
Contact Belliash
Website

  • Quote

Post by Belliash » Wed Sep 14, 2011 7:18 am

This works for me:

Code: Select all

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
Top
azp
Guru
Guru
Posts: 457
Joined: Sun Nov 16, 2003 5:48 pm
Location: Sweden
Contact:
Contact azp
Website

  • Quote

Post by azp » Wed Sep 14, 2011 8:44 am

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.
Top
tclover
Guru
Guru
Posts: 516
Joined: Sun Apr 10, 2011 11:41 pm

Grub4dos

  • Quote

Post by tclover » Fri Sep 23, 2011 2:37 pm

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:
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:
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!
Top
azp
Guru
Guru
Posts: 457
Joined: Sun Nov 16, 2003 5:48 pm
Location: Sweden
Contact:
Contact azp
Website

  • Quote

Post by azp » Wed Oct 05, 2011 12:40 pm

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.
Top
tclover
Guru
Guru
Posts: 516
Joined: Sun Apr 10, 2011 11:41 pm

  • Quote

Post by tclover » Wed Oct 05, 2011 4:43 pm

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.
Top
azp
Guru
Guru
Posts: 457
Joined: Sun Nov 16, 2003 5:48 pm
Location: Sweden
Contact:
Contact azp
Website

  • Quote

Post by azp » Thu Oct 06, 2011 7:53 am

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.
Top
tclover
Guru
Guru
Posts: 516
Joined: Sun Apr 10, 2011 11:41 pm

  • Quote

Post by tclover » Thu Oct 06, 2011 9:57 am

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.
Top
azp
Guru
Guru
Posts: 457
Joined: Sun Nov 16, 2003 5:48 pm
Location: Sweden
Contact:
Contact azp
Website

  • Quote

Post by azp » Fri Oct 07, 2011 10:36 am

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.
Top
katabami
n00b
n00b
Posts: 40
Joined: Sat Jul 11, 2009 7:40 am

  • Quote

Post by katabami » Mon Oct 10, 2011 1:34 am

How about adding "drivemap" to grub2-mkconfig output?
Top
azp
Guru
Guru
Posts: 457
Joined: Sun Nov 16, 2003 5:48 pm
Location: Sweden
Contact:
Contact azp
Website

  • Quote

Post by azp » Tue Oct 11, 2011 4:11 pm

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: Select all

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.
Top
Post Reply

11 posts • Page 1 of 1

Return to “Unsupported Software”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic