Δημοσιεύτηκε: 29 Σεπ 2009, 20:56
από ftso
Παρακάτω δίνω κομμάτια του οδηγού.
Όποιος μπορεί να τα μεταφράσει σωστά λέξη λέξη και χωρίς να χαλάσει την μορφοποίηση το αναφέρει και ξεκινάει.
Μόλις τελειώσει, παραθέτει την μετάφραση σε code tag .
Προσοχή! Η ορολογία και οι εντολές θα πρέπει να μείνουν αμετάφραστες.
O grub 2 απ'ότι φαίνεται θα μας συντροφεύει για αρκετό καιρό..οπότε ο οδηγός θα είναι πλήρης και διαχρονικός και για αυτό αξίζει μια προσπάθεια μετάφρασης απ'όλους όσους μπορούν.

ΚΟΜΜΑΤΙ 1 (το ανέλαβε ο vagrale13)
Κώδικας: Επιλογή όλων
[b]SECTION  1[/b]
[b]Introduction[/b]
   History:  GRUB Legacy, GRUB 2
   Differences between GRUB Legacy and GRUB 2
   GRUB 2 commands

[b]History:  GRUB Legacy, GRUB 2[/b]
"Briefly, [i]boot loader[/i] is the first software program that runs when a computer starts. It is responsible for loading and transferring control to the operating system kernel software (such as the Hurd or the Linux). The kernel, in turn, initializes the rest of the operating system (e.g. GNU)." (gnu.org)

The original GRUB (GRand Unified Bootloader) was developed by Erich Stefan Boleyn, from which came the GRUB most of us know, GRUB version 0.9x, and that is now referred to as GRUB Legacy (or even GRUB 1 by some writers).  GRUB 2 replaces GRUB Legacy.  (GRUB 2 is actually the end result of versions GRUB 1.xx; e.g., 1,96, 1.97, ...)

For the history of GRUB and some interesting links, see
http://www.gnu.org/software/grub/

GRUB 2 is cleaner, more efficient, powerful, and more elegant, in many ways it is simpler to use than GRUB Legacy.
GRUB 2:  http://www.gnu.org/software/grub/grub-2.en.html
Its mailing list for development,
GRUB-devel:   http://lists.gnu.org/mailman/listinfo/grub-devel
And the Wiki:   http://grub.enbug.org/

GRUB 2 is the default bootloader in 9.10
https://lists.ubuntu.com/archives/ubuntu-devel-announce/2009-June/000573.html


[b]Differences between GRUB Legacy and GRUB 2[/b]

From the user's view, the biggest difference between the two versions of GRUB concerns the [u]boot menu configuration file[/u].
GRUB 2:   /boot/grub/grub.cfg
GRUB Legacy:   /boot/grub/menu.lst
The configuration file is used to generate the boot menu you see at boot time.
In GRUB Legacy, you can edit menu.lst directly and in any way you wish.
In GRUB 2, you should not edit grub.cfg directly.  Instead, you edit the file /etc/default/grub (which contains some default settings); this file feeds data to scripts in the folder /etc/grub.d.  And you may edit the scripts (text files) in the folder /etc/grub.d; these scripts are used to generate the configuration file /boot/grub/grub.cfg.  When you need a new grub.cfg, simply do sudo update-grub or sudo grub-mkconfig.
[b]It is conceptually simple in GRUB 2[/b]:
You can edit the file /etc/default/grub and you can edit the scripts in /etc/grub.d, then run the command sudo update-grub (or sudo grub-mkconfig), and the file grub.cfg is automatically generated.

[u]The configuration file in GRUB 2 grub.cfg looks different[/u] than the GRUB Legacy menu.lst.  For example, in GRUB legacy, you use
default 0
timeout 5
In GRUB 2, default and timeout are variables, and it is
set default =0
set timeout=5

A boot entry in GRUB Legacy menu.lst might look like this:
title     Ubuntu 8.04.3 LTS, kernel 2.6.24-24-generic
root   (hd1,2)
kernel   /boot/vmlinuz-2.6.24-24-generic root=UUID=0df17bc5-0056-4ef7-bfca-251194b6eb44 ro quiet splash
initrd   /boot/initrd.img-2.6.24-24-generic

In GRUB 2 grub.cfg, it would look like this:

### BEGIN /etc/grub.d/10_Linux ###
menuentry "Ubuntu 8.04.3 LTS, kernel 2.6.24-24-generic" {
set root=(hd1,2)
linux  /boot/vmlinuz-2.6.24-24-generic root=UUID=0df17bc5-0056-4ef7-bfca-251194b6eb44 ro quiet splash
initrd   /boot/initrd.img-2.6.24-24-generic
}
### END /etc/grub.d/10_Linux ###

