Kubuntu 4.11: GRUB2 and multiple Windows installations

Versione Italiana

When I <a title="Kubuntu 4.11: the first impression ... shocking!" href="/2011-06-13-kubuntu-4-11-prima-impressione-sconvolgente.html>installed Kubuntu 4.11 on my Toshiba Qosmio</a> one of the few problems encountered was the boot. It took me a long time (from “antiguru” as they are) to refine the mechanism to have two completely independent of Windows installations, one for work and one for leisure. Not wanting to even the boot partition of a system was seen at the other, the only solution that I could take a boot loader that had a partition active and hide the other. To do this I used an oldboot manager opensource called Smart Boot Manager , it is a draft dated and aesthetically uninspiring, but extremely effective. In fact it is so small that you install only the master boot record of hard disk and do the operations that were necessary to me. But when I installed Kubuntu I said, it is possible that a boot loader such as GRUB is unable to hide a partition! So I let GRUB to the MBR of the disk is, as he also correctly recognized the two installations of Windows. As expected, however, both do not start with a beautiful “blue screen of death”. Do not panic and a little ‘research. Found this article I thought I had the jackpot, but unfortunately I soon realized that the version 4.11 uses GRUB2 , whose command syntax is completely different from previous versions. Another googling: GRUB Manual . This time really bingo. There’s even a little paragraph that seems made ​​for my specific case. The key to this game is small sequence of instructions.

parttool (hd0,1) hidden-
     parttool (hd0,2) hidden+
     set root=(hd0,1)
     chainloader +1
     parttool ${root} boot+
     boot

After having tested the command line and verified that it works, provides the transaction. Here are the (few) details.

WARNING: If you decide to do the same operation, make sure to have a backup of the original files before continuing. If something goes wrong,  your PC may be *UNBOOTABLE* either from  Windows or from Linux!

As usual for this I tried to find a complicated way, while the solution was simple. There is no need to maneuver or other console, just edit a text file while taking care (yes) to maintain unchanged the syntax.

1. Look for the file

/boot/grub/grub.conf

and make a copy. I called

grub.conf.ORIGINAL

2. Launch your favorite editor, I used Kate. To avoid surprises, I opened a Konsole and use the command

sudo kate

(To make sure you can then save the file) and open the file:

/boot/grub/grub.conf

3. Look for the section that first start Windows, which to me looked like this:

menuentry "Windows XP Media Center Edition (on /dev/sda1)" --class windows --class os {
	insmod part_msdos
	insmod ntfs
	set root='(/dev/sda,msdos1)'
	search --no-floppy --fs-uuid --set=root 6638F37738F34519
	drivemap -s (hd0) ${root}
	chainloader +1
}

4. Replace it with these instructions, clearly “inspired” to those contained in the manual GRUB2:

menuentry "Win@Home - Windows XP Media Center Edition (on /dev/sda1)" --class windows --class os {
	parttool (hd0,1) hidden-
	parttool (hd0,2) hidden+
	set root=(hd0,1)
	chainloader +1
	parttool ${root} boot+
}

Be careful not to confuse the section opens with a clip at the end of the line menuentry and closed with a staple “lonely”.

5. Repeat for the other section, remembering that this time the partition hd0, 1 and hd0, 2 are exchanged: the 1 is hidden (hidden +) and 2 turns out (hidden-) and active (set root).

Save everything and reboot.

You’re done.

While I was there I made two small changes useful in my case: it is said to serve to you, but now that I have come this far, might as well say a few more lines, no? :-)


To change the default called GRUB (I put the Windows Home, so that if someone else in the family needs the PC is in an environment familiar to him than …) I changed the line

set default = "0"

in

set default = "4"

This makes the fifth choice to start automatically (the numbering starts at 0, then the fifth choice is the number 4!)


Finally I added the command:

parttool (hd0,1) hidden-
	parttool (hd0,2) hidden-

to the normal boot Linux so that the two partitions of Windows systems were “discovered” and therefore visible from within Linux.


Now I think it’s everything. The next solution!


grub.cfg.ORIGINAL | <a title="grub.cfg" href="/uploads/2011/06/grub.cfg_.txt>grub.cfg</a> | Partitions

This is a Google automatic translation. Something more refined may come one day…