Most grub documentation is difficult for those not familiar with grub. Grub from the ground up is different.
It starts by discussing the relationships between the partition containing the kernel (the grub root partition), the partition containing /sbin/init (the Linux root partition), and the grub commands to boot based on those partitions, the kernel filename and location, and possibly the initrd filename and location.
It guides the reader through making a simple grub floppy capable of booting a Linux box, and using that floppy to bust back into a locked system. It then guides the reader in making a grub boot floppy with separate stage1 and stage2 files, and using that floppy to install a minimal grub bootloader on a Linux system, even if that system never had grub before.
Finally, it reveals some tricks and tips for a system with grub installed, including how to make a simple grub menu file.
GRUB being the best boot manager Ive ever used, Im glad to see anything that lowers the barrier to entry. It is not at all intuitive to figure out.
I’m a grub fan too.
The best thing for me is being able to hit ‘e’ to edit the entry. It’s invaluable if you get the bios (0,0) drives and hda/hdb numbering wrong, which I inevitably do.
I don’t think that was covered in the article.
I’ve been wanting to try Grub instead of Lilo for a while. For one reason, it doesn’t require several different x86 assemblers to compile (unlike Lilo). Recently, ’emerged’ Grub 0.94 on my current Gentoo install. Unfortunately, I couldn’t get it to work, it seemed to have a non-solvable issue with the BIOS in my computer. Okay, I can dig that, but: Lilo doesn’t have a problem here, on same computer, same BIOS. So it’s definitely Grub that fails to deliver in my case.
Anyway, I know from experience through countless OS installs, that the partitioning, and bootloader configure/install are THE hardest/critical points. The most difficult to do/understand for newbies, and even for seasoned tinkerers, the one point where it’s very easy to go from ‘next!’ to ‘…oh shit!’
Solid documentation is crucial here. A piece like the above is very nice, but: the Grub developers should have written it. Or at least their documentation should be good enough to make the above redundant. If it’s better/easier to understand than included materials, maybe they can put this in distribution tarballs?
General note to coders: document things first, then write code that does what’s documented, please? Not the other way round.
Nice article, really wish there was a document like that when I first fiddled around with Grub (god four, five years ago I think – I managed to nuke things on my home box with Lilo and decided it was time for a change).
Two caveats, although it would be nice to think that no one has windows on their machines, unfortunately people do, and for an os like Solaris there are some different configs required as well. Examples of both of these would have been nice is the above article, but they exist elsewhere anyway.
Theres a pretty detailed doc on this, around setting up a quad boot box using Grub (example uses 1 Solaris x86, 2 Linux and 1 Windows partition) at http://www.sun.com/bigadmin/content/submitted/quad_boot.html?biga=1…
Anyway as I said, nice write up, Grub rocks.
I must admit Grub is definatly better than Lilo. Just for the fact you can edit the menu without having to re-install Grub unlike Lilo…
Is there a way to boot single user from grub?
just like memdisk, grub for dos can simulate a bootable dos floppy or bootable win98 hd image with a truncature of memory. NT/XPers can boot to GRUB cool-directly with a boot.ini line C:GRLDR=”GRUB”. look here for more: http://newdos.yginfo.net/grubdos.htm
Is it possible to install grub on a disk with 2 Windows partitions?
/dev/hda1 – Windows XP
/dev/hda2 – Windows Server 2003
/dev/hda3 – Red Hat Enterprise Linux 4
What do you think Grub is supposed to do?
By the way: I can install anything on a disk with partitions, just not sure if you will have the partitions afterwards :p.
Yes it is with a bit of care.
1) Install the windows things first. They will write all over any Linux MBR thus nuking any GRUB bootloader previously installed.
2) When you install RHEL, it will find the Windows Partitions and add an entry to the GRUB.CONF file using the “chainloader” option.
This chains the boot into the boot info that Windows puts into the partion MBR (not the disk MBR). This will then boot up windows and you get the options in boot.ini presented.
If you have linux already installed then installing windows will destroy your MBR. So, you will have to boot the Rescue CD and then switch into the linx system and re-write the disk MBR.
On an aside note…
It is a real shame that the BIOS of X86 systems won’t let you select the actual partition you want to boot from. This facility hase been around for years on other system like Alpha, VAX, Sparc etc. This would save all this faffing around.
edit the kernel line and add the word single, e.g.
linux single root=/dev/xxx…
Does anyone know why Q-T Parted just DOES NOT WORK>? Yet CFDISK, that old trusty dinosaur does?
Just dump your Unix-OSes and install a single real OS – Windows. Then you won’t have to worry bout grub!
Kind of defeats the purpose of being able to boot into a specific operating system on the same system that the user might need to use doesn’t it?
While I’m at it, might I add that Microsoft’s “boot manager” really stinks compared to Lilo or Grub as it really isn’t designed for non-Microsoft OSes. Yes, it works but not well.
“Luke, I am your operating system.” — Darth Linux
You can add a menu entry for single user mode, as Mike outlined. Or you can use the GRUB edit command, which is fine for rarely used options. Note that the edits are NOT saved – this is a one-time change.
Select the menu item that you want to modify, and press ‘e’. That will show the commands normally executed by that menu item. Move the cursor to the command that you want to change, and make your edits.
For example, here’s part of my grub.conf:
title Ubuntu
root (hd0,1)
kernel /boot/vmlinuz-2.6.8.1-2-386 ro root=/dev/hda2
initrd /boot/initrd.img-2.6.8.1-2-386
To boot to single user mode, I add <sp> ‘S’ to the end of the ‘kernel’ line. Or I add ‘3’ instead of my default ‘5’ to bring it up without X. There are many other kernel parameters which be helpful when dealing with fussy hardware or debugging.
I like the fact that I can make a one-time change without touching the configuration file. You won’t use the interactive features of GRUB every day, but power users will find that they are worth learning.
“The virtualization tasks Xen and its rivals must accomplish are expected to become easier with the arrival of new processor support from Intel in 2005 and Advanced Micro Devices in 2006”
Try these for a start –
http://www.theinquirer.net/?article=21448
http://www.theinquirer.net/?article=21268