Feb 06, 2012 - 12:17 AM
ForumArticlesMeetingsLinux ResourcesContact

A Linux machine! because a 486 is a terrible thing to waste!

--
Login




 


 Log in Problems?
 New User? Sign Up!
Beginners

What happens when I boot

It is actually pretty amazing. First code in your BIOS runs. It resides an a ROM or EPROM, and does a bunch of initialization stuff. Eventually it tell your disk drive to go to sector 0 of track 0 and read in a sector worth's of data into RAM. It then jumps (sets the program counter) to the beginning of that data and executes what it finds there. What it found there is called the master boot record, and it looks like this:

  1. 466 btyes of code
  2. 64 bytes of partition table
  3. a two byte *magic number* = aa55

Getting the Master Boot Record

Become root and try the following on your computer:

dd if=/dev/sda of=mbr.bin bs=512 count=1
fdisk -l /dev/sda | tee fdisk.txt
od -Ad -x mbr.bin | tail -c 250

It wouldn't be a bad idea to copy the files mbr.bin and fdisk.txt to a usb key, or some other computer, for safe keeping.

At this point grub loads the rest of the system from disk. Eventually control is passed to a program called init, and if the phase of the moon is right and you were nice rather than naughty, your system will come up in X!! Yippie.

You will probably do almost all of your interacting with grub in the file menu.lst. Most likely this file will be found at /boot/grub/menu.lst, but it is possbile that yours is located at /boot/boot/grub/menu.lst Please open it (read only) in your favorite editor.

Things you really need to know

In order to do anything with grub, you need to know the following:

  1. Which partition contains the kernel
  2. Within that partition, the directory path and filename of the kernel
  3. Which partition contains /sbin/init

Armed with that info, you can configure your menu.lst file to boot linux. Now look near the end of your menu.lst file and find some lines that look like:

title Debian GNU/Linux, kernel 2.6.24-etchnhalf.1-amd64
root (hd0,0)
kernel /boot/vmlinuz-2.6.24-etchnhalf.1-amd64 root=/dev/sda1 ro
initrd /boot/initrd.img-2.6.24-etchnhalf.1-amd64
savedefault  

What does this mean? Let's take it one at a time.

title      Debian GNU/Linux, kernel 2.6.24-etchnhalf.1-amd64

is what appears in the grub menu that is displayed on your screen as the computer is booting up. It can be anything you want it to be, though something meaningful is probably wise.

root      (hd0,0)

This tells grub which partition contains the kernel. Grub numbers disks from 0 and numbers partitions on each disk from 0. Thus you may have seen in the past that your filesystem mounts are /dev/hda1. In *grub speak* that is the zeroth partition (1) of the zeroth disk (hda). In times past, I used to have a seperate partition just for the kernel, and I put the rest of my filesystem on a different partition. The rationale was that this was *safer.* These days I don't bother. On the other hand, I am thinking of encrypting my root partition. If I (or you) ever want to do this, you will need a seperate (unencrypted) partition for your kernel.

kernel      /boot/vmlinuz-2.6.24-etchnhalf.1-amd64 root=/dev/sda1 ro

This tells grub where the actual kernel image is, relative to the boot parameter you used above. It also tells linux where the root file system is, which contains the file /sbin/init. It my case it is on the same partion as the kernel, namely /dev/sda1. This is also the same parameter you would use with *mount* to mount this filesystem.

initrd      /boot/initrd.img-2.6.24-etchnhalf.1-amd64

Some systems need an inital ram disk (initrd) in order to boot themselves. Why? well let's just say that's how it works. It allows the kernel to be small, and to grab whatever drivers it needs to get your system running from a virtual disk (the ram disk). For example, it is probably loading the actual hard disk drivers (either ide or sata or scsi) from the ram disk in order to be able to talk to your disk drive.

savedefault

Finally we have the savedefault command. At the very top of your menu.lst file you will find a command like:

default      0           # boot the first entry
default      saved       # boot the kernel I booted before