Note how the title line is changed in GRUB 2:  Use [u]menuentry[/u] instead, put the text in quotes, and start the boot entry with a left brace {, ending it with a right brace }.  Instead of kernel, the word linux is used; initrd is the same.  Instead of root=, in GRUB 2 it is set root= (in GRUB 2, root is not a constant value, it is a variable).

[u]sudo grub does not get you a GRUB 2 shell at Konsole[/u]
In GRUB Legacy, the user may open a GRUB shell by typing sudo grub, and then use it to install/re-install GRUB (root-setup-quit) to a Master Boot Record or to a partition boot sector.  In GRUB 2, there is no such option.  Instead, the key command is the Konsole (BASH) command [u]grub-install.[/u]  At Konsole, as root, you will use sudo grub-install to install/re-install GRUB 2 to a Master Boot Record or to a partition boot sector.

[u]Device names have changed[/u].  In GRUB Legacy, the numbering of both hard drives and partitions start at zero.  (hd0,0) is the first hard drive (hd0), the first partition (partition zero).  [b]In GRUB 2, the numbering of hard drives also starts at zero[/b]: hd0 is the first hard drive.  But [b][u]partition numbering starts at 1[/u][/b]:  (hd0,1) is the first hard drive, the first partition (partition one).

In GRUB Legacy, we use the find command; e.g., grub>find /boot/grub/menu.lst.  [u]In GRUB 2, the search command replaces the find command[/u]:  grub>search /boot/grub/grub.cfg.

In GRUB Legacy, the geometry command (at the grub> prompt) is very useful for listing devices as GRUB sees them on your PC.  It is not used in GRUB 2.  Instead [u]the list command ls[/u] (at the grub> prompt) [u]replaces the geometry command[/u].

GRUB Legacy uses stages: stage_1, stage_1.5, and stage_2.  Those are replaced in GRUB 2 by[u] [b]boot.img[/b][/u] (a 512-byte file that corresponds to stage_1 and is installed to a MBR); there is no stage_1.5 in GRUB 2; and [u][b]core.img[/b][/u] in GRUB 2 takes the place of stage_2 (or, perhaps, of both stage 1.5 and stage_2).  Details:  See Section 4 the subsection "grub-install:  A key command."


[b]GRUB 2  Commands --  compared to GRUB Legacy[/b]
Comparison chart:
http://grub.enbug.org/CommandList
Key useful items to note:

[u][b]GRUB Legacy  <-->  GRUB 2[/b][/u]

[b]find[/b] is replaced with [b]search[/b]
[b]geometry[/b] is gone and replaced by [b]ls[/b]
[b]kernel[/b] (in menu.lst) is replaced by [b]linux[/b] (and other terms for different OSs)
[b]title[/b] (in menu.lst) is replaced by [b]menuentry[/b] (in grub.cfg)
[b]root[/b] is still used but is now [b]a variable[/b]
[b]setup[/b] is gone; the work is done by [b]grub-install[/b]
[b]quit[/b] is gone [b](halt[/b] is sometimes used)
[b]map[/b] is replaced by [b]drivemap[/b]
[b]device[/b] is replaced by [b]loopback[/b] (makes a drive out of a file)
[b]set[/b] is a GRUB 2 term used to set a variable



ΚΟΜΜΑΤΙ 2 (το ανέλαβε ο Epirotes)
Κώδικας: Επιλογή όλων
[b]SECTION  2   Key Facts About the Boot menu, grub.cfg[/b]

   Quick version -- Overview -- Details
   /etc/grub/default  -->  /etc/grub.d  -->  /boot/grub/menu.lst
   Rules for editing grub.cfg, /etc/default/grub, and the script files in /etc/grub.d
   GRUB 2 device numbering (hdx,y) is new:
       Partitions y start at 1; hard drives x start at zero
   Linux device notation is the same: sdxn, x = a, b, c, ... n = 1, 2, 3, ...


Quick version:
/etc/grub/default  -->  /etc/grub.d  -->  /boot/grub/menu.lst
Rules:
--  Do not edit /boot/grub/grub/cfg.
--  You may edit (as root) /etc/default/grub
         (timeout, default OS, kernel options, resolution of the boot menu)
--  You may edit (as root) the scripts in /etc/grub.d.
--  Together, /etc/default/grub and the scripts in /etc/grub.d generate /boot/grub/grub.cfg.
--  To create a script, start with a text file as root: kdesudo kate
--  To make [i]filename[/i] executable: sudo chmod 744 /etc/grub.d/[i]filename[/i]
         or, sudo chmod +x  /etc/grub.d/[i]filename[/i]
