Razlika između inačica stranice GRUB 2

Izvor: HrOpenWiki
Skoči na: orijentacija, traži
m
m (External Links)
Redak 714: Redak 714:
  
 
== External Links ==
 
== External Links ==
[[http://www.gnu.org/software/grub|GNU GRUB]]
+
[http://www.gnu.org/software/grub GNU GRUB]
  
[[http://grub.enbug.org/Manual|GNU GRUB 2 Manual]]
+
[http://grub.enbug.org/Manual GNU GRUB 2 Manual]
  
[[http://members.iinet.net/~herman546/p20.html|Illustrated Dual Boot HomePage]]
+
[http://members.iinet.net/~herman546/p20.html Illustrated Dual Boot HomePage]
  
[[http://grub.gibibit.com/Theme_format|http://grub.gibibit.com/Theme_format]] (Themes)
+
[http://grub.gibibit.com/Theme_format http://grub.gibibit.com/Theme_format] (Themes)
----
+
CategoryBootAndPartition
+

Inačica od 21:15, 4. studenoga 2009.

U izradi
Ova stranica se izrađuje. Tekst je djelomično preveden. Svratite malo kasnije.

GRUB 2 je zadani boot loader u Ubuntuu 9.10 (Karmic Koala) kao i u nekim drugim operacijskim sustavima. GRUB 2 je naslijednik GRUB-a (GRand Unified Bootloader). Napisan je u cijelosti iznova i ima značajno veću fleksibilnost i više mogućnosti. GRUB 2 spada pod slobodan softver.

Pojašnjenje oko oznaka verzija:

  • sve verzije GRUB-a iznad 1.96 spadaju u GRUB 2
  • ranije verzije (0.97 i manje) pripadaju u GRUB (ili kako bi neki rekli GRUB 1, ili GRUB legacy)


Poboljšanja

Značajna poboljšanja u odnosu na GRUB:

  • Podrška za skripte
  • Modularnost
  • Mogućnost "spašavanja"
  • Prilagođene i osobne meni stavke
  • Teme
  • Grafički boot meni i poboljšani splash
  • Dizanje sustava sa LiveCD ISO slike direktno s hard drivea
  • Nova struktura fileova za konfiguraciju
  • Podrška za ne-x86 platforme (kao PowerPC)
  • Univerzalna podrška za UUID-ove. (Ne samo za Ubuntu)


Usporedba GRUB i GRUB 2

Standardni GRUB 2 meni će biti poznat GRUB korisnicima. Ali, ispod površine postoji puno različitosti.

  • Ako imate instaliran samo jedan operativni sustav, GRUB 2 neće prikazati meni, već će se sustav podići do login prozora, ili desktopa.
  • Više ne postoji /boot/grub/menu.lst. Zamijenio ga je /boot/grub/grub.gfg
  • Više ne postoji /find boot/grub/stage1 u grub promptu. Stage 1.5 je uklonjen.
  • /boot/grub/grub.cfg file se ne uređuje.
  • Svaki puta kada se obnovi kernel, ili kada se pokrene naredba update-grub grub.cfg file će se iznova formirati.
  • Korisnik može kreirati svoj file u /etc/grub.d/40_custom. taj file se neće obrisati.
  • /etc/default/grub je file u kojem se podešavaju GRUB postavke.
  • U /etc/grub.d/ folderu postoji nekoliko fileova kojima možete dodatno podešavati GRUB menu.
  • Promijenilo se brojenje particija. Tako je sada prva particija 1, za razliku od ranije kada je bila 0. (Prvi uređaj je još uvijek 0. To se nije promijenilo)
  • Kad pokrenete "update-grub" naredbu automatski se traže drugi operativni sustavi popt Windowsa.
  • Promjene koje ste unijeli neće se ostvariti dok ne pokrenete naredbu "update-grub".


Instalacija

Ubuntu

Karmic Koala ( Ubuntu 9.10) dolazi s novim GRUB 2. U ranijim verzijama poput Jaunty Jackalope (9.04) GRUB 2 možete dodatno instalirati. Provjerite trenutnu verziju GRUB-a koju imate instaliranu na vašem Ubuntuu.

grub-install -v

GRUB 2 bi trebao imati verziju 1,96 ili više. Starije (legacy) verzije imaju broj 0.97 ili manji.


Pretpostavljena instalacija

Kao što je rečeno prije, na Karmic Koali GRUB 2 je instaliran kao pretpostavljeni boot loader. Naziv paketa je "grub-pc". "grub2" je prijelazni paket i možese bez poslijedica ukloniti.


Nadogradnja na GRUB 2

Nadogradnja sa GRUB-a na GRUB 2 bi trebala biti relativno jednostavna.Ono što je važno, nadogradnja vam omogućuje i provjeru da li će vam GRUB 2 raditi na vašem računalu i prije nego završite instalaciju.

1. Prije nadogradnje osvježite repozitorije. To postižete

sudo apt-get update

naredbom, ili odgovarajućom tipkom u Synapticu ili nekom drugom paketnom upravitelju.

2. Instalirajte grub-pc paket:

sudo aptitude install grub-pc

Jednostavan program će vas voditi kroz instalaciju.

3. Pročitajte tekst, tipkom tab odaberite "OK" i pritisnite ENTER.

Grub2.upgrade.ok.sm.png

4. Sada možete isprobati GRUB 2. Odaberite "yes" da dodate "chainload" opciju u GRUB menu. Slijedeći puta kada se bootate moći ćete odabrati u klasičnom GRUB meniju podizanje sustava putem GRUB 2.

5. Sada će se u naredbenoj liniji prikazati posebne naredbe iz menu.lst-a. Naredbe poput "quiet, splash, noapic". Potvrdite sa "OK" i GRUB 2 će ih automatski preuzeti u svoje postavke. Ukoliko je potrebno, možete ih prije toga urediti. Naravno, ove naredbe je moguće i kasnije dodati u GRUB 2.

Grub2.linux.command.line.ok.sm.png

6. Ugasite i ponovno upalite računalo. Primjetiti ćete da je vaš "klasični" GRUB meni promijenjen. Odaberite "chainloader" opciju. Dobiti ćete GRUB 2 meni.

Grub2.chainload.grub.sm.png

6a. Ukoliko koristite Jaunty možda dobijete "Unrecognised device string" Error 11. Pritisnite "e" dok ne dobijete liniju koja počinje sa:

grub edit> root

Promijenite "root" u "uuid". Stisnite ENTER, potom "b".

7. Provjerite sve unose.

Grub2.chainload.grub2.sm.png

8. Ako vam GRUB 2 meni ispravno radi, možete nadograditi GRUB na GRUB 2 naredbom:

sudo upgrade-from-grub-legacy

Nakon što ste nadogradili GRUB na GRUB 2, dobiti ćete poruku da je zaostalo nekih fileova iz starog GRUB-a. To uradite slijedećom naredbom:

Oprez sa rm
Pripazite s naredbom rm. Neispravno napisana naredba može obrisati vežne fileove.
rm -f /boot/grub/menu.lst*

9. Restartajte računalo i podignite sustav s GRUB 2 menija.

File Structure

GRUB 2 ima sasvim drugačiju organizaciju mapa i fileova. "menu.lst" se više ne koristi.

Da bi saznali gdje je GRUB 2 instaliran, pokrenite naredbu:

sudo grub-probe -t device /boot/grub

ako želite saznati uređaj, ili

sudo grub-probe -t fs_uuid /boot/grub

da bi saznali UUID

File u kojem se nalaze glavne postavke GRUB 2 je

/boot/grub/grub.cfg

  • Svaki odjeljak je označen s ~-"(### BEGIN)"-~ i poziva se na /etc/grub.d mapu iz koje su postavke dobivene.
  • "grub.cfg" će se osvježiti naredbom
update-grub

Naredbu pokrenite kao root korisnik. Naredba je zamjena stare

grub-mkonfig -o /boot/grub/grub.cfg 
  • Sa svakom novom instalacijom kernela grub.cfg će se osvježiti.
  • grub.cfg je file koji se može samo čitati (read only). To je zbog toga jer taj file nije predviđen za uređivanje.

U /boot/grub mapi ćete vidjeti i dosta *.mod fileova. Oni predstavljaju modularnu prirodu GRUB-a 2. Njih po potrebi učitava boot loader.

/etc/default/grub

  • Radi se o konfiguracijskoj datoteci u kojoj stoji ono što se nekada nalazilo u gornjim dijelovima "menu.lst" datoteke. Sadržaj se može uređivati ukoliko imate root ovlasti. Kada pokrenete update-grub naredbu, promjene će se odraziti u grub.cfg datoteci.

/etc/grub.d/ (mapa)

  • Datoteke u ovoj mapi se čitaju prilikom izvršenja "update-grub" naredbe. Njihov sadržaj će se nakon toga uklopiti u grub.cfg datoteku.
  • Mjesto koje će stavke iz ove mape imati u grub.cfg datoteci određeno je njihovim imeno. Datoteke s manjim brojem će se stoga izvršiti prve.

"10_linux" se izvršava prije "20_memtest" Datoteke koje nemaju brojeve u svom nazivu će se izvršiti nakon onih s brojevima.

  • Svoje vlastite postavke možete unijeti u 40_custom datoteku.
  • Samo će se izvršne (executables) datoteke će se uklopiti u grub.cfg.


  • Datoteke u ovoj mapi su:
    • 00_header U ovoj datoteci se nalaze postavke vezane uz grafički način, pretpostavljeni izbor, vremensko ograničenje itd. Postavke su uvezene iz /etc/default/grub datoteke. Korisnici ne bi trebali uređivati ovu datoteku.
    • 05_debian_theme U ovoj datoteci se nalaze postavke vezane uz splash sliku, boju teksta, boju izbora i teme. Ukoliko ne postoji splash slika u ovoj datoteci će biti postavljena monokromatska tema za početni meni.
    • 10_hurd Položaj Hurd kernela. Trenutno se ne koristi.
    • 10_linux Tu se nalazi položaj kernela operativnih sustava koji se koriste. Također se tu nalaze imena vezana uz te kernele.
    • 20_memtest86+ Traži "/boot/memtest86+.bin i uključuje ju kao opciju u GRUB 2 boot meni. Trenutno se ne može izbrisati iz menija. Ali ju možete ukloniti tako da joj oduzmete izvršna prava.
chmod -x /etc/grub.d/20_memtest86+

I nakon toga

update-grub
    • 30_os-prober U ovoj datoteci se pretražuju operativni sustavi. Rezultat će se postaviti u "grub.cfg". Ova datoteka je podijeljena u četiri odjeljka. Windows, Linux, OSX i HURD.
    • 40_custom Tu možete zapisati vlastite postavke koje će se kasnije uključiti u grub.cfg. Sve ispod "exec tail -n +3 $0" će se direktno prenijeti u grub.cfg.
  • Datoteke u ovoj mapi moraju biti izvršne. One koje nisu izvršne neće se prenijeti u grub.cfg, već će ih grub-update naredba ignorirati.

Podešavanje GRUB-a 2

Podešavanje se obično unose u "/etc/default/grub" i u "/etc/grub.d". /boot/grub/grub.cfg se ne bi trebalo uređivati. Ta datoteka se automatski podešava prema promjenama u ove dvije datoteke.

/etc/default/grub

  • Radi se o glavnom konfiguracijskoj datoteci. U njoj se nalaze slijedeće linije:
    • GRUB_DEFAULT

Postavlja podrazumjevani izbor u GRUB meniju. Možete upisati broj, ili naziv.

      • ~-GRUB_DEFAULT=0-~ Postavlja podrazumijevani izbor prema položaju na meniju. Položaj se broji od 0 kao i na starom GRUB-u.(Prvi je 0, drugi je 1 itd.)
      • ~-GRUB_DEFAULT=saved-~ Ostavlja izbornik na posljednjem odabranom odabiru.
      • ~-GRUB_DEFAULT="xxxx"-~ Točan naziv, uključujući i navodnike se može koristiti. Na taj način, neće biti važan položaj na meniju, već samo ime.Npr: ~-GRUB_DEFAULT="Ubuntu, Linux 2.6.31-9-generic"-~
  • GRUB_HIDDEN_TIMEOUT=0
    • Ovdje postavljate da li želite vidjeti GRUB meni. Ukoliko želite vidjeti meni, dodajte # ispred GRUB. (~-# GRUB_HIDDEN_TIMEOUT=0-~)
    • Za sve unose veće od 0, sustav će napraviti pauzu za taj broj sekundi, ali se neće prikazati meni.
    • Ako želite prikaz menija, možete ga dobiti pritiskom na tipku SHIFT.
    • Ukoliko zbog nekog razloga tipka SHIFT ne bude radila, meni možete dobiti i ESC tipkom.
  • GRUB_HIDDEN_TIMEOUT_QUIET=true
    • ~-true-~ Ne prikazuje odbrojavanje vremena. Meni se ne prikazuje.
    • ~-false-~ Prikazuje odbrojavanje vremena. Meni se ne prikazuje
  • GRUB_TIMEOUT=10
    • Postavlja vrijeme tijekom kojeg će biti prikazan GRUB meni. Ukoliko je aktivna opcija GRUB_HIDDEN_TIMEOUT, GRUB_TIMEOUT će se pokrenuti samo kada je meni prikazan.
    • Ukoliko postavite vrijednost na -1, meni će se prikazivati dok god ne odaberete stavku iz menija.
  • GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
    • Postavlja ime stavke na meniju. (Ubuntu, Fedora, Windows itd)
  • GRUB_CMDLINE_LINUX
    • Ukoliko postoji, ova linija uvozi sve iz "linux" komandne linije. (GRUB legacy "kernel" linija) Nešto slično je i "Altoption" linija u menu.lst.
  • GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
    • Ova linija uvozi sve sa kraja "linux" linije.(Grub legacy "kernel"linije) Opcija je slična "defoptions" u menu.lst. Ako hoćete da se prilikom bootanja prikazuje tekst procesa, uklonite "quiet splash". Ako želite vidjeti splash sliku zajedno s tekstualnim opisom procesa, koristite "splash" U ovu liniju se može unijeti i "acpi=off"
  • #GRUB_TERMINAL=console
    • Odkomentirajte ukoliko želite koristiti grafički terminal (samo za grub-pc)
  • #GRUB_DISABLE_LINUX_UUID=true
    • Odkomentirajte ukoliko ne želite da GRUB preda "root=UUID=xxx" parametar Linuxu
  • #GRUB_GFXMODE=640x480
    • Odkomentirajte ukoliko želite aktivirati ovu liniju. Tu postavljate rezoluciju grafičkog menija (Veličina teksta).Unesite rezolucije koje podržava vaša grafička kartica. Postavke se odnose samo na boot meni, a ne na operativni sustav koji se boota.
    • Natuknica: Ako postavite rezoluciju koja je ista rezoluciji operativnog sustava, značajno ćete skratiti vrijeme bootanja.
    • Nije nužno, ali možete poostaviti i dubinu boje u bitovima. Npr. uz rezoluciju 1280x1024x24, postavlja 24 bitnu boju.
    • Možete postaviti i više rezolucija. Ukoliko GRUB ne može koristiti prvi unos, krenuti će na slijedeći. Npr:1280x1024x16,800x600x24,640x480.
    • Ukoliko koristite splash sliku, pripazite da rezolucija odgovara onoj na splash slici.
    • Ukoliko dobijete "not found" poruku kada pokrenete "update-grub" pokušajte promijeniti dubinu boje u bitovima.
    • Ukoliko utipkate "vbeinfo" u GRUB 2 komandnu liniju, dobiti ćete informaciju koje su sve rezolucije dostupne. R
    • Ukoliko je ova linija zakomentirana (#) koristiti će se pretpostavljene vrijednosti unesene u /etc/grub.d/00_header
  • GRUB_DISABLE_LINUX_RECOVERY=true
    • Odkomentirajte ovu liniju ukoliko ne želite da se prikaže "Recovery" mod kernela u meniju. Ukoliko želite Recoveri za samo jedan kernel, unesite poseban unos u /etc/grub/40_custom.
  • Dodatne opcije
  • GRUB_DISABLE_OS_PROBER=true
    • Onemogućava ili omogućava os-prober da pronađe druge operativne sustave na sotalim particijama.

Boot Display Behavior

GRUB 2 se učitava prije operativnog sustava. Njegove modularne komponente se učitavaju prema optrebni. Izgled menija je podešen u /etc/default/grub datoteci.

Pretpostavljeni način

  • GRUB 2 će odmah pokrenuti pretpostavljeni operativni sustav. Neće se prikazati meni. Ukoliko GRUB 2 otkrije neki drugi OS, prikazati će se meni.

Vremenski određeni prikaz

  • Meni će se prikazati određeni broj sekundi. Pretpostavljena stavka je odabrana, ali možete birati i ostale stavke dok ne istekne vrijeme. Vrijeme će se odbrojavati dok god ne pritisnete neku tipku, ili ne potvrdite odabranu stavku pritiskom na ENTER. Ukoliko ništa ne uradite, nakon isteka odbrojavanja, podići će se pretpostavljeni sustav.
  • Kada pritisnete neku tipku, odbrojavanje će prestati i morati ćete odabrati stavku da bi nastavili dizanje sustava.
  • Pretpostavljena stavka je određena u~-DEFAULT=-~ odjeljku /etc/default/grub datoteke. Prva stavka na meniju se broji od 0.

Hidden

  • Neće se prikazati meni. Ukoliko je postavljen, prikazati će se splash slika.
  • Korisnik može prekinuti boot proces i prikazati meni pritiskom na tipku SHIFT.
    • GRUB 2 traži status tipke SHIFT. Ukoliko je tipka pritisnuta, ili ne može dobiti status SHIFT tipke, prikazati že se meni.
  • Vrijeme u kojem će ekran ostati prazan, ali će biti moguće dobiti meni je određeno u /etc/default/grub.
  • GRUB 2 može prikazati odbrojavanje. Na taj način možete dobiti informaciju koliko je vremena preostalo da odaberete druge stavke menija.
  • Kada odbrojavanje istekne, podići će se pretpostavljeni operativni sustav

Saved

  • Podignuti će se poslijednji odabrani kernel/operativni sustav.

Custom Menu Entries

GRUB 2 allows users to create customized menu selections which will be automatically added to the main menu when `sudo update=grub` is executed. An empty 40_custom file is available in /etc/grub.d/ for use or to serve as an example to create other custom menus. Here are some considerations for custom menus:

* The name of the file determines the order of the selections in the menu. Numeric filenames are run first, followed by alphabetic filenames.
 * 10_linux entries will appear before 30_os-prober entries, which will be placed before 40_custom entries, which will preceed my.custom.entries inputs. 
 * A user wishing for the custom menu entries to appear first on the main menu could name the folder 06_xxx so its listings are first in the menu. 
* The file must be made executable: `sudo chmod +x /etc/grub.d/filename`. 
* The contents of the file is added to grub.cfg without changes when the `update-grub` command is executed.
* Unlike grub.cfg, custom files can be edited at any time, are not read-only, and can be owned by the user if desired.
* Custom files are static. The contents will not be altered when new kernels are added or removed (unless the contents are effected by user-added scripts). 

Predložak:Attachment:important.png If the custom file places the menuentry listings at the top of grub.cfg, the user may wish to confirm the /etc/default/grub ~-DEFAULT=-~ setting after running `update-grub`. Make sure it still points to the desired menuentry listing. When counting, the first "menuentry" in the /etc/default/grub is 0.


Creating the Custom Menu

The user can either edit the default /etc/grub.d/40_custom file or create a new one. The easiest way to create the content of a custom menu is to copy a working entry from /boot/grub/grub.cfg. Once copied, the contents of 40_custom can be tailored to the user's desires.

* According to the default sample custom file (/etc/grub.d/40_custom) the first two lines of any custom file in /etc/grub.d should be:
  ||<tablestyle="background-color: #fffbdb; font-size:small;" style="border:none;">  #!/bin/sh||
  ||<style="border:none;">exec tail -n +3 $0||
* The user can copy existing menuentries from the /boot/grub/grub.cfg file or from a GRUB legacy file. If the user wishes to copy from a GRUB legacy menu.lst file:
 * A backup copy of this file may be in the /boot/grub folder if the user upgraded from GRUB to GRUB 2.
 * The following entries from the GRUB menu listing must be changed for them to work:
  * title is changed to menuentry. The line must end with {
  * root is changed to set root=
  * kernel must be changed to linux
  * Any partition designation (sda4, sdb6) must be changed, as GRUB and GRUB 2 count the partitions differently. The first partition for GRUB 2 is 1, not 0. Devices still start the count at 0. 
  * Look carefully at the format of any working GRUB 2 menulist entry to ensure the correct format is used.
* General menuentry Construction Rules:
 * The first line must start with menuentry and end with ~+{+~
 * The area between the quotation symbols is what will appear on the GRUB 2 menu. Edit as desired. 
 * The last line of the menuentry must be ~+}+~
 * Do not leave empty spaces at the end of lines
 * The set root= line should point to the GRUB 2 /boot location ( sdXY )
 * The root reference in in the linux line should point to the system partition.  
  * If GRUB 2 cannot find the referenced kernel, try replacing the UUID with the device name (example: /dev/sda6 ).


* A sample entry copied from the grub.cfg and altered by the user might look like this:
  ||<tablestyle="background-color: #fffbdb; font-size:small;" style="border:none;">menuentry "My Default Karmic" {||
  ||<style="border:none;">set root=(hd0,1)||
  ||<style="border:none;">search --no-floppy --fs-uuid --set cb201140-52f8-4449-9a95-749b27b58ce8||
  ||<style="border:none;">linux	/boot/vmlinuz-2.6.31-11-generic root=UUID=cb201140-52f8-4449-9a95-749b27b58ce8 ro   quiet splash||
  ||<style="border:none;">initrd /boot/initrd.img-2.6.31-11-generic||
  ||<style="border:none;">}||


* A sample entry for a hard drive version of SystemRescueCD installed per the instructions on the web site (on sda8).
  ||<tablestyle="background-color: #fffbdb; font-size:small;" style="border:none;">      menuentry "System Rescue CD" {||
  ||<style="border:none;">set root=(hd0,8)||
  ||<style="border:none;">linux /sysrcd/rescuecd subdir=sysrcd setkmap=us||
  ||<style="border:none;">initrd /sysrcd/initram.igz||
  ||<style="border:none;">}||


* A sample entry for chainloading to another GRUB bootloader.
  ||<tablestyle="background-color: #fffbdb; font-size:small;" style="border:none;">      menuentry "Grub 1 Bootloader" {||
  ||<style="border:none;">set root=(hd0,8)||
  ||<style="border:none;">chainloader +1||
  ||<style="border:none;">}||


Command Line & Rescue Mode

There are several ways for a user to attempt to resume a failed boot. If the menu is still available, menu settings can be viewed and altered by the user. Additionally, if GRUB 2 detects errors during boot and cannot pass control to the selected kernel because of a grub.cfg error or omission it will revert to the rescue mode. Both methods allow the user to recover to a usable system via a limited command line interface.

Editing Menus During Boot

* If the menu is not normally displayed during boot, hold down the SHIFT key as the computer attempts to boot to display the GRUB 2 menu.
* With the menu displayed, press any key (except ENTER) to halt the countdown timer and select the desired entry with the up/down arrow keys.
* Press the 'e' key to reveal the selection's settings.
 Predložak:Attachment:grub2.menu.edit.png
* Use the keyboard to position the cursor. In this example, the cursor has been moved so the user can change or delete the numeral 9. 
* Make a single or numerous changes to any or every line. Do not use ENTER to move between lines.
* Tab completion is available, which is especially useful in entering kernel and initrd entries.
* When complete, determine the next step:
 * CTRL-x - boot with the changed settings (highlighted for emphasis)
 * CTRL-c - go to the command line to perform diagnostics, load modules, change settings, etc.
 * ESC - Discard all changes and return to the main menu.
 * The choices are listed at the bottom of the screen as a reminder.

Command Line Mode

From the main GRUB 2 menu display the user can elect to drop to a command line by typing 'c'.

Predložak:Attachment:info.png Here are some useful tips & features for use with the GRUB 2 command line:

* Turning off the splash image may make viewing the terminal easier. Press "c" to go to the command line and then type: `set color_normal=white/blue` or the color combination you wish to use. "black" as the second entry retains the menu's transparency and should be avoided as a selection if the user wants to work with a solid background color.
* To prevent scrolling past the top of the screen, first run `set pager=1`, which acts like the terminal's "| more" command. This will allow one full screen of data, with line advancement continued by pressing the ENTER key.
* Type `help` to view a list of all the commands. Type `help x` to view help commands beginning with the letter "x". Tab completion and using the up arrow to repeat commands work the same as in a normal terminal. 
* The TAB completion feature is very handy. At any point, pressing the TAB key may complete an entry, if the element is unique, or display available options. Typing a few additional characters and pressing TAB again may allow tab completion to finish the entry.


Some of the more useful commands include:

||<(^ tablewidth="95%" tablestyle="border:none; background-color: #fffbdb; font-size:small" rowstyle="border:none; " width="10%" style="border:none; ">Command||<style="border:none" width="5%"> ||<(^ style="border:none" >Result||
||<^ style="border:none">background_image||<style="width=5%; border:none;"> ||<^ style="border:none;">Load an existing background image. Use tab completion to help complete filename entries! `background_image=/usr/share/images/grub/` then tab to display a list of all images. Useful command when initially testing splash images. ||
||<^ style="border:none; ">cat||<style="border:none;"> ||<^style="border:none; ">Use to display the current file contents. `cat /boot/grub/grub.cfg , cat /etc/fstab`||
||<^ style="border:none; ">help||<style="border:none;"> ||<^ style="border:none;">View all available commands. Type `help x` to get a list of commands beginning with the letter x.  `help xxx` for information about the xxx command. This command should be preceded by running "set pager=1", which acts like the terminal's "| more" command, to prevent scrolling past the top of the screen.||
||<^ style="border:none; ">ls||<style="border:none;"> ||<^ style="border:none;">Used alone, lists all devices (hd0) (hd0,1), etc. View available partitions with `ls`. View /boot and /grub folder contents with `ls /boot, ls /boot/grub||
||<^ style="border:none; ">initrd||<style="border:none;"> ||<^style="border:none;">Load an initrd.||
||<^ style="border:none; ">linux||<style="border:none;"> ||<^ style="border:none;">Load a linux kernel.||
||<^ style="border:none; ">loopback||<style="border:none;"> ||<^ style="border:none;">Mount a file as a device.  `loopback loop (hd0,2)/iso/my.iso||
||<^ style="border:none; ">lsmod||<style="border:none;"> ||<^ style="border:none; ">Display loaded modules||
||<^ style="border:none; ">reboot||<style="border:none;"> ||<^ style="border:none; ">Reboot the machine ||
||<^ style="border:none; ">rescue||<style="border:none;"> ||<^ style="border:none;">Enter the rescue mode ||
||<^ style="border:none; ">set ||<style="border:none;"> ||<^ style="border:none;">Show environmental variables in place. Combined with others, set variables such as `set gfxmode=640x480`, `set color_normal=cyan/black` Use the latter command in command line mode to test various menu font colors.||
||<^ style="border:none; ">vbeinfo||<style="border:none;"> ||<^ style="border:none; ">Display available monitor resolutions. ||


Using CLI to Boot

If the user has problems booting but the menu is available, the easiest method to boot the system is to edit the existing menu. Refer to [Menus During Boot]. If GRUB 2 fails to find a usable grub.cfg file it should revert to the grub-rescue mode. The command line prompt will display grub-rescue> and no menu will be displayed. From this command line the user can attempt to manually enter the instructions to boot to a usable system.


If the command line prompt is not already active press "c" to enter the Command Line mode. You will see the GRUB 2 prompt: ~-grub>-~ or ~-grub rescue>-~

Predložak:Attachment:info.png If you wish to cancel and start over at any time, ~-ESC-~ will remove changes and return the user to the previous menu.

Use the following two commands to determine the device (drive) and partition of the system you wish to boot.

||<(^ style="border:none;" width="10%">~-set-~||<style="border:none;">||<(^ style="border:none;">When ~-set-~ is typed without additional entries the command displays the current GRUB 2 settings.||
||<(^ style="border:none;">~- ls-~ ||<style="border:none;">||<(^ style="border:none;">Run ~- ls-~   to see the devices recognized by GRUB 2. Example: (hd0) = sda; (hd0,1)=sda1; (hd1,3)=sdb3||

Express Boot to the Most Recent Kernel

Press ~-ENTER-~ after entering each command.

||<(^ style="border:none;" width="30%">1. ~-set root=(hdX,Y)-~ ||<style="border:none;">||<style="border:none;">Type with correct X,Y results from the ls command and ENTER. Remember GRUB 2 counts the first drive as 0, the first partition as 1. Example: If the Ubuntu system is on sda5, enter: set root=(hd0,5)||
||<(^ style="border:none;">2. ~-linux /vmlinuz root=/dev/sdXY ro-~||<style="border:none;">||<style="border:none;">(Example: linux /vmlinux root=/dev/sda3)||
||<(^ style="border:none;">3. ~-initrd /initrd.img-~||<style="border:none;">||<(^ style="border:none;">Selects the latest initrd image.||
||<(^ style="border:none;">4. ~-boot-~||<style="border:none;">||<(^ style="border:none;">Boot to the latest kernel on the selected partition.||

Boot to a Specific Kernel Manually

If a GRUB 2 menu is not available for editing during the boot process a user can enter all the necessary information on the GRUB 2 command line necessary to boot a usable kernel. This section will provide a step-by-step guide on how to enter this information. The line will look similar to this graphic when completed:

Press ~-ENTER-~ only after completing each section ("A", "B", "C" and "D").

||<( tablewidth="95%" style="border:none;">A. Set the Root Partition (Step 1)||
||<(^tablewidth="95%" style="border:none;" width="20%">1. ~-set root=(hdX,Y)-~ ||<style="border:none;">||<(^ style="border:none;">Type with correct X,Y results from the ls command and ENTER. Remember GRUB 2 counts the first drive as 0, the first partition as 1. Example: If the Ubuntu system is on sda5, enter: set root=(hd0,5)||
||<(-5 tablewidth="95%" style="border:none;">B. Enter the "linux" Line Information (Step 2-5) ||
||<( tablewidth="50%" bgcolor="#fffbdb" style="font-size:small; border:none;">linux ||<bgcolor="#d3fffb" style="font-size:small; border:none;">kernel ||<( bgcolor="#ffdff4" style="font-size:small; border:none;">root ||<( bgcolor="#dffbdb" style="font-size:small; border:none;">ro||
||<(^tablewidth="95%" style="border:none;" width="20%">2. ~-linux-~ ||<style="border:none;"> ||<(^style="border:none;"> Type and continue.||
||<(style="border:none;" >3. ~-/boot/vml-~||<style="border:none;"> ||<(^ style="border:none;"> Type, then TAB to show the available kernels. Enter the correct kernel and continue.||
||<(^ style="border:none;">4. ~-root=/dev/sdXY-~ ||<style="border:none;">||<(^ style="border:none;">Type (with the correct device such as "sda1", "sdb5", etc) and continue. ||
||<(^ style="border:none;">5. ~-ro-~ ||<style="border:none;">||<(^ style="border:none;">Add any options, such as ~-ro-~, etc. ||
Once all the information on the line is correct it should look similar to the sample below. Press ~-ENTER-~. Look for confirmation.  If successfully entered GRUB 2 will display stored information between [ ] symbols. (First highlighted section below).
||<tablewidth="70%" style="border:none;" bgcolor="#fffbdb" style="font-size:small; border:none;">linux ||<bgcolor="#d3fffb" style="font-size:small; border:none;"> /boot/vmlinuz-2.6.31-9-generic ||<bgcolor="#ffdff4" width="50%" style="font-size:small; border:none;"> root=/dev/sda1 ||<bgcolor="#dffbdb" style="font-size:small; border:none;"> ro||


 Predložak:Attachment:grub2.cli.boot.png
||<(-5 tablewidth="95%" style="border:none;">C. Enter the "initrd" Line Information (Step 6-8) ||
||< tablewidth="50%" bgcolor="#fffbdb" style="font-size:small;">initrd ||<bgcolor="#d3fffb" style="font-size:small;">/boot/initrd.img-2.6.31-9-generic||
||<(^tablewidth="95%" style="border:none;" width="20%">6. ~-linux-~ ||<style="border:none;"> ||<(^style="border:none;"> Type and continue.||
||<(^tablewidth="95%" style="border:none;" width="20%">7. ~-initrd-~ ||<style="border:none;"> ||<(^style="border:none;"> Type, then TAB to show the available kernels. Enter the correct kernel and continue.||
||<(^ style="border:none;">8. ~-/boot/init-~ ||<^ style="border:none;">||<(^ style="border:none;">Type and TAB to show the available kernels.  Enter the correct initrd image. Look for a line similar to the confirmation line highlighted above.||


||<(-5 tablewidth="95%" style="border:none;">D. Boot (Step 9) ||
||<(^tablewidth="95%" style="border:none;" width="20%">9. ~-boot-~ ||<style="border:none;">||<(^ style="border:none;">Boot to the entered kernel/OS. ~-CTRL-x-~ may also work.||


Rescue Mode

The rescue mode is a major GRUB 2 enhancement. If GRUB 2 fails to find a useable grub.cfg and is unable to transfer control to a kernel it will drop to a grub-rescue> prompt. From this prompt the user can investigate problems, make changes, and retry the boot.

The rescue mode provides fewer commands than the normal GRUB prompt line, but also provides these additional commands:


||<(^ tablewidth="95%" tablestyle="border:none; background-color: #fffbdb; font-size:small" rowstyle="border:none;" width="10%" style="border:none; ">Command||<style="border:none" width="5%"> ||<(^ style="border:none" >Result||
||<(^ style="border:none;">dump||<style="border:none" width="5%">||<^ style="border:none;">Clears memory||
||<style="border:none; ">exit||<style="border:none;"> ||<( style="border:none; ">Exit GRUB 2||
||<(^ style="border:none; ">normal||<style="border:none;"> ||<(^ style="border:none;">Return to the standard "grub>" mode if possible.||
The following commands can be used in the grub rescue mode:
||<tablewidth="95%" tablestyle="border:none; background-color: #fffbdb; font-size:small" style="width: 15%; border:none;">||<style="width: 15%; border:none;">||<style="width: 15%; border:none;">||<style="width: 15%; border:none;">||<style="width: 15%; border:none;">||<style="width: 15%; border:none;">||
||<style="border:none; text-align:left;">boot||<style="border:none; text-align:left;">cat||<style="border:none; text-align:left;">chainloader||<style="border:none; text-align:left;">dump||<style="border:none; text-align:left;">exit||<style="border:none; text-align:left;">freebsd||
||<style="border:none;">freebsd_loadenv||<style="border:none; text-align:left;">freebsd_module||<style="border:none; text-align:left;">help||<style="border:none; text-align:left;">initrd||<style="border:none; text-align:left;">insmod||<style="border:none; text-align:left;">linux||
||<style="border:none; text-align:left;">lsmod||<style="border:none; text-align:left;">multiboot||<style="border:none;">normal||<style="border:none; text-align:left;">rmmod||<style="border:none; text-align:left;">set||<style="border:none; text-align:left;">unset||
Predložak:Attachment:info.png If additional commands are needed, the user might try loading the normal GRUB 2 module with `insmod normal`. If successful, `help` and additional commands will be available. 

At the `grub rescue>` prompt, accomplish the following actions to attempt to boot to the latest kernel:

||<(^tablewidth="95%" style="border:none;" width="30%">1. ~-ls-~||<style="border:none;"> ||<(^style="border:none;"> This will display the known devices and partitions. From this information, the user must determine the device and partition on which the system is installed.||
||<(^ style="border:none;">2. ~-set root=/dev/sdXY-~ ||<style="border:none;">||<(^style="border:none;"> X is the device/drive, starting with 0. Y is the partition, starting with 1. (Example: (hd0,1) is sda1. (hd3,5) is sdc5. ||
||<(^ style="border:none;">3. ~-ls /boot-~ ||<^ style="border:none;">||<(^style="border:none;">Inspect the contents. The user should see varioius kernels, initrd images and the grub folder. If not, use the ~-ls-~ command to inspect the device and attempt to find these files and folders. If necessary, set another device as root.||
||<(^ style="border:none;">4. ~-insmod /boot/grub/_linux.mod-~ ||<(^ style="border:none;">||||<(^ style="border:none;">Load the linux module. Without this module loaded, the user will receive an "Unknown command linux" message when trying to load the kernel.||
||<(^ style="border:none;">5. ~-linux /vmlinuz root=/dev/sdXY ro-~||<style="border:none;"> ||<(^style="border:none;">Load the linux kernel, substituting the correct designations for "X" and "Y" (example: sda1). The user will see a message showing the kernel has been loaded. (See graphic above)||
||<(^ style="border:none;">6. ~-initrd /initrd.img-~ ||<style="border:none;">||<(^style="border:none;">Load the initrd image. When pressing enter, the user may or may not see a message in the terminal. (See highlighted graphic above) ||
||<(^ style="border:none;">7. ~-boot-~ ||<style="border:none;">||<(^style="border:none;">Load the initrd image. When pressing enter, the user may or may not see a message in the terminal. (See highlighted graphic above) ||


Resolving an "Unrecognized Device String" (Error 11)

This error message is usually the result of a bad or malformed line within the menuentry. The most common cause is a GRUB 2 upgrade from Jaunty when the user attempts to use the Chainload feature.


 1. During a boot GRUB 2 displays the following message:


   Predložak:Attachment:grub2.unrecognized.device.string.error.png


 1. Remembering there was a problem with the Jaunty chainload entries, the user presses a key to return to the main menu, then "e" until seeing "grub edit>". Edit the highlighted "Chainload into GRUB 2" entry or whichever entry the user attempted to boot.
   Predložak:Attachment:grub2.error.root.png
 1. The user, who has a keen memory, remembers that "root" needs to be changed to "uuid". Using the arrow keys to position the cursor, the "root" entry is replaced with "uuid". When finished editing, the user presses ENTER, then "b" to boot the revised selection. Note these are different commands than used in GRUB 2.
   Predložak:Attachment:grub2.error.uuid.png


Booting an ISO

Under Construction

Splash Images & Theming

GRUB 2 Splash Images

GRUB 2's Splash Image capability is greatly enhanced over its predecessor. Configuring a boot splash image is a two step process: selecting the image to use and choosing the text colors to be displayed.

||<|5 tablewidth="95%" align=center style="border:none">Predložak:Attachment:grub2.lake.splash.png||<style="border:none" width="5%" > ||<style=" vertical-align: center; border:none; ">Install the default GRUB 2 splash image package, install the grub2-splashimages package|| ||<style="border:none"> ||<style="border:none"> `sudo apt-get install grub2-splashimages` || ||<style="border:none"> ||<style="border:none"> Do not mistake this with the grub-splashimages package, which is not compatible with GRUB 2. || ||<style="border:none"> ||<style=" vertical-align: top; border:none; ">The default location for these downloaded images is /usr/share/images/grub. This location must be added to 05_debian_theme or the files copied elsewhere. (See below) || ||<style="border:none"> ||<style="border:none"> Users can create and use their own splash images. ||

Set the splash image

The GRUB 2's splash images are controlled by /etc/grub.d/05_debian_theme. Open this file for editing as root.

Find the following line and edit the highlighted area, replacing it with the path and name of the GRUB 2 splash image you wish to use:

 ||<bgcolor="#fffbdb" style="font-size:small;">for i in {/boot/grub,/usr/share/images/desktop-base}/moreblue-orbit-grub.{png,tga} ; do||

There are several things to note about this entry:

* GRUB 2 by default will look for splash images in /boot/grub and /usr/share/images/desktop-base
* The grub2-splashimages package is not extracted to either of the above folders, but to /usr/share/images/grub
* The user must either:
 * Change the folder location in the above line to point to the correct address, or
 * Move the splash images to one of the folders referenced above.
 * To add the grub folder, make the entry look like this, and change the filename to the desired splash image in /usr/share/images/grub folder.
 ||<bgcolor="#fffbdb" style="font-size:small;">for i in {/boot/grub,/usr/share/images/desktop-base,/usr/share/images/grub}/moreblue-orbit-grub.{png,tga} ; do||
* The filename ends with a period (.) ( /moreblue-orbit-grub~+.+~ )
* Splash image selection:
 * If the same filename exists in more than one folder, the filename in the earliest-designated folder will be used.
 * If the filename exists as more than one type (multiple extensions), the file with the earliest-designated extension will be selected.

The user can make several changes to the above line to expand splash image flexibility:

* Add a user-owned folder in which GRUB 2 will search for available splash images.
* Add the ability use JPEG files as splash images. At this time, only 8-bit JPEG images will display correctly.


The following shows the addition of a user's own splash folder and added JPEG support:

  ||<bgcolor="#fffbdb" style="font-size:small;">for i in {/boot/grub,/usr/share/images/grub,/home/drs/mysplash}/moreblue-orbit-grub.{png,tga,jpg,jpeg} ; do||

Once you have entered the path and filename into 05_debian_theme you can run `sudo update-grub` to add the information into grub.cfg. If adding the splash image was successful, the user will see "Found Debian image..." in the terminal as the command is executed. If this phrase is not seen, the image information was probably not entered.


Set menu font & highlight colors

These lines are contained in /etc/grub.d/05_debian_theme. The instructions do not apply to the "mono" theme settings near the top of the file.


  * The color of non-selected menu entries is set by the line below. The first color is the text color; the second is the background color.
 ||<bgcolor="#fffbdb" style="font-size:small;">  set color_normal=black/black||
  * The code below sets the color of selected entries. The first color is the highlighted text color; the second is the background color of the selected line. If /black is the second entry, the highlighted line will be transparent and only the text will change color.
 ||<bgcolor="#fffbdb" style="font-size:small;">   set color_highlight=magenta/black||

Predložak:Attachment:important.png /black is the GRUB 2 default transparency color when listed second. Change only the first color (i.e. xxxxx/black) if using a splash image. If the second value in this line is changed to a color other than black the splash image will be hidden behind a solid color background.

* In the following graphic, the color_normal setting is white/black. The color_highlight setting is cyan/blue

 Predložak:Attachment:grub2.splash.bar.png

* These colors are available in GRUB 2. "black" as a second entry is considered "transparent".
 ||<-8 tablewidth="85%" width="13%" #000000 bgcolor="white" align="center" style="border:none;" tablestyle="font-size:small;"> ||
 ||< width="13%" #000000 style="color:white;" >black||<width="13%" #0000ff style="color:white;">blue||<width="13%" #804000 style="color:white;">brown||<width="13%" #00ffff>cyan||<width="13%" #333333 style="color:white;">dark-gray||<width="13%" #008000 style="color:white;">green||<width="13%" #E0FFFF>light-cyan||<#5454fe style="color:white;">light-blue||
 ||<#00FF00>light-green||<#999999>light-gray||<#FF00FF>light-magenta||<#fe5454>light-red||<#ff00ff>magenta||<#ff0000>red||<#ffffff>white||<#ffff00>yellow||


Testing Fonts & Splash Images

Predložak:Attachment:info.png Rather than rebooting to test the color combinations, the user can see the changes by using GRUB 2's command line during the boot process.

* Select the splash image and initial font colors as described above, update GRUB 2's files with `sudo update-grub`, and reboot.
* When the GRUB 2 splash image/menu appears, press any key to stop the countdown timer.
* Press c to enter the GRUB 2 command line.
* Experiment with various color/highlight modes. Make changes by typing:
 * `set color_normal=first-color/black`  and/or `set color_highlight=first-color/second-color`
 * Text colors are viewable immediately after the command is entered. You can use the "up" arrow to recall the last command and edit it to quicky test different color combinations.
 * Once you are finished, press ESC to return to the menu.
 * Repeat as desired.
 * Remember the desired color combinations, boot normally and edit /etc/grub.d/05_debian_theme and make the changes permanent.
  Predložak:Attachment:grub2.splash.color.edit.1.png
 * Save the file, then update GRUB 2: `sudo update-grub`

Changing Resolutions w/ Splash Images

If the user wishes to change the resolution of the GRUB 2 screen while using a splash image follow these steps:

1. Set the desired resolution in /etc/default/grub
 * Change the value of ~-GRUB_GFXMODE=-~  (Example: ~-GRUB_GFXMODE=800x600-~)
 * If unsure of what resolutions are available to GRUB 2 they can be displayed by typing `vbeinfo` in the GRUB 2 command line. The command line is accessed by typing "c" when the main GRUB 2 menu screen is displayed. 
1. Select an image of the same size and make the change in /etc/grub.d/05_debian_theme
  * The image name is located in the line beginning with " for i in {/boot"
 * If an image of the correct size is not used, the menu will not be positioned correctly.
 * Use the image editor of your choice to create/resize an image to the correct size.
 * The user may be able to view the image size via Properties in a file browser (check the Properties Image tab in Nautilus).
1. Run update-grub as root to add the new settings to /boot/grub/grub.cfg


Creating User Splash Images

GRUB 2's splash image management makes it easy to use a wide variety of splash images.

Resolution Settings

The images in the grub2-splashimages package are primarily 640x480 images.

GRUB 2 looks for a resolution setting in /etc/default/grub. If uncommented, the resolution is determined by this line:


  ||<bgcolor="#fffbdb" style="font-size:small;">GRUB_GFXMODE=640x480||
  * If no setting is found in /etc/default/grub, GRUB 2 uses the resolution established in /etc/grub.d/00_header, which is set at 640x480.


Image Creation & Setup

Predložak:Attachment:info.png In Ubuntu, refer to the System, Preferences, Display menu for available monitor resolutions, or run `vbeinfo` in the GRUB 2 command line to display available resolutions.


1. Determine the resolution you will use for the GRUB 2 splash image.
1. Create or resize any image to to the appropriate size. 
 * GRUB 2 currently supports .png, .tga, and 8-bit .jpg/.jpeg images. 
  * If using GIMP, naming the file with the applicable extension will save the file in the given format.
1. Make the applicable changes in the GRUB 2 configuration files:
  * /etc/default/grub: Uncomment the GRUB_GFXMODE=640x480 line and change the value if the resolution will be other than 640x480.
  * /etc/grub.d/05_debian_theme: Enter the correct path and filename in the following line. Refer to the previous section for more information on how to edit this line. 
  ||<bgcolor="#fffbdb" style="font-size:small;">for i in {/boot/grub,/usr/share/images/desktop-base}/moreblue-orbit-grub.{png,tga} ; do||
1. Run `sudo update-grub` to incorporate the changes into GRUB 2.

Themes

GRUB 2 Theming is still under development, as is integration with gfxmenu. Theme elements will include colors, fonts, progress indicators, menus, and labels. Both of these hold great promise but are not ready for release with Ubuntu 9.10. Check the Links section at the bottom of this page for references.

 ||<tablewidth="95%" align=center style="border:none;">Predložak:Attachment:grub2.theme.dinxter.png||<style="border:none;" width="15%" > ||<style="border:none;" align=center>Predložak:Attachment:grub2.theme.bennett.png||


Reinstalling GRUB 2

There may be times when a user needs to either move or reinstall a GRUB 2 installation. The former may occur when the user wants to move the installation to another device or reconfigure some of the installation instructions. If a user cannot boot into an operating system at all, even using the [mode] mode, a complete reinstallation of GRUB 2 may be necessary.

Changing or Moving GRUB 2

The command to change the GRUB 2 installation device or boot files is `grub-install` run as root. This command allows the user to modify the installation by setting the ROOT directory, preload modules, run specific setup files and more. When executed, `grub-install` may run one or more other commands, such as `grub-probe`, `grub-mkimage`, and `grub-setup`. Here are some considerations when running `grub-install`:

* The `grub-install` command should be used rather than `grub-setup` under normal circumstances. `grub-setup` will be called by `grub-install` when needed.
* The command should specify a device and when executed will install the required GRUB files to the location called for in the options. (example: `sudo grub-install /dev/sda` )
* If the user attempts to run the command with a specific partition (example: `sudo grub-install /dev/sda6` ) a warning will be issued. Specifying a partition is not recommended due to the use of blocklists, which the developers consider unreliable. An option is provided on how to override this recommendation if the user still wishes to do so.
* The list of options available for `grub-install` can be displayed in a terminal with ~-grub-install --help-~.
* The man page for `grub-install` currently does not display the all the available options.


Reinstalling from LiveCD

If you cannot boot from GRUB 2 review the section Boot Problems & Rescue Mode. If a reinstall becomes necessary follow these instructions:


 1. Boot to the 9.10 Karmic LiveCD Desktop.
 1. Open a terminal - Applications, Accessories, Terminal.
 1. Determine your normal system partition - (the switch is a lowercase "L")
 `sudo fdisk -l`  
  * If you aren't sure, run 
  `df -Th`. Look for the correct disk size and ext3 or ext4 format.
 1. Mount your normal system partition: 
  * Substitute the correct partition: sda1, sdb5, etc.
  * GRUB 2 counts the first drive as "0", but the first partition as "1"
 `sudo mount /dev/sdXX /mnt`
 1. Only if you have a separate boot partition:
  * sdYY is the /boot partition designation (examply sdb3)
  *`sudo mount /dev/sdYY /mnt/boot` 
 1. Mount devices: 
 `sudo mount --bind /dev/ /mnt/dev`
 1. Chroot into your normal system device: 
 `sudo chroot /mnt`
 1. Reinstall GRUB 2: 
  * Substitute the correct device - sda, sdb, etc. Do not specify a partition number.
 `sudo grub-install /dev/sdX` 
 1. Verify the install (use the correct device, for example sda. Do not specify a partition): 
 `sudo grub-install --recheck /dev/sdX`
 1. Exit chroot: 
 ~-CTRL-D-~ on keyboard
 1. Unmount devices:  
 `sudo umount /mnt/dev`
  * If you mounted a separate /boot partition: 
  `sudo umount /mnt/boot`
 1. Unmount last device: 
 `sudo umount /mnt`
 1. Reboot.
 `reboot`


Once the user can boot to a working system, try to determine why the system failed to boot. The following commands may prove useful in locating and/or fixing the problem.

To refresh the available devices and settings in /boot/grub/grub.cfg
  * `sudo update-grub` 
To look for the bootloader location.
  * `grub-probe -t device /boot/grub` 
To install GRUB 2 to the sdX partition's MBR  (sda, sdb, etc.)
  * `sudo grub-install /dev/sdX` 
To recheck the installation. (sda, sdb, etc.)
  * `sudo grub-install --recheck /dev/sdX`   


Uninstalling GRUB 2

Reverting to GRUB Legacy

If a user chooses to return to GRUB legacy (0.97), these steps will remove GRUB 2 and install GRUB.


The command line produces a cleaner uninstall and reinstallation. While adding and removing the packages can be accomplished with Synaptic, certain steps must be accomplished in a terminal.

1. Open a terminal: Applications, Accessories, Terminal.
1. Make backup copies of the main GRUB 2 folders & files. (Optional)
 * `sudo cp /etc/default/grub /etc/default/grub.old`
 * `sudo cp -R /etc/grub.d /etc/grub.d.old`
 * `sudo cp -R /boot/grub /boot/grub.old`
1. Remove GRUB 2
 * `sudo apt-get purge grub2 grub-pc`
 *Predložak:Attachment:important.png The system will be unbootable until another bootloader is installed.
 * Once the packages are removed, many files will still remain in '/boot/grub' 
1. Install GRUB 0.97
 * `sudo apt-get install grub`
1. With grub installed, the user must still create the menu.lst and stage1/stage2 files by running the following two commands.
 A. `sudo update-grub`
  * Generates menu.lst 
   * Tab to "Yes" when prompted.
 A. `sudo grub-install /dev/sdX`
  * Choose the correct device (sda, sdb, etc), normally the one on which Ubuntu is installed.
  * Creates the stage1 & stage2 files in /boot/grub and writes to the MBR.
1. Reboot

Predložak:Attachment:important.pngIf the user receives an "Unrecognized device string Error 11" message on rebooting see the [an "Unrecognized Device String" (Error 11)] section for instructions on how to edit the menu and make the system bootable.


Links

GrubHowTo

External Links

GNU GRUB

GNU GRUB 2 Manual

Illustrated Dual Boot HomePage

http://grub.gibibit.com/Theme_format (Themes)