# GRUB 2 wrongly using /boot/grub/ instead of /boot/grub2/

## Fitzcarraldo

GRUB 2 is driving me nuts (again).   :Evil or Very Mad: 

```
# uname -a

Linux meshedgedx 3.3.5-gentoo #1 SMP Tue May 15 02:12:43 BST 2012 x86_64 Intel(R) Core(TM) i7 CPU Q 720 @ 1.60GHz GenuineIntel GNU/Linux
```

My main laptop dual boots Windows 7 and Gentoo. The Windows bootloader (in the MBR and on sda2) chainloads GRUB 2 on sda3 (/boot, which is on its own partition). I used the utility EasyBCD 2.0.2 to configure the Windows bootloader to chainload GRUB 2.

A long time ago I installed version 1.99 of GRUB 2, but I used a Sabayon ebuild instead of a Gentoo ebuild. All the GRUB 2 files were installed in /boot/grub/ rather than in /boot/grub2/. The laptop booted as expected. If I selected 'Linux' from the Windows bootloader's menu, the GRUB 2 menu was displayed with the background picture I had specified, and I could select an entry in the GRUB 2 menu and boot it.

Yesterday I installed GRUB 2 2.00_beta6 using the Gentoo ebuild, and I then used the grub2-install and grub2-mkconfig commands to set up everything. The directory /boot/grub2/ has all the expected GRUB2 directories and files in it:

```
ls -la /boot/grub2/

total 317

drwxr-xr-x 6 root root   1024 Jun 18 02:44 .

drwxr-xr-x 6 root root   1024 May 18 17:49 ..

drwxr-xr-x 2 root root   1024 Jun 17 22:25 fonts

-rw------- 1 root root   6914 Jun 18 02:44 grub.cfg

-rw-r--r-- 1 root root   1024 Jun 17 23:15 grubenv

drwxr-xr-x 2 root root   8192 Jun 18 02:43 i386-pc

drwxr-xr-x 2 root root   1024 Jun 17 22:25 locale

-rw-r--r-- 1 root root 302433 Jun 17 22:26 splash.png

drwxr-xr-x 3 root root   1024 Jun 17 22:25 themes
```

My problem is that, when I boot the laptop, the GRUB 2 version 1.99 menu is still displayed, not the GRUB 2 version 2.00_beta6 menu. Basically, it appears to me that GRUB 2 is still booting using the GRUB 2 version 1.99 files in the /boot/grub/ directory rather than the GRUB 2 version 2.00_beta6 files in the /boot/grub2/ directory.

Below is what I have tried so far in order to install GRUB 2 version 2.00_beta6:

```
mount /dev/sda3 /boot

grub2-install --force /dev/sda3

grub2-mkconfig -o /boot/grub2/grub.cfg
```

```
mount /dev/sda3 /boot

grub2-install --boot-directory=/boot/ --force /dev/sda3

grub2-mkconfig -o /boot/grub2/grub.cfg
```

```
mount /dev/sda3 /boot

grub2-install --directory=/usr/lib64/grub/i386-pc --target=i386-pc --boot-directory=/boot --recheck --force /dev/sda3

grub2-mkconfig -o /boot/grub2/grub.cfg
```

The Arch Linux Wiki article on GRUB 2 recommends write-protecting the GRUB 2 core.img file if installing GRUB 2 in a partition boot sector rather than in the MBR, so I have also tried that:

```
chattr -i /boot/grub2/i386-pc/core.img

grub2-install --directory=/usr/lib64/grub/i386-pc --target=i386-pc --boot-directory=/boot --recheck --force /dev/sda3

chattr +i /boot/grub2/i386-pc/core.img

grub2-mkconfig -o /boot/grub2/grub.cfg
```

The result is the same in every case: everything apparently installs but, upon rebooting, the GRUB 2 boot menu still displays the GRUB 2 version as "1.99" instead of "beta6".

If I copy /boot/grub2/grub.cfg to /boot/grub/grub.cfg, then the latter is used when the laptop boots. Why?   :Confused:  And still the GRUB 2 version 1.99 menu is displayed. Why?   :Confused: 

I even tried the latest version of EasyBCD (2.1.2) to regenerate the BCD for the Windows bootloader, but it does not change anything.

The sda3 boot sector is being chainloaded by the Windows bootloader, but, if I am interpreting this correctly, it seems that the code in the sda3 boot sector is then using /boot/grub/core.img rather than using /boot/grub2/i386-pc/core.img. I assume the problem is not in the Windows BCD, but am not completely sure. My understanding is that the Windows bootloader just calls the GRUB 2 code in the partition's boot sector, and that then calls the other GRUB 2 code on the partition.

Any ideas what I could try in order to get GRUB 2 2.00_beta6 working correctly? GRUB 2 1.99 was working perfectly using /boot/grub/, so why doesn't GRUB 2 2.00_beta6 use /boot/grub2/? Thanks in advance for any help.

----------

## mv

You probalby want to install grub into the harddisks root sector (not into the partitions boot sector): Your device argument should probably be /dev/sda (instead of /dev/sda3).

----------

## Fitzcarraldo

 *mv wrote:*   

> You probalby want to install grub into the harddisks root sector (not into the partitions boot sector): Your device argument should probably be /dev/sda (instead of /dev/sda3).

 

I don't want to install GRUB into /dev/sda, for the reasons outlined in my post The best way to dual boot Linux and Windows. If I were to specify /dev/sda to grub2-install instead of /dev/sda3, GRUB 2 code would be installed in the MBR, and that is precisely what I do not want.

I have successfully been using GRUB 2 for at least two years this way, i.e. with the GRUB 2 code installed in the boot sector of sda3 which is a separate partition for /boot, and chainloading it from the Windows bootloader in the MBR and sda2. And before I installed GRUB 2, I was also doing the same thing using GRUB Legacy, i.e. installing the GRUB Legacy code in sda3's boot sector, the rest of GRUB Legacy's files in /boot/grub/ on sda3, and chainloading GRUB Legacy from the Windows bootloader in the MBR and sda2.

sda1 Windows factory restore partition

sda2 Windows C: drive

sda3 /boot

sda4 Extended partition containing:

sda5 swap

sda6 /

sda7 /home

The Windows bootloader has code in the MBR and files on the C: drive. The GRUB bootloader in my case has code in the sda3 boot sector and files in a sub-directory of /boot. I am not the only person to do it this way. This is not the problem. The problem is that I want to change from using /boot/grub/ for GRUB 2 files to using /boot/grub2/ instead but something is stopping that.

----------

## mv

 *Fitzcarraldo wrote:*   

> I don't want to install GRUB into /dev/sda

 

