Great stuff. Fascinating. Makes me want to run out and buy a few big hard-drives.
Slackware gives you a choice of where to put the bootloader. Not sure (can't remember), but I don't think Ubuntu does.
I would say out of 100 distros there may be 3 to 5 of them only permit the boot loader to be installed in the MBR and nowhere else. The big majority always allow its boot loader to be installed into its root partition and that include Ubuntu too but you have to look out for it because it is hidden under "advance" or "Advance boot loader option".
When a Linux has the boot loader inside its root partition it cannot be booted by itself but must be booted by the boot loader controlling the MBR.
I recommend chainloading before you don't have to worried about what boot loader is inside. Grub, Lilo, NTLDR (xp), bootmgr (Vista), etc, etc are all booted identically by command in grub
Code:
title OS in (hd0,6)
root (hd0,6)
chaonloader +1
If you use Lilo in the MBR the same (assuming (hd0,6) is sda7) applies
Code:
other=/dev/sda7
label=System_in_sda7
That is all one needs from booting the 2nd to 200th operating systems by changing just the booting partition reference. Lilo's has a static screen and objects to more than 27 images after the screen is completely filled. For MS systems (Solaris and most BSD too) you have to be aware of their characteristics and ask Grub or Lilo to do extra work to keep them happy.
People in Justlinux has taught me that I can keep every operating system I install and I can have as many as I want. Currently sky is the limit.
I typed (hd0,6) for the 7th partition of the 1st disk. Grub counts from 0.
In any case you can choose to do it before rebooting after the installation by
say you have made a msitake to let Ubuntu overwrite the MBR and your original Linux that controls the MBR is in (hd0,2) you can restore the original Grub (while you are still inside the Ubuntu boot up Live CD and is about to reboot to try the newly installed Ubuntu) at the terminal by command
Code:
sudo su
grub
root (hd0,2)
setup (hd0)
At this point if you want the newly installed Ubuntu, say in (hd0,6) which accidentally put Grub into the MBR, to have Grub inside its root partition you continue to type
Code:
root (hd0,6)
setup (hd0,6)
Piece of cake, isn't it?
If Ubuntu has nuked away a Lilo (and not Grub in the above example) in the MBR and you want your Lilo back, easy piece, just follow Task B3 of the "Just Booting tips".
The "root (hd0,6)" is to tell Grub the root filing system is in the 7th partition of the 1st disk. Grub counts from 0 so 1st disk is (hd0), 2nd disk (hd1) etc. For a partition we add a second digit. So 1st partition of 1st disk is (hd0,0). The 15th partition of the 2nd disk is (hd1,14).
The "root" command tells Grub which partition of which disk holds the operating system you wish to boot.
The "setup (hd0,6)" tells Grub to set up itself in (hd0,6). Since (hd0,6) is a partition therefore Grub will set up itself in the boot sector of the partition "formally", or in other word you install Grub in the root partition of (hd0,6).
When the partition number is missing Grub will say "Ah you want me to set up myself in the whole of disk (hd0) the only logical position is the MBR".
Grub can execute the above instructions as long as there is a /boot/grub directory in the root partition and inside it there is a set of Grub system files. The fact that you can invoke a Grub shell means all the necessary Grub systems will be there.
An example in a Grub shell
Code:
grub> root (hd0,13)
Filesystem type is ext2fs, partition type 0x83
grub> setup (hd0,13)
Checking if "/boot/grub/stage1" exists... yes
Checking if "/boot/grub/stage2" exists... yes
Checking if "/boot/grub/e2fs_stage1_5" exists... yes
Running "embed /boot/grub/e2fs_stage1_5 (hd0,13)"... failed (this is not fatal
)
Running "embed /boot/grub/e2fs_stage1_5 (hd0,13)"... failed (this is not fatal
)
Running "install /boot/grub/stage1 (hd0,13) /boot/grub/stage2 p /boot/grub/men
u.lst "... succeeded
Done.
grub>
Outside the Grub shell my /boot/grub has these files inside
The files used by Grub to setup itself are coloured in red, pink and orange. The blue bits are the commands you have to enter.
For Red Hat distros, like Fedora, Grub's "root" command should be pointing to the /boot directory because a normal installation of this Linux is in multiple partitions involving possible a LVM too.
I installed a new linux on a new HD, installed boot loader to MBR (hd0). Then i put back my original boot loader from hd0,0 to hd0. So grub loads up and i have the option i created to boot the new linux (chainload). But it fails, i was getting grub 18 error, but now it just says GRUB with a flashing cursor, and u cant do anything.....
So i then configured grub to boot it directly, and it works! But i dont understand why i cant chainload it. Any idea to fix this?
Hmmmm.... I am almost 100 percent sure that i had .97 in the MBR to begin with. And i assume that the grub on the UBUNTU live CD is .97 also.
Actually, i do remember a difference. One of them tells you the partition type, but the other one does not.... HMMM, i guess i will have to check again.
Thanks for the great post, i learn a lot of things!
Now i start to explain my grub problem:
I have a notebook(hp 6710s) with vista, and i would install Gentoo Linux from the minimal cd. The problem is hd that is pre-partitioned from hp: the first primary partition is for Vista, i resized it to make space for linux; the second primary partition is for restore; the third partition is for hp's tools.
So, I create a logical partition that is partitioned for swap, /boot, /
Most important thing is that i can't install grub into MBR because is modded from hp and if i erase it i can't restore Vista anymore (and this is a great problem because i don't have rescues cd and the restore partition is locked, so i can't make a install cd with vLite).
During Gentoo's installation when i install grub with the commands:
Code:
(chroot) Livecd #grub
grub> root (hd0,5)
Filesystem type is ext2fs, partition type 0x83
grub> setup (hd0,5)
Checking if "/boot/grub/stage1" exists... yes
Checking if "/boot/grub/stage2" exists... yes
Checking if "/boot/grub/e2fs_stage1_5" exists... yes
Running "embed /boot/grub/e2fs_stage1_5 (hd0,5)"... failed (this is not fatal
)
Running "embed /boot/grub/e2fs_stage1_5 (hd0,5)"... failed (this is not fatal
)
Running "install /boot/grub/stage1 (hd0,5) /boot/grub/stage2 p /boot/grub/menu.lst "... succeeded
Done.
grub>quit
In my fstab file:
/dev/sda6 is the /boot partition (ext2)
/dev/sda5 is swap partition
/dev/sda7 is / partition (reiserfs)
This is my grub.conf:
Code:
# Quale opzione viene avviata in modo predefinito. 0 è la prima, 1 la seconda, ecc.
default 0
# Quanti secondi attendere prima di avviare l'opzione predefinita.
timeout 30
# Un'immagine gradevole
# Da commentare se non si dispone di scheda grafica
splashimage=(hd0,5)/boot/grub/splash.xpm.gz
title=Gentoo Linux 2.6.22-r9
# La partizione dove si trova l'immagine del kernel (o il sistema operativo)
root (hd0,5)
kernel /boot/kernel-2.6.22-gentoo-r9 root=/dev/sda7
title=Gentoo Linux 2.6.22-r9 (rescue)
# Partizione dove si trova l'immagine del kernel o il sistema operativo
root (hd0,0)
kernel /boot/kernel-2.6.22-gentoo-r9 root=/dev/sda7 init=/bin/bb
# Le prossime tre righe vanno messe solo se si ha un dualboot con Windows.
# In questo caso, Windows è in /dev/hda6.
title=Windows Vista Home Premium
rootnoverify (hd0,0)
makeactive
chainloader +1
After grub installation i reboot, but automatically start Vista without grub's prompt!
Then i have copied GentooBoot.bin in C:\
Now i'm trying to use vista bootloader to add a menu item and load the boot sector; the syntax is something like this:
DOH! I have spent a lot of time on reading Microsoft' documentation when the perfect solution was under my eyes!
Doesn't matter, i have learned how vista bootmanager work! :-D
Thanks for your guides, they are very usefull!
The only difference from the guide is that as device i put C: instead boot, but now i have corretted the command and i try to reboot another time!
Bookmarks