--  To remove execute permission from [i]filename:[/i] sudo chmod -x /etc/grub.d/[i]filename[/i]
--  To open Konqueror (Dolphin) as root:  kdesudo konqueror
--  [u]Generate a new configuration file[/u] /boot/grub/grub.cfg after editing /etc/default/grub and after editing, creating, or deleting scripts in /etc/grub.d, as follows:
[b]sudo update-grub[/b]  or  [b]sudo grub-mkconfig[/b]

[u]TODO[/u], check this: grub-mkconfig ... used instead of update-grub in Karmic Koala?
sudo grub-mkconfig ?

IMPORTANT:  [u][b]GRUB 2 device numbering is new[/b][/u]
In GRUB 2 (as in GRUB Legacy), hard drives start at zero:  hd0 is the first hard drive.  In GRUB 2 (unlike GRUB Legacy), partition numbering starts at 1:  (hd0,1) is the first partition in the first hard drive;  (hd0,2) is the second partition in the first hard drive;  (hd1,0) is the first partition in the second hard drive.

[b]Linux device notation is the same as in GRUB Legacy.[/b]
sda is the first hard drive; sdb is the second hard drive; sdc is the third; etc.
sda1 is the first partition of the first hard drive;  sda2 is the second partition of the first hard drive; etc.


[b]Details[/b]
The configuration file is called /boot/grub/grub.cfg, and it generates the [u]boot menu[/u] you see on your screen when you boot your PC (and so, /boot/grub/grub.cfg can be called the boot menu configuration file).  You are NOT supposed to edit it (it is read-only).  It is generated from a folder of scripts called /etc/grub.d.  Another key file is /etc/grub/default and it feeds default data to the scripts in /etc/grub.d.  You may edit /etc/grub/default (as root).  You may also edit the scripts in /etc/grub.d (as root).  If you create a new file in /etc/grub.d, you must make it executable if you want the entry included in the configuration file grub.cfg.  If you do not want a script to execute (and so remove that entry from grub.cfg), you must remove the execute bit (i.e., remove the execute permission).

[b]>>> Key reminder[/b]:
Generate a [u]new grub.cfg after changing anything[/u] in /etc/default/grub or /etc/grub.d, by:
[b]sudo update-grub[/b] or [b]grub-mkconfig[/b]


Experts:  Editing grub.cfg
The file is read-only, so change permission to include Write:
sudo chmod +w  /boot/grub/grub.cfg
Then do the edits as root and Save.  When update-grub is run, the file returns to read-only, AND your edits may be overwritten (and therefore gone).
Optional: After editing, restore permissions to disallow writing:
sudo chmod -w  /boot/grub/grub.cfg   or
sudo chmod 444 /boot/grub/grub.cfg

[b]The default settings file  /etc/grub/default[/b]
This file feeds data to the scripts in /etc/grub.d.  It contains the Default operating system, the Timeout, kernel options, resolution of the graphical boot menu, and other default settings.  You may edit this file with root privileges.

[b]The folder of scripts /etc/grub.d[/b]
These scripts generate /boot/grub/grub.cfg when the [u]update-grub[/u] command (or grub-mkconfig command) is run (as root).  The order of the entries in grub.cfg corresponds to the order of the files in /etc/grub.d, starting with 00_header, then 01_scriptname, etc., through all files starting with NN_ where NN is a 2-digit number and _ is the underscore (Shift+(minus sign)); then comes scripts whose names start with a letter (e.g., a_anotherscript).

You may edit the script files (as root) or create new ones.  To create a new entry in grub.cfg, you simply create a new script file:  a text file that you make executable (like a program).  To remove an entry from   grub.cfg, remove the execute permission from the corresponding script file in /etc/grub.d.  (If the entry corresponds to a custom script you wrote, you may also delete that script file from /etc/grub.d).
See SECTION 4  Special Topics -- Create a custom boot entry.

Editing the script files in /etc/grub.d:
   Do your work as root.
   To make the file /etc/grub.d/[i]filename [/i]executable:
   sudo chmod 744 /etc/grub.d/[i]filename[/i]
   To remove the execute bit from the file [i]filename:[/i]
   sudo chmod -x /etc/grub.d/[i]filename[/i]
   When done, run
   sudo update-grub or sudo grub-mkconfig
   to generate a new boot menu configuration file /boot/grub/grub.cfg.
GUI: How to set permissions
   Open Konqueror or Dolphin as root (e.g., kdesudo konqueror).
   Open the file.
   Right-click > Properties > Permissions, Advanced Permissions