savedefault means that if you select that kernel to boot, it should be saved as the default kernel for next time (if you used the default saved option). This seems a little convoluted, but there is a **very good reason** for this. Nothing can make you sweat more than installing a new kernel (or distribution) on a machine a few hundred kilometers away. You check, double check, then triple check. You type reboot, and starting pinging the remote machine. You watch as the *destination host unreachable* message appears, and they you fuss until hopefully the remote machine starts responding. Well, with a little grub magic, you can increase your chances of getting that treasured response.

The fallback command

Suppose you have two kernels, an brand new shiny one, called linux-shiny and an old one called linux-reliable. You want to boot your machine into linux-shiny, but just in case something bad happens, have it reboot into good old linux-reliable. You can do this with grub's fallback mechanism. You'll need a menu.lst file like this:

default saved      # This is important!!!
timeout 10
fallback 1         # This is important!!!

title linux-shiney
root (hd0,0)
kernel /boot/linux-shiney
savedefault fallback # This is important!!!

title linux-reliable
root (hd0,0)
kernel /boot/linux-reliable
savedefault

Then from the command line you run:

grub-set-default 0

What happens is that grub will boot linux-shiney. While booting linux-shiney, the *savedefault fallback* command is run, which sets the default kernel to 1 (you can have more than one fallback). Now if the kernel panics, or fails to boot, the next time the machine boots it will run linux-reliable. It is up to you to *grub-set-default 0* (pehaps in an init script) if the machine boots successfully into you new shiny kernel.

Booting that other operating system

If you are unfortunate enough to find yourself in a non MFZ (Microsoft Free Zone) you may have to configure grub to boot into that other operating system. Assuming you only have one disk, and that linux is on partiton 1 and windoze is on partition 1, you would add the following to your menu.lst file:

title Windoze
rootnoverify (hd0,0)
chainloader +1

title Linux
root (hd0,1)
kernel /boot/your-kernel-file-here

Last, and probably least, just for fun we can install a custom splash screen to display when grub is booting. The image file needs to be a gzipped xpm file, with dimensions 640x480 and no more than 14 colors. It also helps if it was created on a Tuesday under a full moon. Anyway, to see your sexy new boot image, just add:

splashimage=(hd0,0)/boot/your-wonderful-image.xpm.gz

to menu.lst and away you go. May all your grubs be juicy and not taste like warm puss.

This article was written by Henry Laxen of the Mazatlan Linux Users Group

More Than You Want to Know About GRUB | Log-in or register a new user account | 5 Comments
Comments are statements made by the person that posted them.
They do not necessarily represent the opinions of the site editor.

Re: More Than You Want to Know About GRUB

(Score: 0)
by Anonymous on Oct 10, 2010 - 03:51 AM
webcam gnocche culo vivo foto amatoriale figa pelosa foto vip in trasmissioni senza mutande leccare fica piena sborra archivio video porno donne nane minchia nera video lesbiche pompinare gratis fotogalleria uomini cavallo film gratuiti da scaricare sorelle succhia cazzi sborrate in faccia scopate con bambine storie erot confessioni e racconti sessuali erotici nl swinger provini amatoriali culi super larghi gratis porche animate foto negre africane scopate gratis www virgilio sex it copertine cd nbsp calde gay dei ragazzi fighe mature porche scopate con animali di donne immagini mare bios h nbsp studentesse a padova gole hr google gratis riviste playboy solo foto amatoriale di donne casalinghe racconto campagna tette culo rapporti di coppia fottere con animali foto scambio nbsp grande fica squirting femmine mature scopate masturbazione amatoriale donne flashing tits nbsp gallery animali toro luoghi per masturbarsi

Re: More Than You Want to Know About GRUB