But maybe you have already done so with grub-1.99 if it is never overridden by grub-2?

Or maybe you had by mistake installed gub-1.99 to /dev/sda2 (or some other number) and chainload always that... grub is clever enough to find the config on the other partition anyway.

----------

## Fitzcarraldo

 *mv wrote:*   

>  *Fitzcarraldo wrote:*   I don't want to install GRUB into /dev/sda 
> 
> But maybe you have already done so with grub-1.99 if it is never overridden by grub-2? 

 

If I had specified /dev/sda when installing GRUB 2 version 1.99, some GRUB 2 code would have been installed to the MBR and GRUB 2 would then have run instead of the Windows bootloader when the laptop is switched on. However, as mentioned previously, the Windows bootloader runs when I switch on the laptop, ergo I did not specify /dev/sda when installing GRUB 2 version 1.99.

 *mv wrote:*   

> Or maybe you had by mistake installed gub-1.99 to /dev/sda2 (or some other number) and chainload always that... grub is clever enough to find the config on the other partition anyway.

 

I'm sure I didn't, which I think could be corroborated by examining the MBR and the boot sectors of the primary and logical partitions:

The MBR contains:

```
# dd bs=512 count=1 if=/dev/sda | od -Ax -tx1z -v

1+0 records in

1+0 records out

512 bytes (512 B) copied, 1.9413e-05 s, 26.4 MB/s

000000 33 c0 8e d0 bc 00 7c 8e c0 8e d8 be 00 7c bf 00  >3.....|......|..<

000010 06 b9 00 02 fc f3 a4 50 68 1c 06 cb fb b9 04 00  >.......Ph.......<

000020 bd be 07 80 7e 00 00 7c 0b 0f 85 0e 01 83 c5 10  >....~..|........<

000030 e2 f1 cd 18 88 56 00 55 c6 46 11 05 c6 46 10 00  >.....V.U.F...F..<

000040 b4 41 bb aa 55 cd 13 5d 72 0f 81 fb 55 aa 75 09  >.A..U..]r...U.u.<

000050 f7 c1 01 00 74 03 fe 46 10 66 60 80 7e 10 00 74  >....t..F.f`.~..t<

000060 26 66 68 00 00 00 00 66 ff 76 08 68 00 00 68 00  >&fh....f.v.h..h.<

000070 7c 68 01 00 68 10 00 b4 42 8a 56 00 8b f4 cd 13  >|h..h...B.V.....<

000080 9f 83 c4 10 9e eb 14 b8 01 02 bb 00 7c 8a 56 00  >............|.V.<

000090 8a 76 01 8a 4e 02 8a 6e 03 cd 13 66 61 73 1c fe  >.v..N..n...fas..<

0000a0 4e 11 75 0c 80 7e 00 80 0f 84 8a 00 b2 80 eb 84  >N.u..~..........<

0000b0 55 32 e4 8a 56 00 cd 13 5d eb 9e 81 3e fe 7d 55  >U2..V...]...>.}U<

0000c0 aa 75 6e ff 76 00 e8 8d 00 75 17 fa b0 d1 e6 64  >.un.v....u.....d<

0000d0 e8 83 00 b0 df e6 60 e8 7c 00 b0 ff e6 64 e8 75  >......`.|....d.u<

0000e0 00 fb b8 00 bb cd 1a 66 23 c0 75 3b 66 81 fb 54  >.......f#.u;f..T<

0000f0 43 50 41 75 32 81 f9 02 01 72 2c 66 68 07 bb 00  >CPAu2....r,fh...<

000100 00 66 68 00 02 00 00 66 68 08 00 00 00 66 53 66  >.fh....fh....fSf<

000110 53 66 55 66 68 00 00 00 00 66 68 00 7c 00 00 66  >SfUfh....fh.|..f<

000120 61 68 00 00 07 cd 1a 5a 32 f6 ea 00 7c 00 00 cd  >ah.....Z2...|...<

000130 18 a0 b7 07 eb 08 a0 b6 07 eb 03 a0 b5 07 32 e4  >..............2.<

000140 05 00 07 8b f0 ac 3c 00 74 09 bb 07 00 b4 0e cd  >......<.t.......<

000150 10 eb f2 f4 eb fd 2b c9 e4 64 eb 00 24 02 e0 f8  >......+..d..$...<

000160 24 02 c3 49 6e 76 61 6c 69 64 20 70 61 72 74 69  >$..Invalid parti<

000170 74 69 6f 6e 20 74 61 62 6c 65 00 45 72 72 6f 72  >tion table.Error<

000180 20 6c 6f 61 64 69 6e 67 20 6f 70 65 72 61 74 69  > loading operati<

000190 6e 67 20 73 79 73 74 65 6d 00 4d 69 73 73 69 6e  >ng system.Missin<

0001a0 67 20 6f 70 65 72 61 74 69 6e 67 20 73 79 73 74  >g operating syst<

0001b0 65 6d 00 00 00 63 7b 9a 7c ab 0b 28 00 00 00 20  >em...c{.|..(... <

0001c0 21 00 27 fe ff ff 00 08 00 00 00 80 38 01 80 fe  >!.'.........8...<

0001d0 ff ff 07 fe ff ff 00 88 38 01 00 c0 26 12 00 fe  >........8...&...<

0001e0 ff ff 83 fe ff ff 08 85 5f 13 0c f1 02 00 00 fe  >........_.......<

0001f0 ff ff 05 fe ff ff 14 76 62 13 ad 60 e0 11 55 aa  >.......vb..`..U.<

000200
```

^No GRUB code in there (and see also my response to your first suggestion).

The boot sector on the Windows factory restore partition (sda1) contains:

```
# dd bs=512 count=1 if=/dev/sda1 | od -Ax -tx1z -v

1+0 records in

1+0 records out

512 bytes (512 B) copied, 0.000343476 s, 1.5 MB/s

000000 eb 52 90 4e 54 46 53 20 20 20 20 00 02 08 00 00  >.R.NTFS    .....<

000010 00 00 00 00 00 f8 00 00 3f 00 ff 00 00 08 00 00  >........?.......<

000020 00 00 00 00 80 00 80 00 ff 7f 38 01 00 00 00 00  >..........8.....<

000030 00 00 0c 00 00 00 00 00 02 00 00 00 00 00 00 00  >................<

000040 f6 00 00 00 01 00 00 00 43 70 3e 86 9f 3e 86 a6  >........Cp>..>..<

000050 00 00 00 00 fa 33 c0 8e d0 bc 00 7c fb 68 c0 07  >.....3.....|.h..<