[u]Tip[/u]:  To open a file in /etc/grub.d (as root)
The files in /etc/grub.d are scripts.  So, as root, if you click on one, it will want to execute or run like a program.  Instead, to open a script for editing/viewing, right-click on the script file, Open With Kate or Kwrite.  That opens the file as a text file.  Now you can read it or edit it.
Details:
GUI, working as root:  Open Konqueror (Dolphin) as root and work from there:
kdesudo konqueror
CLI, working as root: kdesudo kate /etc/grub.d/[i]script_name[/i]


Quick reference
The (standard) files in /etc/grub.d (each is a script) are:
00_header
05_debian_theme: Set background, text colors, themes
10_hurd Locates Hurd kernels
10_linux Locates Linux kernels based on results of the lsb_release command.
20_memtest86+: If the file /boot/memtest86+.bin exists, it is included in the boot menu.
30_os-prober: Searches for Linux and other OS's on all partitions; includes them in the boot menu.
40_custom: A template for adding custom boot menu entries.

See Appendix: permissions, working as root, making a file executable, Konsole, and other topics.


=  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =
=  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =
[b]SECTION 3   Fixing Things[/b]
[b]A checklist of things to try to fix a broken system[/b]
  [u]  A Troubleshooting Outline[/u]
   Ctrl+Alt+Del will reboot your PC (at any time)
   Super Grub Disk:  Very Important
   [b]Key commands[/b]:   [u]sudo update-grub[/u] ([u]grub-mkconfig[/u]) and  [u] sudo grub-install[/u]
   Timeout & Default OS, changing
   Kernel options, changing
   To see or to hide the boot menu
   Missing OS entry in the boot menu
   Editing the boot menu during booting: "e" key
   [b]The GRUB prompt grub>  -- What to do with it[/b]
       => Getting information and booting an OS
   [b]Key Rescue Method[/b]:  [u]Re-installing GRUB 2 using Live CD[/u]
   Using a Live CD to edit files in your OS


[b]Troubleshooting Outline[/b]

When you can't boot into your OS, there are two possible causes:
   the boot menu is flawed, and/or
   the GRUB 2 installation is flawed.

To fix it, you have two choices:
   boot into the OS somehow and fix it;
or
   fix it from outside the OS.

Before looking at these two choices, [u]note two important things[/u]:
>   To fix the boot menu means to fix its configuration file /boot/grub/grub.cfg.  You can sometimes do that temporarily using the edit-on-the-fly "e" key (see subsection below).  To fix it permanently, you do NOT edit grub.cfg directly; but rather you edit the file /etc/default/grub and/or you edit the script(s) in /etc/grub.d, and then you run the command update-grub (or grub-mkconfig) to generate a new grub.cfg.
>   To fix the GRUB 2 installation, that usually means re-installing GRUB 2 using, at Konsole, the command grub-install.  You can do this from inside the OS (if you can boot into it somehow), or from a Live Kubuntu CD or from another Linux OS on your hard drive.  You cannot do it from the GRUB 2 prompt (grub>) when booting the PC.  (In GRUB Legacy, you could do it by getting the grub> prompt and using the root and setup commands.)

Now let's look at each of your two choices for fixing the problem.

-->[b] How to boot into your OS when you can't seem to boot into your OS[/b]:
(1) SGD, or (2) use the grub>, or (3) use the "e" key.
Some tips and details:

>  Use Super Grub Disk to boot into it.  You may have SGD fix the boot (under GNU/Linux options), or simply use SGD to boot the OS so you can get into it.  If you use SGD to fix the boot, it will re-install GRUB to your drive, so make sure that's what you want; also, it may do so using either GRUB Legacy or GRUB 2, depending on the SGD CD version you are using.  Of course, if you can get booted into the OS, then you can fix anything and everything, so maybe you won't be feeling too picky at this point.
Note:   As a technical note, along these lines, you can also use your own GRUB 2 disk/flashdrive to boot your OS, if you built one.

