Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
By runlevel0 at 2005-06-21 07:44
Grub is very powerful, but amazingly easy to use. It's indeed more difficult to understand the 'userfriendly' GUIs than doing things the good ol' way, as it was when men where men, women where women and DVD-ROMS where made of stone.
There's just some little concepts you need to know and with this knowledge and the fine man pages you will be able to adapt this tutorial to any situation, from an USB stick to SATA or SCSI disks. But to keep things simply I will only show how to do it on plain vanilla IDE drives.
Before we start: How Grub Calls Stuff
This is the only odd thing in grub: It doesn't call the disks as we are used to. But don't worry, is not as weird as with devfs (/dev/boo/lun/foo/bar/../../disk/stuff/.../.../and/so/on).
It's only a bit different:
Grub uses brackets to declare a device
The /dev/ part is not used
device numbers and partitions are defined with numbers starting from 0
This example will show you how it works (It's easier to understand as it is to explain):
Linux standard GRUB
-----------------------------------
/dev/hda1 (hd0,0)
/dev/hda2 (hd0,1)
/dev/hdd1 (hd3,0)
Even Easier : a=0 b=1 c=2 d=3 and the partition is N-1 ... hat's all.
Now let's do some serious work
After learning how grub calls stuff, we are going to set up grub from the command line.
This is very useful as you can use it to fix grub even from the boot sequence itself.
It's astonishingly simple:
You need a CD from where to run a shell, either a livecd or your favorite distro's install CD using the 'rescue' option (F2 will show you how to launch it). Sometimes Grub itself launches it's shell when it finds errors or can't stat where the heck the kernels are.
The steps are quite simple: If grub hasn't launched the shell for you, you just need to launch it:
Code:
grub
Now, keeping in mind the above mentioned syntax rules we will set up grub. For this example we will set up grub to reside in the MBR of the first IDE's master and the kernel will be in the second partition of the second IDE's master.
In Linux tis would be /dev/hda for the first IDE's master and /dev/hdc2 for the place where our kernel lives.
Translating to Grub's syntax: /dev/hda = (hd0) and /dev/hdc2 = (hd2,1)
So what we need to do is telling grub first where to search for the kernel we want to boot and here to place the MBR:
Code:
grub> root (hd2,1)
grub> setup (hd0)
grub> quit
That's all. With this setup we will be able to boot into our chosen kernel. Once in the distro we can tweak things to our liking editing the files /boot/grub/boo.lst or /boot/grub/grub.conf (depending on your distro).
But I will cover this later in a later update of this little HOWTO.
Stay tuned as I will be editing this to add more grub stuff (and maybe changing it to the LQ-Wiki).
Had a disaster with XP which meant a re-install and lost GRUB. For some reason the Repair Installation on the Suse 10.3 install DVD would not start, so I used my PartedMagic 1.9 disk instead.
The latest version is 2.1 and it can be burned to CD or USB.
All I had to do was boot from the CD, and open the terminal, then use the commands from above. This is a laptop with one drive, and Suse is on hda4 (hd0,3)
Got an error 22 the first time because I typed (hdo,3) with letter O instead of figure zero!
by JZL240I-U on Wed, 2010-06-30 04:54
Just a brief correction: It is /boot/grub/menu.lst not boo.lst. After adjusting this you are welcome to delete this comment. HTH.
by 'Gator on Fri, 2010-08-20 04:21
You should check the accuracy of your record-keeping system. I've started two threads and received multiple replies from dvacet, bcbc, and snowpine. What else must I do to "unlock the full benefits of your LQ account"?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
You can get it from here - http://partedmagic.com/wiki/PartedMa...in.PartedMagic
The latest version is 2.1 and it can be burned to CD or USB.
All I had to do was boot from the CD, and open the terminal, then use the commands from above. This is a laptop with one drive, and Suse is on hda4 (hd0,3)
--'Gator sends