000060 1f 1e 68 66 00 cb 88 16 0e 00 66 81 3e 03 00 4e  >..hf......f.>..N<

000070 54 46 53 75 15 b4 41 bb aa 55 cd 13 72 0c 81 fb  >TFSu..A..U..r...<

000080 55 aa 75 06 f7 c1 01 00 75 03 e9 dd 00 1e 83 ec  >U.u.....u.......<

000090 18 68 1a 00 b4 48 8a 16 0e 00 8b f4 16 1f cd 13  >.h...H..........<

0000a0 9f 83 c4 18 9e 58 1f 72 e1 3b 06 0b 00 75 db a3  >.....X.r.;...u..<

0000b0 0f 00 c1 2e 0f 00 04 1e 5a 33 db b9 00 20 2b c8  >........Z3... +.<

0000c0 66 ff 06 11 00 03 16 0f 00 8e c2 ff 06 16 00 e8  >f...............<

0000d0 4b 00 2b c8 77 ef b8 00 bb cd 1a 66 23 c0 75 2d  >K.+.w......f#.u-<

0000e0 66 81 fb 54 43 50 41 75 24 81 f9 02 01 72 1e 16  >f..TCPAu$....r..<

0000f0 68 07 bb 16 68 70 0e 16 68 09 00 66 53 66 53 66  >h...hp..h..fSfSf<

000100 55 16 16 16 68 b8 01 66 61 0e 07 cd 1a 33 c0 bf  >U...h..fa....3..<

000110 28 10 b9 d8 0f fc f3 aa e9 5f 01 90 90 66 60 1e  >(........_...f`.<

000120 06 66 a1 11 00 66 03 06 1c 00 1e 66 68 00 00 00  >.f...f.....fh...<

000130 00 66 50 06 53 68 01 00 68 10 00 b4 42 8a 16 0e  >.fP.Sh..h...B...<

000140 00 16 1f 8b f4 cd 13 66 59 5b 5a 66 59 66 59 1f  >.......fY[ZfYfY.<

000150 0f 82 16 00 66 ff 06 11 00 03 16 0f 00 8e c2 ff  >....f...........<

000160 0e 16 00 75 bc 07 1f 66 61 c3 a0 f8 01 e8 09 00  >...u...fa.......<

000170 a0 fb 01 e8 03 00 f4 eb fd b4 01 8b f0 ac 3c 00  >..............<.<

000180 74 09 b4 0e bb 07 00 cd 10 eb f2 c3 0d 0a 41 20  >t.............A <

000190 64 69 73 6b 20 72 65 61 64 20 65 72 72 6f 72 20  >disk read error <

0001a0 6f 63 63 75 72 72 65 64 00 0d 0a 42 4f 4f 54 4d  >occurred...BOOTM<

0001b0 47 52 20 69 73 20 6d 69 73 73 69 6e 67 00 0d 0a  >GR is missing...<

0001c0 42 4f 4f 54 4d 47 52 20 69 73 20 63 6f 6d 70 72  >BOOTMGR is compr<

0001d0 65 73 73 65 64 00 0d 0a 50 72 65 73 73 20 43 74  >essed...Press Ct<

0001e0 72 6c 2b 41 6c 74 2b 44 65 6c 20 74 6f 20 72 65  >rl+Alt+Del to re<

0001f0 73 74 61 72 74 0d 0a 00 8c a9 be d6 00 00 55 aa  >start.........U.<

000200
```

^No GRUB code in there.

The boot sector on the Windows C: drive (sda2) contains:

```
# dd bs=512 count=1 if=/dev/sda2 | od -Ax -tx1z -v

1+0 records in

1+0 records out

512 bytes (512 B) copied, 4.3617e-05 s, 11.7 MB/s

000000 eb 52 90 4e 54 46 53 20 20 20 20 00 02 08 00 00  >.R.NTFS    .....<

000010 00 00 00 00 00 f8 00 00 3f 00 ff 00 00 88 38 01  >........?.....8.<

000020 00 00 00 00 80 00 80 00 ff bf 26 12 00 00 00 00  >..........&.....<

000030 00 00 0c 00 00 00 00 00 02 00 00 00 00 00 00 00  >................<

000040 f6 00 00 00 01 00 00 00 f9 7f 3d 24 a8 3d 24 a2  >..........=$.=$.<

000050 00 00 00 00 fa 33 c0 8e d0 bc 00 7c fb 68 c0 07  >.....3.....|.h..<

000060 1f 1e 68 66 00 cb 88 16 0e 00 66 81 3e 03 00 4e  >..hf......f.>..N<

000070 54 46 53 75 15 b4 41 bb aa 55 cd 13 72 0c 81 fb  >TFSu..A..U..r...<

000080 55 aa 75 06 f7 c1 01 00 75 03 e9 dd 00 1e 83 ec  >U.u.....u.......<

000090 18 68 1a 00 b4 48 8a 16 0e 00 8b f4 16 1f cd 13  >.h...H..........<

0000a0 9f 83 c4 18 9e 58 1f 72 e1 3b 06 0b 00 75 db a3  >.....X.r.;...u..<

0000b0 0f 00 c1 2e 0f 00 04 1e 5a 33 db b9 00 20 2b c8  >........Z3... +.<

0000c0 66 ff 06 11 00 03 16 0f 00 8e c2 ff 06 16 00 e8  >f...............<

0000d0 4b 00 2b c8 77 ef b8 00 bb cd 1a 66 23 c0 75 2d  >K.+.w......f#.u-<

0000e0 66 81 fb 54 43 50 41 75 24 81 f9 02 01 72 1e 16  >f..TCPAu$....r..<

0000f0 68 07 bb 16 68 70 0e 16 68 09 00 66 53 66 53 66  >h...hp..h..fSfSf<

000100 55 16 16 16 68 b8 01 66 61 0e 07 cd 1a 33 c0 bf  >U...h..fa....3..<

000110 28 10 b9 d8 0f fc f3 aa e9 5f 01 90 90 66 60 1e  >(........_...f`.<

000120 06 66 a1 11 00 66 03 06 1c 00 1e 66 68 00 00 00  >.f...f.....fh...<

000130 00 66 50 06 53 68 01 00 68 10 00 b4 42 8a 16 0e  >.fP.Sh..h...B...<

000140 00 16 1f 8b f4 cd 13 66 59 5b 5a 66 59 66 59 1f  >.......fY[ZfYfY.<

000150 0f 82 16 00 66 ff 06 11 00 03 16 0f 00 8e c2 ff  >....f...........<

000160 0e 16 00 75 bc 07 1f 66 61 c3 a0 f8 01 e8 09 00  >...u...fa.......<

000170 a0 fb 01 e8 03 00 f4 eb fd b4 01 8b f0 ac 3c 00  >..............<.<

000180 74 09 b4 0e bb 07 00 cd 10 eb f2 c3 0d 0a 41 20  >t.............A <

000190 64 69 73 6b 20 72 65 61 64 20 65 72 72 6f 72 20  >disk read error <

0001a0 6f 63 63 75 72 72 65 64 00 0d 0a 42 4f 4f 54 4d  >occurred...BOOTM<

0001b0 47 52 20 69 73 20 6d 69 73 73 69 6e 67 00 0d 0a  >GR is missing...<

0001c0 42 4f 4f 54 4d 47 52 20 69 73 20 63 6f 6d 70 72  >BOOTMGR is compr<

0001d0 65 73 73 65 64 00 0d 0a 50 72 65 73 73 20 43 74  >essed...Press Ct<

0001e0 72 6c 2b 41 6c 74 2b 44 65 6c 20 74 6f 20 72 65  >rl+Alt+Del to re<

0001f0 73 74 61 72 74 0d 0a 00 8c a9 be d6 00 00 55 aa  >start.........U.<

000200
```

^No GRUB code in there.

The boot sector on the /boot partition (sda3) contains:

```
# dd bs=512 count=1 if=/dev/sda3 | od -Ax -tx1z -v

1+0 records in

1+0 records out

512 bytes (512 B) copied, 1.8558e-05 s, 27.6 MB/s

000000 eb 63 90 00 00 00 00 00 00 00 00 00 00 00 00 00  >.c..............<

000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

000020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

000040 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

000050 00 00 00 00 00 00 00 00 00 00 00 80 ca d8 60 13  >..............`.<

000060 00 00 00 00 ff fa 90 90 f6 c2 80 74 05 f6 c2 70  >...........t...p<

000070 74 02 b2 80 ea 79 7c 00 00 31 c0 8e d8 8e d0 bc  >t....y|..1......<

000080 00 20 fb a0 64 7c 3c ff 74 02 88 c2 52 be 80 7d  >. ..d|<.t...R..}<

000090 e8 17 01 be 05 7c b4 41 bb aa 55 cd 13 5a 52 72  >.....|.A..U..ZRr<

0000a0 3d 81 fb 55 aa 75 37 83 e1 01 74 32 31 c0 89 44  >=..U.u7...t21..D<

0000b0 04 40 88 44 ff 89 44 02 c7 04 10 00 66 8b 1e 5c  >.@.D..D.....f..\<

0000c0 7c 66 89 5c 08 66 8b 1e 60 7c 66 89 5c 0c c7 44  >|f.\.f..`|f.\..D<

0000d0 06 00 70 b4 42 cd 13 72 05 bb 00 70 eb 76 b4 08  >..p.B..r...p.v..<

0000e0 cd 13 73 0d f6 c2 80 0f 84 d8 00 be 8b 7d e9 82  >..s..........}..<

0000f0 00 66 0f b6 c6 88 64 ff 40 66 89 44 04 0f b6 d1  >.f....d.@f.D....<

000100 c1 e2 02 88 e8 88 f4 40 89 44 08 0f b6 c2 c0 e8  >.......@.D......<

000110 02 66 89 04 66 a1 60 7c 66 09 c0 75 4e 66 a1 5c  >.f..f.`|f..uNf.\<

000120 7c 66 31 d2 66 f7 34 88 d1 31 d2 66 f7 74 04 3b  >|f1.f.4..1.f.t.;<

000130 44 08 7d 37 fe c1 88 c5 30 c0 c1 e8 02 08 c1 88  >D.}7....0.......<

000140 d0 5a 88 c6 bb 00 70 8e c3 31 db b8 01 02 cd 13  >.Z....p..1......<

000150 72 1e 8c c3 60 1e b9 00 01 8e db 31 f6 bf 00 80  >r...`......1....<

000160 8e c6 fc f3 a5 1f 61 ff 26 5a 7c be 86 7d eb 03  >......a.&Z|..}..<