>  Boot into your OS yourself, manually, using the GRUB 2 prompt, grub>, ASSUMING you can get the prompt!  (Sometimes, you can't.)  See the Subsection below titled "The GRUB prompt grub>  -- What to do with it."

>  Boot into your OS yourself by fixing the boot menu (editing it "on-the-fly" using the "e" key when you see it on the screen).  But sometimes, you don't see the boot menu.  See the Subsection below titled   "Editing the boot menu during booting: 'e' key"  If you are successful, since these "e" edits are only temporary, after booting into the OS, you must make the changes permanent (by editing /etc/default/grub or the script(s) in /etc/grub.d and then generate a new grub.cfg using update-grub or grub-mkconfig.


--> [b] How to fix the problem from outside the OS[/b]:
(1) Use a Live CD, or (2) Fix it from another OS.
Some details:

>   Use a Live CD.
From a Live Kubuntu CD (or most any live Linux CD), you can re-install GRUB and/or perform edits on files (/etc/default/grub or the script(s) in /etc/grub.d).
See the subsections below:  "Key Rescue Method:  Re-installing GRUB 2 using Live CD" and "Using a Live CD to edit files in your OS."

>   Fix the problem from another Linux OS, ASSUMING you are able to boot into one!
From there, you can edit files in your broken OS and/or re-install GRUB 2 using grub-install.

(NOTE: From the second OS, or even from a Live CD, you'd have to mount the broken OS partition; or perhaps looking in your file manager you'd see it is automatically mounted for you.)


[u][b]SUMMARY -- a summary Troubleshooting outline[/b][/u]

When you can't boot into your OS, there are two possible causes:
   the boot menu is flawed, and/or
   the GRUB 2 installation is flawed.

To fix it, you have two choices:

-->  Boot into the OS somehow and fix it:
   (1) SGD, or (2) use the grub>, or (3) use the "e" key to make temporary edits.
Or
-->  Fix it from outside the OS:
   (1) Use a Live CD, or (2) Fix it from another OS.

Reminders:
---   To fix grub.cfg permanently, do NOT edit grub.cfg directly; edit the file /etc/default/grub  and/or  the script(s) in /etc/grub.d, then run update-grub (or grub-mkconfig) to generate a new grub.cfg.
---   You can re-install GRUB 2 using grub-install from inside the OS or from a Live Kubuntu CD or from another Linux OS.  You cannot do it from the GRUB 2 prompt (grub>) when booting the PC.

[End of Troubleshooting Outline]


[b]Ctrl+Alt+Del will reboot your PC (at any time)[/b]
If your PC freezes up during the experiments/testing/troubleshooting of your bootloader, use [b]Ctrl+Alt+Del[/b] to re-boot the PC.  [u]Be prepared to do something[/u], though!
[u]Examples of what to do[/u]:
--  Before using Ctrl+Alt+Del, put the Super Grub Disk CD in the CD tray so you can re-boot to it and rescue your OS.
--  Be prepared to press the key required to enter your BIOS setup.  That will buy you some time, or give you a chance to change hard drive booting order, or put a live CD or SGD in the CD tray, or get your notes ready, etc.
--  If you have been getting a boot menu, let the PC reboot into it, then enter Edit mode (pressing the "e" key) or enter the GRUB 2 CLI (pressing the key "c"), then try to fix things from there.


[b]Super Grub Disk:  Very Important[/b]
Whether you think you need it or not, get it now, free, as a bootable CD which will get you booted into your operating system in case you can't.  SGD can be downloaded here:
http://www.supergrubdisk.org/
Look for a CD ROM iso version, download it, burn it as an iso image to a CD (using K3b), test it briefly (by running it and stepping through a few menus but not choosing anything; then Quit; or, use it to boot into your OS).  Keep your SGD CD handy.

[u]Tip[/u] (using SGD to boot into your broken OS)
Choose GNU/Linux > Fix Boot, then select the broken partition.
Should you decide to simply Quit the SGD (without doing anything), do so, select reboot, enter your BIOS setup, remove the SGD CD, exit BIOS, and continue rebooting.


[b][u]Key commands[/u][/b]:   [b]sudo update-grub[/b] ([b]grub-mkconfig[/b]) and [b]sudo grub-install[/b]
Use these two commands to "freshen up" your GRUB 2 installation.
update-grub or grub-mkconfig: builds a new boot menu configuration file  boot/grub/grub.cfg.
grub-install:  builds a complete, fresh GRUB 2 installation, including /boot/grub/grub.cfg.

The command
[b][u]sudo update-grub[/u][/b] or [b]grub-mkconfig[/b]
will generate a new boot menu /boot/grub/grub.cfg.  To do so, it uses /etc/default/grub and the scripts in /etc/grub.d.  You should run this command after editing the default file or the scripts.

>  Man page:  (8)UPDATE-GRUB - Generate grub.cfg.
http://grub.enbug.org/FranklinPiat/update-grub.manpage

The command
[u][b]sudo grub-install[/b][/u] [INSTALL_ DEVICE]
installs or re-installs GRUB 2 to INSTALL_DEVICE.

See SECTION 4:    grub-install: A key command:
For now, here's some highlights:

sudo grub-install /dev/sda
installs GRUB 2[u] to the Master Boot Record[/u] of drive sda.  And
sudo grub-install /dev/sda1
installs GRUB 2 [u]to the boot sector[/u] of the partition sda1.
In doing so, grub-install [u]does a complete job of setting up everything[/u]:
[u]Here's what it does[/u]:   It builds the directory /boot/grub (if it doesn't already exit), copies GRUB 2 files to it from the "master" image directory /usr/lib/grub/i386-pc, probes your drives and devices and partition table, makes a new device.map, builds and installs boot.img (to MBR) and core.img, and builds /boot/grub/grub.cfg.

