Gentoo Archives: gentoo-user

From: Peter Ruskin <peter.ruskin@×××××××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Dual booting Dell with Windows 7
Date: Mon, 01 Mar 2010 15:05:34
Message-Id: 201003011504.36971.peter.ruskin@dsl.pipex.com
In Reply to: Re: [gentoo-user] Dual booting Dell with Windows 7 by Mick
1 On Sunday 28 February 2010 23:51:21 Mick wrote:
2 > I have now succeeded at achieving what I wanted:  to use the
3 > Windows 7 boot manager (bootmgr.exe) which is the successor to
4 > NTLDR to chainload GRUB from it and so leave the Windows
5 > installation intact (at least until the warranty expires) ;-)
6 >
7 > I very briefly detail here the steps that I followed - if you
8 > need more please contact me and I will help if I can, or if I get
9 > some time I will sign up to edit a Wiki page.
10 >
11 > First the necessary WARNING:  You can render your MSWindows OS
12 > unbootable and without an installation CD things can get hairy.
13 >  So research the necessary steps to recover a borked MSWindows
14 > boot system using the facilities offered by the OEM *before* you
15 > start and use partimage to make a back up, just in case.
16 >
17 > There's two or three gotchas that make this more difficult than
18 > chainloading GRUB from NTLDR.exe under Win2k and WinXP:
19 >
20 > 1.  Disk and partition signatures in the MBR are used by Vista
21 > and Windows 7 to find the active boot partition of MSWindows.  If
22 > you move that partition then its disk offset changes and you
23 > start getting errors like "winload.exe..... is missing or
24 > corrupt", when what has actually happened is that the drive ID
25 > (partition signature) has changed and BCD doesn't know about it.
26 >
27 > 2.  OEMs use additional partitions to save installation images
28 > for recovery purposes and they often mark these as active boot
29 > partitions. The boomgr and BCD is consequently installed there as
30 > part of the installation script - but it doesn't clearly tell you
31 > this in the BCD file (that's the new boot.ini) unless you can
32 > decipher partition ID signatures.  Remove that recovery partition
33 > to save space and your MSWindows won't boot again.
34 >
35 > 3.  Windows 7 uses BitLocker on the IPL in the MBR and this may
36 > introduce additional complications - you mess with the MBR and
37 > then kiss goodbye to booting your MSWindows bloatware again.
38 >
39 > My solution worked by editing the BCD file using the native
40 > editor provided by MSWindows, the bcdedit command.  The
41 > winload.exe (which partly replaces NTLDR) is thereafter used
42 > normally to launch an image of the GRUB partition boot record and
43 > that of course knows where to jump to launch your Gentoo.
44 >  There's no need for 3rd party boot managers - there are two or
45 > three available like Neogrub which should do the same job by
46 > offering you a GUI, but if you are capable enough to install
47 > Gentoo then you can easily find your way around the BCD file with
48 > bcdedit.exe.
49 >
50 > The main steps to achieve this solution are:
51 >
52 > 1.  Install GRUB in your Linux /boot partition and capture an
53 > image of the partition boot record (it must be unmouted at the
54 > time):
55 >
56 > dd if=/dev/sda5 of=boot.lnx bs=512 count=1
57 >
58 > 2.  Copy the boot.lnx file to C:\boot.lnx
59 >
60 > 3.  Launch cmd.exe as administrator and call bcdedit /v which
61 > will show you something like this:
62 > ====================================================
63 > C:\Windows\system32>bcdedit /v
64 >
65 > Windows Boot Manager
66 > --------------------
67 > identifier              {9dea862c-5cdd-4e70-acc1-f32b344d4795}
68 > device                  partition=\Device\HarddiskVolume2
69 > path                    \bootmgr
70 > description             Windows Boot Manager
71 > locale                  en-US
72 > inherit                 {7ea2e1ac-2e61-4728-aaa3-896d9d0a9f0e}
73 > default                 {fda5ebf3-119b-11df-969c-f924691e8117}
74 > resumeobject            {5744906c-0bf4-11df-8e08-0026b920b49c}
75 > displayorder            {fda5ebf3-119b-11df-969c-f924691e8117}
76 >                         {fda5ebf6-119b-11df-969c-f924691e8117}
77 > toolsdisplayorder       {b2721d73-1db4-4c62-bf78-c548a880142d}
78 > timeout                 3
79 >
80 > Windows Boot Loader
81 > -------------------
82 > identifier              {fda5ebf3-119b-11df-969c-f924691e8117}
83 > device                  partition=C:
84 > path                    \Windows\system32\winload.exe
85 > description             Windows 7 Home Premium
86 > locale                  en-US
87 > recoverysequence        {5744906e-0bf4-11df-8e08-0026b920b49c}
88 > recoveryenabled         Yes
89 > osdevice                partition=C:
90 > systemroot              \Windows
91 > resumeobject            {5b312091-116a-11df-8b54-806e6f6e6963}
92 > ====================================================
93 >
94 > The first entry is the bootmgr, the second is MSWindows OS
95 > partition. First make a back up of the BCD file:
96 >
97 > C:\Windows\system32>bcdedit /export C:\BCD_backup
98 >
99 > Then create a new entry using bcdedit for the Linux boot image,
100 > by entering: ====================================================
101 > bcdedit /create /d "Gentoo Linux2" /application BOOTSECTOR
102 > The entry {fda5ebf7-119b-11df-969c-f924691e8117} was successfully
103 > created. ====================================================
104 >
105 > Cut and paste the partition ID in all the subsequent commands:
106 > ====================================================
107 > bcdedit /set {fda5ebf7-119b-11df-969c-f924691e8117} device boot
108 >
109 > bcdedit /set {fda5ebf7-119b-11df-969c-f924691e8117} path
110 > /boot.lnx
111 >
112 > bcdedit /set {fda5ebf7-119b-11df-969c-f924691e8117} locale en-US
113 > ====================================================
114 > If you don't get "The operation completed successfully." you know
115 > you've done something wrong.
116 >
117 > Then set it as last in the menu:
118 > ====================================================
119 > bcdedit /displayorder {fda5ebf7-119b-11df-969c-f924691e8117}
120 > /addlast The operation completed successfully.
121 > ====================================================
122 >
123 > and increase the delay before the menu automatically boots the
124 > default (leave the default as MSWindows until you prove that your
125 > Linux system can boot):
126 > ====================================================
127 >  bcdedit /timeout 10
128 > ====================================================
129 >
130 > Then run C:\Windows\system32>bcdedit /v to see what you have just
131 > made, at the bottom of the menu:
132 > ====================================================
133 > Real-mode Boot Sector
134 > ---------------------
135 > identifier              {fda5ebf6-119b-11df-969c-f924691e8117}
136 > device                  boot
137 > path                    \boot.lnx
138 > description             Gentoo Linux
139 > locale                  en-US
140 > ====================================================
141 >
142 > Now, this may not boot if your MSWindows boot drive is different
143 > to the MSWindows OS partition (as was in my case).  So, we need
144 > to point the bootmgr at the partition where the linux boot image
145 > resides, in my case C:
146 > ====================================================
147 > bcdedit /set {fda5ebf7-119b-11df-969c-f924691e8117} device
148 > partition=C: ====================================================
149 >
150 > Use the /v option to check all is good and reboot the machine.
151 > Hopefully, you will be greeted with a GRUB splash.  :-)
152
153 Thanks for the howto, Mick. I followed it on my Windows Vista Home
154 Premium 64; got "The operation completed successfully" all the way
155 through, but on reboot I don't get a boot menu.
156
157 This doesn't matter much to me at the moment, as I use Acronis OSS
158 Selector for boot manager, but this doesn't work on Windows 7, so
159 my free update to Windows 7 is gathering dust.
160
161 --
162 Peter
163 ========================================================================
164 Gentoo Linux: Portage 2.2_rc63 kernel-2.6.32-gentoo-r5
165 AMD Phenom(tm) 9950 Quad-Core Processor gcc(Gentoo: 4.4.3)
166 KDE: 3.5.10 Qt: 3.3.8b
167 ========================================================================

Replies

Subject Author
Re: [gentoo-user] Dual booting Dell with Windows 7 Mick <michaelkintzios@×××××.com>