000170 be 95 7d e8 34 00 be 9a 7d e8 2e 00 cd 18 eb fe  >..}.4...}.......<

000180 47 52 55 42 20 00 47 65 6f 6d 00 48 61 72 64 20  >GRUB .Geom.Hard <

000190 44 69 73 6b 00 52 65 61 64 00 20 45 72 72 6f 72  >Disk.Read. Error<

0001a0 0d 0a 00 bb 01 00 b4 0e cd 10 ac 3c 00 75 f4 c3  >...........<.u..<

0001b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

0001c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

0001d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

0001e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

0001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa  >..............U.<

000200
```

^There is GRUB code in there.

The boot sector on the swap partition (sda5) if it were primary contains:

```
# dd bs=512 count=1 if=/dev/sda5 | od -Ax -tx1z -v

1+0 records in

1+0 records out

512 bytes (512 B) copied, 2.6246e-05 s, 19.5 MB/s

000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

000020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

000040 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

000050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

000060 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

000070 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

000080 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

000090 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

0000a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

0000b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

0000c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

0000d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

0000e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

0000f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

000100 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

000110 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

000120 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

000130 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

000140 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

000150 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

000160 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

000170 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

000180 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

000190 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

0001a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

0001b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

0001c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

0001d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

0001e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

0001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

000200
```

^No GRUB code there, but sda5 is a logical drive, so how do I find the boot sector for that?

The boot sector on the / (root) partition (sda6) if it were primary contains:

```
# dd bs=512 count=1 if=/dev/sda6 | od -Ax -tx1z -v

1+0 records in

1+0 records out

512 bytes (512 B) copied, 1.8057e-05 s, 28.4 MB/s

000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

000020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

000040 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

000050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

000060 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

000070 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

000080 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

000090 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

0000a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

0000b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

0000c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

0000d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

0000e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

0000f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

000100 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

000110 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

000120 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

000130 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

000140 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

000150 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

000160 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

000170 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

000180 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

000190 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

0001a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

0001b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

0001c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

0001d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

0001e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

0001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

000200
```

^No GRUB code there, but sda6 is a logical drive, so how do I find the boot sector for that?

The boot sector on the /home partition (sda7) if it were primary contains:

```
# dd bs=512 count=1 if=/dev/sda7 | od -Ax -tx1z -v

1+0 records in

1+0 records out

512 bytes (512 B) copied, 1.7892e-05 s, 28.6 MB/s

000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

000020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

000040 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

000050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

000060 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

000070 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

000080 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

000090 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

0000a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

0000b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

0000c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

0000d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

0000e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

0000f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

000100 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

000110 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

000120 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

000130 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

000140 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

000150 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