>  Man page:  (8)GRUB-INSTALL - Install GRUB on your drive.
http://grub.enbug.org/FranklinPiat/grub-install.manpage

[u]Troubleshooting[/u]
--  After running sudo update-grub, make sure that the line set default=(hdx,y) is correct (i.e., that the order of the menuentries did not change the default OS position).
--  [b][u]sudo grub-install --recheck[/u][/b]   [INSTALL_DEVICE]
=> If you get an error running sudo grub-install, try it again with sudo grub-install --recheck [INSTALL_DEVICE].


[b]Timeout and Default OS, changing[/b]
The [b]timeout[/b] is the length of time in seconds before the (highlighted) [b]default[/b] OS is automatically booted (if you do not intervene by touching a key).  To change these values, open the file /etc/default/grub as root, make the changes, Save, exit, then generate a new  /boot/grub/grub.cfg by running sudo update-grub.

[u]Opening /etc/default/grub as root[/u]
If your file manager supports it, open the file manager, navigate to /etc/default/grub, right-click on the file, Actions, Edit as Root.  Otherwise:
Open the file manager as root and work from there:
   kdesudo konqueror
   kdesudo dolphin
Or, open the file as root using Kate or Kwrite:
   kdesudo kate /etc/default/grub

Sample (see your file /etc/default/grub):
GRUB_DEFAULT=0
GRUB_TIMEOUT=5

GRUB_DEFAULT=0 selects boot entry #0 (i.e., the first entry) as the default OS to be booted automatically.  Boot entries can be seen in your /boot/grub/grub.cfg file; they start with a line
menuentry "some descriptive text"  {
and end with
}

Boot entries are counted from zero; so the first menuentry is boot entry #0, the second menuentry is boot entry #1, etc.

[u]Troubleshooting Tip[/u]:   [u]Check default OS setting after update-grub[/u]
If you recently added/removed a boot entry (by editing a /etc/grub.d script) and ran sudo update-grub to generate a new boot menu, you might have to check and edit the line "GRUB_DEFAULT= " (in /etc/default/grub) if the default sequence number changed.

(TO DO:  Check also: sudo grub-set-default N.)




ΚΟΜΜΑΤΙ 3(Το ανέλαβε ο MakisM1)

Κώδικας: Επιλογή όλων
[b]Kernel options, changing[/b]
To change these values, open the file /etc/default/grub as root, make the changes, Save, exit.  (See Timeout and Default OS above for editing tips.)  The line in /etc/default/grub looks like this (or similar):
GRUB_CMDLINE_LINUX="quiet splash"


[b]To see or to hide the boot menu[/b]
Look for this line in the file /etc/default/grub:
# GRUB_HIDDEN_TIMEOUT=0

With the # sign present, you will see the boot menu upon booting your PC.
With the # removed, you will not see the boot menu.

For a detailed explanation of the other ways this works, see
GRUB 2 Basics drs305
http://ubuntuforums.org/showthread.php?t=1195275


[b]Missing OS entry in the boot menu[/b]
If you run update-grub, and there is a missing entry in your boot menu, you can add that entry as a custom entry.  See SECTION 4 below, Special Topics   Boot menu:  Create a custom boot entry.


[b]Editing the boot menu during booting using the "e" key[/b]
When you boot/re-boot your PC, the boot menu appears.  If you select an entry (an OS to boot into) and get an error, and if you are able to return to the boot menu (or re-boot again to get it), you may be able to fix things or to experiment with your boot menu to see if something will work.  See the help tips at the bottom of the boot menu.  At the boot menu, highlight an entry, press the "e" key, and you'll see the menuentry statements for that OS.  See the help tips at the bottom of that menu.  If you highlight a line, press the "e" key, that line will be displayed so you can edit it (using arrow keys, delete, etc.).  Pressing ESC returns you to the previous screen.

The edits you make to the boot menu are [u]"on-the-fly" edits and are not permanent[/u].  To make them permanent, you'll have to edit /etc/default/grub and/or the script files in /etc/grub.d, perhaps even making a custom boot entry if necessary (SECTION 4  Special Topics   Boot menu:  Create a custom boot entry), then generate a new /boot/grub/grub.cfg file by issuing sudo update-grub or sudo grub-mkconfig.


[b]The GRUB prompt grub>  -- What to do with it[/b]
      => Getting information and booting an OS