(Score: 0)
by Anonymous on Oct 29, 2010 - 11:53 AM
photode jeune fille nu free redtubedownload megarotic download video free femme baise avec un chien 1 xxx enculeuses extrait porno arabe tv jacquie et michel tv com elle suce des bites en cachette www spankwire com zoophilie cumshot gros nibard gratuit laiteux et veineux estrait filme x femme obese qui se fait enculer par son chien photo v elle salope gratu t photo porno morrocco xxx extreme zoophile massage x stream video blogs sexe maxi xex porno marocain cunilungus femme baise avec animaux xtrait porno amteur bear gratuit video gay gratis vivid video seins nue shemale hanjob tube naruto hent photo ou extrait video incest avec leur jeunes fille video de sex gratuiteme t fesses de salopes telecharger ***** gratuit photos femmes qui sucent marc dorcel cambrioleuse streaming videos partouzes gay hot tv ejaculation feminine giulia cochonne femme mure et saloppe ado gay xxx sit sex pute algeroise videos amateurs indiennes tube baiserdeklimt videopis bydgoszcz pl baise en famille videos

Re: More Than You Want to Know About GRUB

(Score: 0)
by Anonymous on Nov 11, 2010 - 09:55 AM
porno agader big mami baises haitienne chattes touffe de poil gay nue mec virile red tube free hot sex videos helena karel video hard x gratuit tv sex sur pc gratui bog vid o vieilles hardeuses film xxx viole des femmes femme nue cheval sex downloader video dbz hentai sex scato tube rencontre transexuelles paris meres exhibe en webcam �video �voyeur �arabes � joli femme sexe site sex arabe free code lyoko hentais video gratuits babe poilue photo video x arabe gratuit you tube hentai anime streaming les plus grosse videos gays gratuite video tracey adams gratuit movie anal shit porn movie scato femme avec gros vagin gay zoophille divx sexe gratuit com jetsociety manaudou sex family inseste petite teen de 13an en foto ki suce nue travestie marseille video de vieille qui se font niquer femmes poilue photos femme avec hijab porno histoire de baise zoophile extrai video tunisiennes sodomisees chaine de television sexe femme vieille meilleurs sites x en streaming jacquieetmichel site porno eurohottv blog vid o femme cheval

Re: More Than You Want to Know About GRUB

(Score: 0)
by Anonymous on Nov 16, 2010 - 05:21 PM
vagins des femmes poilus projetxclaramorganeenstreaminggratuit fotoevent kazimierz dolny pl bresiliennes nues photos extrait sodo je baise ma tata www futaiuri profesionale xxx ro porn kolt jupe string chat gratuit avec des femme en manque de sexe xxx femmes 60 ans salope fils et sa m re webcam vieille nue monster dildos sexe histoires jeux coquin gratuit tube photos nues gays sport sxey porno morocco porno web tv gratuit extrait amatrice soire teen hard www badjojo video pornos shemales trans phot free zoophile sexe gratuit tv vids zoo sex gratuit blog porno d une bonne pute baiser pa un cheval a grosse bite regarder image porno et image sexe gratuit femme urinant photos you porn vieilles www magichefollie com video porno des 60ans viellesveuvessalopes ingoio jelenia gora pl porno japones garatui movie zoophi sexy streming virginie redtube nom video lesbiennes fantasme pied porno extrait femme cochonne gratuit dheliat fake streaming x arab extraits vidos gratuites extrait gratit sm video uro gratuite

Re: More Than You Want to Know About GRUB

(Score: 0)
by Anonymous on Dec 04, 2010 - 01:23 PM
forum esclave sexe domination photo sex arab hub annauire free xxx stream tv site outrouverzoophiliegratuite fichettegi wegrow pl chevaux en rut viedeo couples zoophiles blog de sexe mature et jeune gratuit extrait video erotique gratuite francaise photo amatrice femme vieille stacy silver allopass beau lascard gay extraits videos asiatiques masturbation ***** machine red tube com porn tube com ***** tube com porno vielles arabe videos gratuites femme et chien photo rebeu strip bite a branler sex de vieilles de 70 ans xxx afriqa porno animal hard sex movie photos tres jeunes ado nues bisexuel blog sex salopes grosses fess thalia nu vid o porno chevaux chien extrait sexe aurelie jou pornal tv sex online arab www sex zoo com video gratuite pornographie africaine blog nudistes victoria entirement nue naruto gay porno baise entre ados en video video du cheval qui sodomise une femme extrai africaine photos femmes en bas coutures pornos egyptiennes enculees filmes blog video sex mec nu film rotique sans t l chargement kahba en hidjab