000160 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

000170 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

000180 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

000190 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

0001a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

0001b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

0001c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

0001d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

0001e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

0001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

000200
```

^No GRUB code there, but sda7 is a logical drive, so how do I find the boot sector for that?

I wonder if there is a file somewhere telling GRUB 2 2.00_beta6 to use /boot/grub/ instead of /boot/grub2/ and overriding what I specified in the grub2-install and grub2-mkconfig commands. After all, Fedora, Gentoo, Mandriva and openSUSE use /boot/grub2/ but I think many others use /boot/grub/ for GRUB 2, don't they? And as the ebuild I used for GRUB 2 1.99 was from the Sabayon overlay and used /boot/grub/ then maybe that stored "/boot/grub/" in some file or other that was not overwritten by installing and using GRUB 2 2.00_beta6.

----------

## mv

The reason why I was assuming that your grub-1.99 was installed on the wrong place is the following:

You mentioned that you see "Grub 1.99" in the windows title. But if you would run grub2 you would see something like "Grub ~2beta6".

So since you definitely are running the old grub-1.99, it is not surprising that this old grub uses /etc/grub.

The question is of course why 

```
grub2-install --no-floppy /dev/sda3
```

 does not write grub2 to the first track of sda3 (which should at least have overridden you grub 1.99); so I was conjecturing that grub 1.99 is on a different place than you expect: I can hardly imagine that grub2 reports success without actually having written grub2 (and thus without having "destroyed" your previous grub 1.99) in the first track of sda3.

On the other hand, I have experienced various unexpected bugs with the grub2-beta* series. Maybe grub2-install on beta6 is really buggy and you should try another beta release?

----------

## Fitzcarraldo

I fully understand why you were assuming that GRUB 2 version 1.99 was installed in the wrong place, mv. I understood your line of thinking, which was my own, too. What also perplexes me is that grub2-install --boot-directory=/boot/ --force /dev/sda3 reports success but seemingly fails.

(By the way, according to the documentation for grub2-install for GRUB 2 2.00_beta6, the option "--no-floppy" has been dropped and one now has to use "--allow-floppy" in the converse case.)

The reason I tried version 2.00_beta6 was on the recommendation of Gentoo user and kcm-grub2 developer Konstantinos Smanis (Artemis_Fowl/ksmanis on IRC) who apparently does not experience the problem I'm having, but then I do not know if he is chainloading GRUB 2 from the Windows 7 bootloader as I am.

Which of the GRUB 2 beta versions have you had success with?

```
# eix -I sys-boot/grub

[U] sys-boot/grub

     Available versions:  

        (0)     *0.92-r1 0.94-r1 0.96-r1 0.96-r2 (~)0.96-r3 (~)0.97 0.97-r2 0.97-r3 0.97-r4 0.97-r5 0.97-r6 (~)0.97-r8 0.97-r9 0.97-r10 (~)0.97-r11 (~)0.97-r12

        (2)     (**)1.99-r2 (**)2.00_beta0 (**)2.00_beta1 (**)2.00_beta2 (**)2.00_beta2-r1 (**)2.00_beta3 (**)2.00_beta3-r2 (**)2.00_beta5 (**)2.00_beta6 (**)9999

        {{custom-cflags debug device-mapper efiemu grub_platforms_coreboot grub_platforms_efi-32 grub_platforms_efi-64 grub_platforms_emu grub_platforms_ieee1275 grub_platforms_multiboot grub_platforms_pc grub_platforms_qemu grub_platforms_qemu-mips grub_platforms_yeeloong libzfs mount ncurses netboot nls sdl static truetype}}

     Installed versions:  2.00_beta6(2)(16:15:04 18/06/12)(grub_platforms_pc nls sdl truetype -custom-cflags -debug -device-mapper -efiemu -grub_platforms_coreboot -grub_platforms_efi-32 -grub_platforms_efi-64 -grub_platforms_emu -grub_platforms_ieee1275 -grub_platforms_multiboot -grub_platforms_qemu -grub_platforms_qemu-mips -grub_platforms_yeeloong -libzfs -mount -static)

     Homepage:            http://www.gnu.org/software/grub/

     Description:         GNU GRUB boot loader
```

I have just been doing some more experiments. I deleted /boot/grub/ (well, moved it elsewhere) and deleted /boot/grub2/, un-merged sys-boot/grub, added GRUB_PLATFORMS="pc" to /etc/make.conf, re-installed GRUB 2 2.00_beta6 and ran the grub2-install and greb2-mkconfig commands with the appropriate options. Not entirely surprisingly, the same problem remained and I was left with the GRUB 2 prompt (as the /boot/grub/ directory was no longer present). Anyway, I booted a LiveCD and moved the backed-up directory back to /boot/grub/. Here is what I did:

```
emerge --ask --depclean grub

nano /etc/make.conf

mv /boot/grub /boot/grub-old

chattr -i /boot/grub2/i386-pc/core.img

rm -rf /boot/grub2

emerge -v =grub-2.00_beta6

etc-update

nano /etc/default/grub

grub2-install --boot-directory=/boot/ --force /dev/sda3

cp splash.png /boot/grub2/mybackground.png

grub2-mkconfig -o /boot/grub2/grub.cfg
```

I got the usual messages from the grub2-install command:

```
/usr/sbin/grub2-bios-setup: warning: File system `ext2' doesn't support embedding.

/usr/sbin/grub2-bios-setup: warning: Embedding is not possible.  GRUB can only be installed in this setup by using blocklists.  However, blocklists are UNRELIABLE and their use is discouraged..

Installation finished. No error reported.
```

If I recall correctly, I also saw all the above messages when using GRUB 2 version 1.99, and that worked. Also, Google tells me that the 'ext2' message is seen by other GRUB 2 users and is misinformation from GRUB 2. The "blocklists" message is overcome by using the "--force" option. I've always seen that message with all earlier versions of GRUB 2 I've used, and they still worked.

I also got the usual messages from grub2-mkconfig:

```
Generating grub.cfg ...

Found background: /boot/grub2/mybackground.png

Found linux image: /boot/kernel-genkernel-x86_64-3.3.5-gentoo

Found initrd image: /boot/initramfs-genkernel-x86_64-3.3.5-gentoo

  No volume groups found

Found Windows 7 (loader) on /dev/sda1

Found Windows 7 (loader) on /dev/sda2

done
```