You may get the GRUB prompt grub> in three ways:

>   "c" key:   You re-boot and upon seeing the boot menu, press the "c" key to get the grub>.  (Or Control+c at the Edit mode menu.)  (By pressing the ESC key, you get back to the boot menu.)
Or:
>   No boot menu!   Perhaps, you re-booted your PC and didn't see any boot menu but instead got dropped to the GRUB 2 prompt: grub>.
Or:
>   You get a grub> when re-booting using your own GRUB 2 flash drive (which is what is usually supposed to happen!).

From the grub> prompt, you may be able to issue commands to
   help you gather information about your drives
or
   boot your computer.

Use these resources:
SECTION 4  Special Topics, the subsection
"4 ways to boot an OS" -- direct booting configfile, symlinks, chainloader
SECTION 4  Special Topics, the subsection
"How to get information about your drives and devices"
=> In particular, take special note of [u]the ls command and the use of TAB completion[/u].

Example  Booting using symlinks; and using the ls command

grub>
Use the ls command to see how GRUB 2 sees your drives and partitions:
grub>ls
From the output, you may decide to use ls again, this time listing files in certain directories.
For example, to investigate (hd0,8), you can list the files under the root directory of (hd0,8), like this:
grub>set root=(hd0,8)
grub>ls  /
And then to see the kernel(s) under /boot,
grub>ls  /boot
Or, if you do
grub>ls  (hd0,8)
you'll get the filesystem type and UUID.
Another way to see what's under the root:
grub> ls  (hd0,8)/
(note the slash, no spaces)

Suppose you see or confirm that the OS you want to boot is on (hd0,8) (= sda8).
Then, you might try to boot that OS using symlinks like this:
grub>set root=(hd0,8)
grub>linux /vmlinuz  root=/dev/sda8  ro  quiet splash
grub>initrd /initrd.img
grub>boot

But what if you can't remember the kernel options   ro quiet splash ?
Then this way will also work:
grub>set root=(hd0,8)
grub>linux /vmlinuz  root=/dev/sda8
grub>initrd /initrd.img
grub>boot

(The read-only option, ro, is important, but it is a default option if not specified directly.  Thanks goes to dibl for this information.)

Example   If you need to re-boot or shut down the PC
To reboot, get the GRUB 2 prompt by pressing "c" key, and then
grub>reboot
To shut down
grub>halt

Example   Chainloader
Suppose you had previously installed GRUB 2 to the boot sector of the (hd0,8) partition containing your OS.  (You would have done that using sudo grub-install /dev/sda8)  Then you may boot that OS using chainloader as follows:

grub>set root=(hd0,8)
grub>chainloader +1
grub>boot

Or,
grub>chainloader (hd0,8)+1
grub>boot

(NOTE about using [u]the boot command[/u]
When booting at the grub> prompt, you must use the boot command to make it go.  However, in the configuration file /boot/grub/grub.cfg, you do NOT need to use the boot command--it is implied there.)



[b]Key Rescue Method[/b]:

[b][u]Re-installing GRUB 2 using Live CD[/u][/b]

