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.

Introduction to Linux - A Hands on Guide

This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.

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):

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).

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"?