So I'm at a loss. There is one small thing niggling me, though. I would have thought that the Windows BCD file would simply make the Windows 7 bootloader point to the GRUB 2 code in the boot sector of sda3, and have no reference to the /boot/grub/ (or /boot/grub2/) directory. Why would the BCD need to know where is the GRUB 2 sub-directory? I would have thought the GRUB 2 code in the partition's boot sector would be responsible for vectoring to that? However, the EasyBCD developer's Web site appears to hint that EasyBCD does need to know about the GRUB 2 sub-directory name: http://neosmart.net/blog/2011/easybcd-2-1-2-fedora-16-grub2-support-and-bugfixes/

 *Mahmoud Al-Qudsi wrote:*   

> EasyBCD 2.1.2 supports the recently-released Fedora 16, which is the first Fedora Linux version to feature the usage of GRUB2 (instead of the old Legacy GRUB). EasyBCD has supported GRUB2 for years now, but it required the addition of a new profile with the names and paths that Fedora 16 uses.

 

Now it just so happens that Fedora 16 is one of the distributions that uses the same convention as Gentoo for GRUB 2, viz. /boot/grub2/ instead of /boot/grub/, grub2-install instead of grub-install, grub2-mkconfig instead of grub-mkconfig, and so on: https://fedoraproject.org/wiki/Grub2

This is why I downloaded today the latest issue of EasyBCD (2.1.2) and tried that, hoping that it would make a difference from the version (2.0.2) I had used a couple of years ago when I set up dual booting with the Windows 7 bootloader chainloading earlier versions of GRUB 2. So I think my next line of investigation will have to be to post a question on the EasyBCD Support Forum. It's a slim chance, though.

I've never liked GRUB 2.  :Twisted Evil: 

----------

## ppurka

I haven't tried installing grub2, but in grub1 it was more reliable somehow to install from the grub command line, especially when you are installing to a partition and not to an MBR. Does grub2 also have a command line? If so, perhaps you can try that instead of the grub-install command.

----------

## keenblade

 *Fitzcarraldo wrote:*   

> ...
> 
> Any ideas what I could try in order to get GRUB 2 2.00_beta6 working correctly? GRUB 2 1.99 was working perfectly using /boot/grub/, so why doesn't GRUB 2 2.00_beta6 use /boot/grub2/? Thanks in advance for any help.

 

Fitzcarraldo, it s exactly the same here. It seems gentoo grub2 is hard-coded to use /boot/grub/, maybe some gentoo devs would like to comment on that.

----------

## ppurka

 *keenblade wrote:*   

>  *Fitzcarraldo wrote:*   ...
> 
> Any ideas what I could try in order to get GRUB 2 2.00_beta6 working correctly? GRUB 2 1.99 was working perfectly using /boot/grub/, so why doesn't GRUB 2 2.00_beta6 use /boot/grub2/? Thanks in advance for any help. 
> 
> Fitzcarraldo, it s exactly the same here. It seems gentoo grub2 is hard-coded to use /boot/grub/, maybe some gentoo devs would like to comment on that.

 It doesn't look like that. See the src_configure() in the ebuild

```
   econf \

      --disable-werror \

      --program-prefix= \

      --program-transform-name="s,grub,grub2," \

      --with-grubdir=grub2 \
```

----------

## mv

 *ppurka wrote:*   

> Does grub2 also have a command line?

 

Not in the sense that you mean: There is a command line when you booted it, but there is no boot executable which you could run. AFAIK the only tool to write grub into the first track is the grub2-install script (which presumably does the installation with "dd" - I have never looked at this very lengthy script in detail). Probably it is necessary in this case to look really what this script does (or should do...).

----------

## Fitzcarraldo

I decided to check whether or not grub2-install (2.00_beta6) actually writes to the boot sector of the partition. To do this I used wxHexEditor to change slightly the contents of the boot sector of sda3. I changed one byte in "GRUB .Geom.Hard" to become "GRUB .GEom.Hard". I then ran grub2-install to see if it would overwrite or not the boot sector. Below I give the results of the experiment.

After making the change to the boot sector using wxHexEditor, I checked the boot sector of sda3 to make sure it indeed had been changed:

```
# dd bs=512 count=1 if=/dev/sda3 | od -Ax -tx1z -v 

1+0 records in

1+0 records out

512 bytes (512 B) copied, 0.0282431 s, 18.1 kB/s

000000 eb 63 90 00 00 00 00 00 00 00 00 00 00 00 00 00  >.c..............<

000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

000020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

000040 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

000050 00 00 00 00 00 00 00 00 00 00 00 80 ca d2 5f 13  >.............._.<

000060 00 00 00 00 ff fa 90 90 f6 c2 80 74 05 f6 c2 70  >...........t...p<

000070 74 02 b2 80 ea 79 7c 00 00 31 c0 8e d8 8e d0 bc  >t....y|..1......<

000080 00 20 fb a0 64 7c 3c ff 74 02 88 c2 52 be 80 7d  >. ..d|<.t...R..}<

000090 e8 17 01 be 05 7c b4 41 bb aa 55 cd 13 5a 52 72  >.....|.A..U..ZRr<

0000a0 3d 81 fb 55 aa 75 37 83 e1 01 74 32 31 c0 89 44  >=..U.u7...t21..D<

0000b0 04 40 88 44 ff 89 44 02 c7 04 10 00 66 8b 1e 5c  >.@.D..D.....f..\<

0000c0 7c 66 89 5c 08 66 8b 1e 60 7c 66 89 5c 0c c7 44  >|f.\.f..`|f.\..D<

0000d0 06 00 70 b4 42 cd 13 72 05 bb 00 70 eb 76 b4 08  >..p.B..r...p.v..<

0000e0 cd 13 73 0d f6 c2 80 0f 84 d8 00 be 8b 7d e9 82  >..s..........}..<

0000f0 00 66 0f b6 c6 88 64 ff 40 66 89 44 04 0f b6 d1  >.f....d.@f.D....<

000100 c1 e2 02 88 e8 88 f4 40 89 44 08 0f b6 c2 c0 e8  >.......@.D......<

000110 02 66 89 04 66 a1 60 7c 66 09 c0 75 4e 66 a1 5c  >.f..f.`|f..uNf.\<

000120 7c 66 31 d2 66 f7 34 88 d1 31 d2 66 f7 74 04 3b  >|f1.f.4..1.f.t.;<

000130 44 08 7d 37 fe c1 88 c5 30 c0 c1 e8 02 08 c1 88  >D.}7....0.......<

000140 d0 5a 88 c6 bb 00 70 8e c3 31 db b8 01 02 cd 13  >.Z....p..1......<

000150 72 1e 8c c3 60 1e b9 00 01 8e db 31 f6 bf 00 80  >r...`......1....<

000160 8e c6 fc f3 a5 1f 61 ff 26 5a 7c be 86 7d eb 03  >......a.&Z|..}..<