(In progress.  See reference:
GRUB 2 Live CD Install Guide
http://grub.enbug.org/Grub2LiveCdInstallGuide
Comment:  TODO -- re-test this; it didn't work yet for me, but it might work for you if you have a more current version of GRUB 2 or in 9.10.)
> See Appendix: Chroot, how-to.

-> -> [u]Update 20 September 2009[/u]:

I'm going to give you two ways to try this.  Using the various pre-release version(s) of GRUB 2, I have not been able to get the "chroot" method (GRUB2LiveCdInstallGuide) to work yet.  But I did get something else to work, and I'll call that "Method 1."  Also, for Kubuntu users, I have re-written the "chroot" method to include a few more details.  So, here's Method 1, then the "chroot" method.


[u]Method 1: Installing or re-installing GRUB 2 using a Live CD[/u]

Your Kubuntu Live CD contains GRUB 2 files; specifically, in a live session, you will find the master GRUB 2 "image" files in /usr/lib/grub/i386-pc.  Thus, they can be used to install or re-install GRUB 2.  Here's how ...

Start your Kubuntu Live CD.
Choose the option to try Kubuntu without installing.
Open Konsole (Terminal): K-Menu > System > Konsole
Explore your partitions using
sudo fdisk -lu
Determine your root partition.  In this example, ours is sda2.
Make a mount point (directory) for partition sda2:
sudo mkdir /media/sda2
Mount sda2 on the mount point:
sudo mount /dev/sda2 /media/sda2
Make a mount point (directory) for /dev:
sudo mkdir /media/dev
Mount the devices in your Live CD session:
sudo mount --bind /dev /media/dev
Install (or re-install) GRUB 2 (into the MBR of drive sda) using the GRUB 2 files in sda2:
sudo grub-install --root-directory=/media/sda2  /dev/sda

You may get this error:
grub-probe: error: Cannot find a GRUB drive for /dev/sda8.  Check your device.map.
Auto-detection of a filesystem module failed.
Please specify the module with the option `--modules' explicitly.

If so, try this:
sudo grub-install --recheck --root-directory=/media/sda2 /dev/sda
Installation finished. No error reported.
This is the contents of the device map /media/sda2/boot/grub/device.map.
Check if this is correct or not. If any of the lines is incorrect,
fix it and re-run the script `grub-install'.
(hd0)   /dev/sda

(and so this was successful)

Then, unmount both filesystems:
sudo umount /dev/sda2  /media/sda2
sudo umount /dev  /media/dev
Leave Konsole:
exit
Test it:
Exit out of the Live CD, reboot, see if you fixed your booting problem (by booting into the broken partition).

[End of Method 1]
- - - - - - - - - -

The next method:
[u]Installing or re-installing GRUB 2 using a Live CD[/u]
[u]The "chroot" method[/u] (GRUB2LiveCdInstallGuide)

Steps:
Start your Kubuntu Live CD.
Choose the option to try Kubuntu without installing.
Open Konsole (Terminal): K-Menu > System > Konsole
Explore your partitions using
sudo fdisk -lu
Determine your root partition. Our example to demonstrate this method is sda2.
(If you have a separate /boot partition, see the reference cited.)
Make a mount point (directory) for partition sda2:
sudo mkdir /media/sda2
Mount sda2 on the mount point:
sudo mount /dev/sda2 /media/sda2
Make a mount point (directory) for /dev:
sudo mkdir /media/dev
Mount the devices in your Live CD session:
sudo mount --bind /dev /media/dev
Chroot into sda2:
sudo chroot /media/sda2
Install (or re-install) GRUB 2 (into the MBR of drive sda):
sudo grub-install /dev/sda
Troubleshooting:  If you get Auto-detection of filesystem failed, try:
sudo grub-install --recheck /dev/sda
Exit out of the Chroot by typing exit; or by Control+d.
Unmount both filesystems
sudo umount /dev/sda2 /media/sda2
sudo umount /media/dev
(Reminder: If you have a separate /boot and mounted it above, unmount it now.)
Leave Konsole:
exit
Test it:
Exit out of the Live CD, reboot, see if you fixed your booting problem (by booting into the broken partition).

[u]Comment[/u]   The error messages for me were:
# grub-install /dev/sda
grub-probe: error: cannot find a device for /boot/grub
Auto-detection of a filesystem module failed.
Please specify the module with the option `--modules' explicitly
So, I tried
# grub-install [b]--recheck[/b] /dev/sda
grub-probe: error: cannot find a device for /boot/grub
Auto-detection of a filesystem module failed
Please specify the module with the option `--modules' explicitly.
grub-probe: error: Cannot get the real path of `/dev/sda'
Auto-detection of a filesystem module failed.
Please specify the module with the option `--modules' explicitly.

[End of GRUB2LiveCdInstallGuide]
- - - - -

[b]Using a Live CD to edit files in your OS[/b]
This is done as you would normally do it.  Of course, if you wish, you may use SGD to boot into your OS and do the editing from there.
Here is an outline of a standard way to use your Kubuntu Live CD.

Boot the Live Kubuntu CD, open Konsole, then as root make a directory, mount the filesystem containing the file you need to edit, open that file (possibly as root), edit it, save, quit, unmount the filesystem, exit.
[u]Example[/u]
If the file called file_name that you need to edit is on sdb3 (=(hd1,3)), start a Live CD Kubuntu session, open Konsole:
sudo fdisk -lu     # to see/check your partitions, if necessary
# make a directory called /media/sdb3:
sudo mkdir /media/sdb3
# mount device sdb3 on directory /media/sdb3:
sudo mount /dev/sdb3  /media/sdb3
# change to that directory:
cd /media/sdb3
Then you may proceed in various ways:
Open Konqueror/Dolphin as root, then open the file_name:
in 8.10 or later:   kdesudo konqueror (or dolphin)
in 8.04:  kdesu konqueror (dolphin)
Make your edits, then File > Save, File > Quit.
Or, open  file_name  as root using Kate, then do the edits:
in 8.10 or later:  kdesudo kate /path_to file_name
in 8.04:  kdesu kate  /path_to file_name
Make your edits, then File > Save, File > Quit
# unmount the directory; note the spelling of umount:
sudo umount /media/sdb3