000170 be 95 7d e8 34 00 be 9a 7d e8 2e 00 cd 18 eb fe  >..}.4...}.......<

000180 47 52 55 42 20 00 47 45 6f 6d 00 48 61 72 64 20  >GRUB .GEom.Hard <

000190 44 69 73 6b 00 52 65 61 64 00 20 45 72 72 6f 72  >Disk.Read. Error<

0001a0 0d 0a 00 bb 01 00 b4 0e cd 10 ac 3c 00 75 f4 c3  >...........<.u..<

0001b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

0001c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

0001d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

0001e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

0001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa  >..............U.<

000200

#
```

As you can see above, the boot sector had indeed been edited by me.

Then I ran grub2-install:

```
# grub2-install --boot-directory=/boot/ --force /dev/sda3

rm: cannot remove ‘/boot/grub2/i386-pc/core.img’: Operation not permitted

# chattr -i /boot/grub2/i386-pc/core.img

# grub2-install --boot-directory=/boot/ --force /dev/sda3 

/usr/sbin/grub2-bios-setup: warning: File system `ext2' doesn't support embedding.

/usr/sbin/grub2-bios-setup: warning: Embedding is not possible.  GRUB can only be installed in this setup by using blocklists.  However, blocklists are UNRELIABLE and their use is discouraged..

Installation finished. No error reported.
```

Then I checked again the contents of the boot sector of sda3:

```
# dd bs=512 count=1 if=/dev/sda3 | od -Ax -tx1z -v 

1+0 records in

1+0 records out

512 bytes (512 B) copied, 3.0967e-05 s, 16.5 MB/s

000000 eb 63 90 00 00 00 00 00 00 00 00 00 00 00 00 00  >.c..............<

000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

000020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

000040 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

000050 00 00 00 00 00 00 00 00 00 00 00 80 4a c7 60 13  >............J.`.<

000060 00 00 00 00 ff fa 90 90 f6 c2 80 74 05 f6 c2 70  >...........t...p<

000070 74 02 b2 80 ea 79 7c 00 00 31 c0 8e d8 8e d0 bc  >t....y|..1......<

000080 00 20 fb a0 64 7c 3c ff 74 02 88 c2 52 be 80 7d  >. ..d|<.t...R..}<

000090 e8 17 01 be 05 7c b4 41 bb aa 55 cd 13 5a 52 72  >.....|.A..U..ZRr<

0000a0 3d 81 fb 55 aa 75 37 83 e1 01 74 32 31 c0 89 44  >=..U.u7...t21..D<

0000b0 04 40 88 44 ff 89 44 02 c7 04 10 00 66 8b 1e 5c  >.@.D..D.....f..\<

0000c0 7c 66 89 5c 08 66 8b 1e 60 7c 66 89 5c 0c c7 44  >|f.\.f..`|f.\..D<

0000d0 06 00 70 b4 42 cd 13 72 05 bb 00 70 eb 76 b4 08  >..p.B..r...p.v..<

0000e0 cd 13 73 0d f6 c2 80 0f 84 d8 00 be 8b 7d e9 82  >..s..........}..<

0000f0 00 66 0f b6 c6 88 64 ff 40 66 89 44 04 0f b6 d1  >.f....d.@f.D....<

000100 c1 e2 02 88 e8 88 f4 40 89 44 08 0f b6 c2 c0 e8  >.......@.D......<

000110 02 66 89 04 66 a1 60 7c 66 09 c0 75 4e 66 a1 5c  >.f..f.`|f..uNf.\<

000120 7c 66 31 d2 66 f7 34 88 d1 31 d2 66 f7 74 04 3b  >|f1.f.4..1.f.t.;<

000130 44 08 7d 37 fe c1 88 c5 30 c0 c1 e8 02 08 c1 88  >D.}7....0.......<

000140 d0 5a 88 c6 bb 00 70 8e c3 31 db b8 01 02 cd 13  >.Z....p..1......<

000150 72 1e 8c c3 60 1e b9 00 01 8e db 31 f6 bf 00 80  >r...`......1....<

000160 8e c6 fc f3 a5 1f 61 ff 26 5a 7c be 86 7d eb 03  >......a.&Z|..}..<

000170 be 95 7d e8 34 00 be 9a 7d e8 2e 00 cd 18 eb fe  >..}.4...}.......<

000180 47 52 55 42 20 00 47 65 6f 6d 00 48 61 72 64 20  >GRUB .Geom.Hard <

000190 44 69 73 6b 00 52 65 61 64 00 20 45 72 72 6f 72  >Disk.Read. Error<

0001a0 0d 0a 00 bb 01 00 b4 0e cd 10 ac 3c 00 75 f4 c3  >...........<.u..<

0001b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

0001c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

0001d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

0001e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  >................<

0001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa  >..............U.<

000200

#
```

As you can see above, the "E" was overwritten back to "e" in the boot sector of sda3. So grub2-install is writing to the boot sector of sda3.

So why is the freshly-created GRUB 2 code in the boot sector apparently vectoring to /boot/grub/core.img instead of /boot/grub2/i386-pc/core.img? Bug in GRUB 2 2.00_beta6? Bug in the Gentoo ebuild or its patch files?

EDIT: I have also now posted a query in the EasyBCD forum about this problem: GRUB 2 wrongly using /boot/grub/ instead of /boot/grub2/. I still think the problem has nothing to do with EasyBCD, but I just need to be sure.

----------

## Fitzcarraldo

Some more information. I ran Boot Info Script and got the following report:

```
                  Boot Info Script 0.61      [1 April 2012]

============================= Boot Info Summary: ===============================

 => Windows is installed in the MBR of /dev/sda.

sda1: 

----------

## keenblade

 *ppurka wrote:*   

>  *keenblade wrote:*    *Fitzcarraldo wrote:*   ...
> 
> Any ideas what I could try in order to get GRUB 2 2.00_beta6 working correctly? GRUB 2 1.99 was working perfectly using /boot/grub/, so why doesn't GRUB 2 2.00_beta6 use /boot/grub2/? Thanks in advance for any help. 
> 
> Fitzcarraldo, it s exactly the same here. It seems gentoo grub2 is hard-coded to use /boot/grub/, maybe some gentoo devs would like to comment on that. It doesn't look like that. See the src_configure() in the ebuild
> ...

 

Thanks for pointing that out. The ebuild seems right. But grub2 always used /boot/grub/ and never ever used /boot/grub2/ in my ~arch gentoo. That's why I think, it is hard-coded in the source level.

----------

## floppymaster

Can you run grub2-install --debug --force /dev/sda3 and upload the output somewhere? Don't paste it here; it will be massive.

----------

## Fitzcarraldo

floppymaster, I've pasted the output at: http://gentoo.pastebin.ca/2163511

----------

## Fitzcarraldo

I've received a reply from the developer of EasyBCD:

 *Mahmoud Al-Qudsi wrote:*   

> EasyBCD has two modes of operation, one which gets the GRUB info from the bootloader but does not work if Linux is on a different physical drive, and the other where it actually searches for and manually loads GRUB(2).
> 
> From your description, I'm assuming you select "GRUB2" from the drop-down. This mode searches for GRUB2 in a number of different directories. We currently search for /grub before /grub2 - and there has never been a distro to our knowledge (until you just posted this) that had both the /grub *and* the /grub2 directories.
> 
> I can play around with it some and see if there's a fix. I think simply reversing the search order (/grub2 before /grub) should do the trick..

 

EasyBCD can be used to set up the BCD if installing Linux on a machine with Windows already installed, and it can be used to set up the BCD if installing Windows on a machine with Linux already installed (http://neosmart.net/wiki/display/EBCD/Linux). In my case, Windows was already installed by the OEM, and I installed Linux later. If I understand correctly what the EasyBCD developer is saying above, EasyBCD searches for core.img in Linux directories, and starts by looking in /boot/grub/. If it finds core.img, it configures the BCD to vector straight to that, so the Windows bootloader would vector straight to /boot/grub/core.img. If I do understand correctly, that would explain why, even though grub2-install is writing to the boot sector of sda3, the contents of sda3 are apparently being ignored. I could be completely misinterpreting what he has written, but that's how it reads to my inexpert eyes.

----------

## floppymaster

Yes, he seems to indicate that EasyBCD is ignoring the boot sector and searching the file system.

----------

## Fitzcarraldo

I tried the following experiment just now, to see if the lack of /boot/grub/ would enable EasyBCD to find /boot/grub2/i386-pc/core.img:

1. Rename /boot/grub/ to /boot/grub-old/

2. Boot into Windows and run EasyBCD to create a new BCD.

3. Reboot and select Linux from the Windows bootloader's menu.

It didn't make any difference. I had to boot a LiveCD, rename /boot/grub-old/ back to to /boot/grub/ and reboot. Whatever I do, something requires that the file /boot/grub/core.img must be there.

Does the debug output for grub2-install (2.00_beta6) look correct, floppymaster?

----------

## floppymaster

It seems to be creating a block list to load the correct image.

```
/usr/sbin/grub2-bios-setup: info: setting the root device to `hostdisk//dev/sda,msdos3'.

/usr/sbin/grub2-bios-setup: warning: File system `ext2' doesn't support embedding.

/usr/sbin/grub2-bios-setup: warning: Embedding is not possible.  GRUB can only be installed in this setup by using blocklists.  However, blocklists are UNRELIABLE and their use is discouraged..

/usr/sbin/grub2-bios-setup: info: will leave the core image on the filesystem.

/usr/sbin/grub2-bios-setup: info: opening the core image `/boot/grub2/i386-pc/core.img'.

/usr/sbin/grub2-bios-setup: info: the first sector is <325192010,0,512>.
```

I guess it could be lying; there might be a way to verify the sector of core.img and the value(s) in the boot sector.

----------

## Fitzcarraldo

On re-reading the reply from the EasyBCD developer, I had a brainwave.   :Idea: 

He wrote that EasyBCD has two modes of operation, one of which "gets the GRUB info from the bootloader" (I assume by 'bootloader' he means the GRUB code in the boot sector), whereas the other "actually searches for and manually loads GRUB(2)". He also wrote that he assumed I selected "GRUB2" from the drop-down menu in EasyBCD.

What he wrote seemed to imply that:

a) If you were to select 'GRUB2' from the drop-down menu, EasyBCD would look for core.img in some sub-directories in /boot/ and set up the BCD to point to the first instance of the file core.img that it finds.

b) If you were to select 'GRUB Legacy' from the drop-down menu, and then specify the partition, EasyBCD would set up the BCD to point to the boot sector of the partition you specified. The assumption being that that boot sector contains GRUB Legacy code which then vectors to the GRUB Legacy Stage 2 file in the /boot/grub/ directory.

But this got me thinking. What if I were to select 'GRUB Legacy' in the EasyBCD menu in order to make EasyBCD create a BCD that points to the sda3 boot sector? If grub2-install (2.00_beta6) had indeed written code into the boot sector, and that code vectors to /boot/grub2/i386-pc/core.img, then it should be executed, shouldn't it?

So I booted into Windows, ran EasyBCD, deleted the Linux entry in the menu and clicked on the tab to create a new entry for Linux. But this time, rather than selecting 'GRUB2' from the drop-down menu, I selected 'GRUB Legacy' and specified sda3 as the partition on which GRUB is located. I saved this to the BCD and then rebooted.

This time, when I selected Linux from the Windows bootloader menu, up popped the GRUB 2 2.00_beta6 menu with the background PNG that I put in /boot/grub2/ and which is different to the background PNG in /boot/grub/.

The fact that the GRUB 2 boot menu is labelled 2.00_beta6 and that the background is in /boot/grub2/ tells me that the newly created BCD does indeed point to the sda3 boot sector, and that the sda3 boot sector (created by the grub2-install script of GRUB 2 version 2.00_beta6) does appear to be executing /boot/grub2/i386-pc/core.img.

So, in summary:

1. GRUB2 2.00_beta6 is not the cause of the problem, EasyBCD is the cause of the problem and there is a workaround (at least there is if the partition is on the same drive as Windows).

2. My laptop is now using GRUB 2 2.00_beta6.

I think I could now safely delete /boot/grub/.

I'll relay this latest result back to the EasyBCD developer, but I suppose it won't surprise him. Anyway, when he releases a new version of EasyBCD with a fix to cater for a Linux installation having both /boot/grub/ and /boot/grub2/ with a core.img in them, I'll give that a try to see if it works as intended.

Good grief. What a palaver to get to the bottom of this.  :Very Happy:  I suppose at least I have learned more about how GRUB 2 works, but have wasted a lot of time in the process.

"Thank you" to all of you who posted in this thread.

----------

## Fitzcarraldo

Postscript: The EasyBCD developer has fixed EasyBCD a) to cater for core.img being in /boot/grub2/i386-pc/ and b) to look in /boot/grub2/ before looking in /boot/grub/. The version with the fix, EasyBCD 2.2 Beta - Build 179.exe, can be downloaded from [FIXED] [EBCD-505] GRUB 2 wrongly using /boot/grub/ instead of /boot/grub2/. It works!

----------

