Download as pdf or txt
Download as pdf or txt
You are on page 1of 23

Grub 2 Basics - Ubuntu Forums http://ubuntuforums.org/showthread.php?

t=1195275

ubuntu.com - launchpad.net - ubuntu help

Search

Or, Sign in using your Launchpad ID

Ubuntu Forums > The Ubuntu Forum Community > Other User Name User Name Remember Me?
Community Discussions > Tutorials & Tips
Grub 2 Basics Password Log in

Register Reset Password Forum Help Forum Council Today's Posts Search

Tutorials & Tips


The place to find Ubuntu related Tips & Tricks.

New Reply Page 1 of 77 1 2 3 11 51 > Last »

Thread Tools Display Modes

June 23rd, 2009

drs305 Grub 2 Basics

Ubuntu Master
Roaster The Grub 2 Guide
(formerly Grub 2 Basics)

New for Natty - Grub 1.99 (RC) - Drag & Drop GRUB Background
Testing Ubuntu 11.04 Natty and Grub 1.99RC? Place a graphic in /boot/grub, run update-grub and you should have a Gru
Read more in this thread:
Grub Background - Simple Drag & Drop

Join Date: Jan 2007


My beans are
GRUB Customizer - Finally a comprehensive GUI Configuration Tool !
hidden!
Daniel Richter has developed a graphical Grub2 configuration application. It's an excellent step in making Grub2 menu ch
Ubuntu
user. It provides users with a method of altering their Grub2 menus without using the command line and obscure comma
Development
available from this Launchpad page. How it works is detailed in this FAQ. Here is the Ubuntu Forum HOWTO on Grub Cu
Release
Grub Customizer
Thank you Daniel!

GRUB Changes to /etc/default/grub Options


Grub 1.98 has made some changes, and Grub 1.99 is making more to the options available in /etc/default/grub
/etc/default/grub for your version:
Code:

strings /usr/sbin/grub-mkconfig | grep "export GRUB" -A 30

For instance, in Grub 1.98 and earlier, the /etc/default/grub entry to hide "Recovery" menu entries was "GRUB_DISABLE_
In G2 1.99 it is currently "GRUB_DISABLE_RECOVERY=true".

Wubi Megathread Guide


Having problems with your Wubi installation? Forum member Rubi1200 has written an excellent comprehensive guide on
problems. View the "Wubi Megathread" at http://ubuntuforums.org/showthread.php?t=1639198

Grub Submenu

1 of 23 17/04/11 16:28
Grub 2 Basics - Ubuntu Forums http://ubuntuforums.org/showthread.php?t=1195275

Test versions of Ubuntu 11.04 (Natty Narwhale) are being released with Grub 1.99. One of the new features is the use of
is still being tweaked, but should hide older kernels in the main OS. Clicking on the Submenu entry will reveal the underl
Submenu kernel as the default initially was not possible, but a patch has been submitted by Colin Watson. The user will b
menuentry title or the "saved" function in /etc/default/grub's GRUB_DEFAULT= setting to set a submenu default.
GRUB_DEFAULT is currently not possible. More details as they become available.

1. Introduction
2. First Look Differences
3. Improvements
4. Booting Grub
5. Grub 2 Files & Options
6. Adding Entries to Grub 2
7. Removing Entries from Grub 2
8. Grub 2 Splash Images & Theming
9. Changing Menu Resolution
10. Password Protection
11. Booting to Recovery Mode w/o Menu Option
12. Uninstalling GRUB 2 > GRUB
13. Reinstalling GRUB 2 from the LiveCD
14. Booting to LiveCD ISO
15. Booting from the Rescue Mode
16. Restoring GRUB2 / XP / Vista / Win 7 Bootloaders
17. Grub Rescue Image
18. Grub 2 Fallback Option
19. Selected Problems & Bugs
20. Links

1. Introduction
I've written this guide to present some basic information about Grub 2. It is meant for users who may be familiar w
original Grub (Grub Legacy) menu.lst and wonder how it carries over to Grub 2. The current version of Grub 2 is 1.
Koala was the first Ubuntu release to use Grub 2 on new installations by default (1.97~beta4). In keeping with Ub
philosophy, 1.97~beta4 will probably remain the official version in 9.10/Karmic and will not be updated to 1.98. In
Grub 2 will refer to 1.98 unless otherwise noted. The user can check their current version with the "grub-install -v"

StartUp-Manager supports Grub 2, but not all options are available. The two most-used items, howeve
setting the menu timeout delay. There are plans for a StartUp-Manager 2 that works only for Grub 2 but it is still u
to its creator. To view a guide on installing and running StartUpManager, view the StartUpManager community do
it was based: http://ubuntuforums.org/showthread.php?t=818177

Official documentation at this point is still being created, which is partly the reason for this post. More comprehens
documentation will hopefully be forthcoming from the developers and volunteers. Of the existing documentation, I
links to the better sources at the end of this post.

For troubleshooting and modifying the Grub menu, it is important to know which version you are using (Grub legac
1.97~beta4; Grub 2 in Lucid 1.9 . To confirm the version of Grub used in your system, run this command:
Code:

grub-install -v

Which should produce something like this:


Quote:

drs305@mycomputer:~$ grub-install -v
grub-install (GRUB) 1.98+20100804-5ubuntu3

2. First Look Differences: GRUB vs GRUB 2


At first boot, there will not be much difference in what the user sees on the boot menu. The one exception is a clean
other installed operating system(s). In this case, GRUB 2 will boot directly to the login prompt or Desktop without
major differences:
No ''/boot/grub/menu.lst''. It has been replaced by ''/boot/grub/grub.cfg''.
Hold down SHIFT to display the hidden menu during boot (formerly ESC is GRUB legacy).
There is no "find /boot/grub/stage1" at the grub prompt. Stage 1.5 has also been eliminated.
The main menu file, ''/boot/grub/grub.cfg'' is not normally edited directly, as it will be overwritten by certain
''grub.cfg'' is overwritten when there is a Grub update, a kernel is added/removed or the user runs `update-g

2 of 23 17/04/11 16:28
Grub 2 Basics - Ubuntu Forums http://ubuntuforums.org/showthread.php?t=1195275

A pre-made custom file, ''/etc/grub.d/40_custom'', is available in which users can place their own entries. Thi
by Grub updates.
The primary configuration file for changing menu display settings is ''/etc/default/grub''.
There are multiple files for configuring the the menu - ''/etc/default/grub'' mentioned above, and all the script
Other operating systems, such as Windows, should automatically be recognized and added to the menu.
No changes made in the configuration files will take effect until the `update-grub` command is also run.
* To update the GRUB 2 menu, the command sudo update-grub will be used throughout this guide.
"grub-mkconfig -o /boot/grub/grub.cfg" This runs several scripts and incorporates the results into /boot/grub/grub.c
seen on the screen during boot. Since the GRUB 2 developers do not intend to remove the update-grub
ease of use.

3. Improvements
GRUB 2's major improvements over the original GRUB include:
New configuration file structure
Scripting support including conditional statements and functions
Dynamic module loading
Rescue mode
Themes - under (very slow development). Users wishing to use theming should search the Internet for "burg
Graphical boot menu support and improved splash capability
Boot Ubuntu LiveCD and some other ISO images directly from hard drive
Non-X86 platform support (such as PowerPC)
Universal support for UUIDs (not just Ubuntu)
Improved internationalization, including support for non-ASCII characters

4. Booting Grub
Grub 2 loads before the operating system. It's modular components are loaded on an as-needed basis. Menu display
determined by settings in /etc/default/grub. Review the "Grub 2 Files & Options" section for specific entry and form

The main options for displaying the menu are:


Initial Default
Grub 2 will boot straight into the default operating system if no other operating system is detected. N
another operating system is detected, the Grub 2 menu will display.
Timed display.
The default delay is 10 seconds. If no user input is made Grub 2 boots to the default entry.
The countdown can be stopped by pressing any key. The user must then make a selectio
The booted entry is determined by the DEFAULT= setting in /etc/default/grub, The first "menuentry"
Hidden
The user can interrupt the boot process and display the menu by holding down the SHI
searches for a depressed SHIFT key signal during boot. If the key is pressed or Grub 2 cannot determi
menu is displayed. Note: The "SHIFT" keystatus check is currently nested within in a conditional state
/30_os-prober and may not work under certain circumstances.
The time the screen remains blank but available for display is determined by a setting in /etc/default/g
To provide visual feedback during while the countdown continues, a countdown display
At the end of the timeout, the default entry determined in /etc/default/grub will be selected.
Saved
If the default option is set to "saved", the last kernel/system successfully booted will be selected and r
Unlike GRUB, GRUB 2 stores the "saved" entry as a string, not as a menu position num
consistently. Example: If the first entry (kernel -15) becomes the second entry due to a kernel update,
entry even though it's position on the menu has changed.

5. Grub 2 Files & Options


Many of the files in /boot/grub will not be recognizable by users of Grub Legacy. Especially noticeable are the multi
modular and these files are loaded as necessary by the grub bootloader.

The Grub 2 user-configurable settings are contained mainly in /etc/default/grub and the files in /etc/grub.d. When
results are input into the /boot/grub/grub.cfg file.
/boot/grub/grub.cfg
This is the main Grub 2 file. It "replaces" Grub Legacy's /boot/grub/menu.lst This file contains the Gru
unlike Grub Legacy's menu.lst file, grub.cfg is not normally meant to be edited as it is the produc
scripts and is overwritten during certain updates. If a user edits grub.cfg, expect the changes to b
updates or disable the ability of the OS to run these updates.
grub.cfg is automatcially generated when "update-grub" is executed:
Each section (### BEGIN) is clearly delineated and references the file in the /etc/grub.d folder
was generated.
grub.cfg is updated by running the "update-grub" or "update-grub2" command as root.
By default, and whenever the "update-grub" command is executed, this file is made "read-only".
intent that the file should not be edited manually. If you must edit this file, instructions are pro

3 of 23 17/04/11 16:28
Grub 2 Basics - Ubuntu Forums http://ubuntuforums.org/showthread.php?t=1195275

Sample grub.cfg including Windows and one manual entry (40_custom):


Code:

#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###


if [ -s $prefix/grubenv ]; then
set have_grubenv=true
load_env
fi
set default="${saved_entry}"
if [ "${prev_saved_entry}" ]; then
set saved_entry="${prev_saved_entry}"
save_env saved_entry
set prev_saved_entry=
save_env prev_saved_entry
set boot_once=true
fi

function savedefault {
if [ -z "${boot_once}" ]; then
saved_entry="${chosen}"
save_env saved_entry
fi
}

function recordfail {
set recordfail=1
if [ -n "${have_grubenv}" ]; then if [ -z "${boot_once}" ]; then save_env recordfa
}

/etc/default/grub
This file contains information formerly contained in the upper section of Grub Legacy's menu.lst
the kernel line. The items in this file can be edited by a user with administrator (root) privileges.
Quote:

# If you change this file, run 'update-grub' afterwards to update


# /boot/grub/grub.cfg.

GRUB_DEFAULT=0
#GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=10
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""

# Uncomment to disable graphical terminal (grub-pc only)


#GRUB_TERMINAL=console

# The resolution used on graphical terminal


# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
#GRUB_GFXMODE=640x480

# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux


#GRUB_DISABLE_LINUX_UUID=true

# Uncomment to disable generation of recovery mode menu entries


#GRUB_DISABLE_LINUX_RECOVERY="true"

# Uncomment to get a beep at grub start


#GRUB_INIT_TUNE="480 440 1"

4 of 23 17/04/11 16:28
Grub 2 Basics - Ubuntu Forums http://ubuntuforums.org/showthread.php?t=1195275

GRUB_DEFAULT - Sets the default menu entry. Entries may be numeric or "saved"
GRUB_DEFAULT=0 - Sets the default menu entry by menu position. As Grub Legacy, the first "menu
second is 1, etc.
GRUB_DEFAULT=saved - (Grub 1.98) Enables the "grub-reboot" and "grub-set-default" commands.
This setting allows the use of the following commands to set a default OS. The defau
interactive selection of an OS from the menu.
grub-set-default. Sets the default boot entry until changed.
The format is "sudo grub-set-default X, with X being the menuentry position (starting wit
exact menu string. Examples: sudo grub-set-default 3 or sudo grub-set-default "Ubuntu,
To obtain the existing menuentry choice number (starting from 0) or the menuentry "s
/boot/grub/grub.cfg"
grub-reboot. This command sets the default boot entry for the next boot only. The format of th
"grub-set-default" (see above).
For an example of how to enable the "saved" option with a custom menu, see the "
GRUB_DEFAULT="xxxx" - An exact menu entry, including the quotation symbols, may also be used.
menu will not matter. Example: GRUB_DEFAULT="Ubuntu, Linux 2.6.31-9-generic"
GRUB_SAVEDEFAULT=true * If set to true this setting will automatically set the last selected OS from th
the next boot. No commands need be run to set the default OS. For this entry to work, the GRUB_DEFAULT
GRUB_TIMEOUT=10 - No change from Grub Legacy. This is the number of seconds before the default entr
Setting this value to -1 will cause the menu to display until the user makes a selection.
To display the menu on each boot use a value of 1 or higher.
This command defers to the GRUB_HIDDEN_TIMEOUT command. If the GRUB_HIDDEN_TIMEOUT
pressing the SHIFT key, the GRUB_TIMEOUT counter begins its countdown.
Caution: Holding down the "SHIFT" key will not display the menu if "GRUB_TIMEOUT=" is set to
In addition to editing the file as root, you can also run the following commands the check and change
first checks the existing timeout, the second replaces the value. Replace T with the new value.
Code:

cat /etc/default/grub | grep 'GRUB_TIMEOUT=' # Checks current TIMEOUT value.


sudo sed 's/GRUB_TIMEOUT=10/GRUB_TIMEOUT=T/g' -i /etc/default/grub # Change TIMEOUT value

GRUB_HIDDEN_TIMEOUT=0
Wait X seconds for a key to be pressed before displaying the menu. If no key is pressed during that tim

GRUB_HIDDEN_TIMEOUT_QUIET=true
Used with the GRUB_HIDDEN_TIMEOUT setting.
true - No countdown is displayed. The screen will be blank.
false - A counter will display on a blank screen for the duration of the GRUB_HIDDEN_TIMEOUT value
This feature currently appears to be broken; the timeout counter isn't appearing when set to 'false' or n
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
Determines the descriptive name in the menu entry. (Ubuntu, Xubuntu, Debian, etc.)
GRUB_CMDLINE_LINUX
If it exists, this line imports any entries to the end of the 'linux' command line (Grub Legacy's "kernel" line) f
modes. This is similar to the "altoptions" line in menu.lst
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
This line imports any entries to the end of the 'linux' line (Grub Legacy's "kernel" line). The entries are appen
mode only. This is similar to the "defoptions" line in menu.lst. For a black screen with boot processes display
splash". To see the grub splash image plus a condensed text output, use "splash". This line is where other in
are placed.

For the GRUB_CMDLINE_LINUX_DEFAULT and GRUB_CMDLINE, quotation marks are required (s


than one alphanumeric entry. For example, quiet splash requires single or double quotes, while an entry suc
#GRUB_TERMINAL=console
Uncomment to disable graphical terminal (grub-pc only). This can be useful if the user plans on spending a
command line mode. Scrolling and screen responsiveness will be greatly speeded up. If enabled, Grub backg
be displayed.
#GRUB_DISABLE_LINUX_UUID=true
Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
Update: A bug requires quotation symbols be added for this option to be enabled. Change true
eliminate UUIDs for linux entries.
#GRUB_GFXMODE=640x480
You can add this line and remove the # symbol to make it active. This entry sets the resolution of the graphi
size). It provides resolutions supported by the user's graphics card (e.g. 640x480, 800x600, 1280x1024, etc
the boot menu text.
From the GRUB 2 menu you can display available resolutions by typing "c" and then at the "grub>" prompt
GRUB_DISABLE_LINUX_RECOVERY=true (GRUB 1.98 & earlier) or GRUB_DISABLE_RECOVERY=tru

5 of 23 17/04/11 16:28
Grub 2 Basics - Ubuntu Forums http://ubuntuforums.org/showthread.php?t=1195275

Add or uncomment this line to prevent "Recovery" mode kernel options from appearing in the menu. If you w
only one kernel, make a special entry in /etc/grub/40_custom.
GRUB_DISABLE_OS_PROBER="true" * Enables/disables the os-prober check of other partitions for opera
Windows, Linux, OSX and Hurd.
GRUB_INIT_TUNE="480 440 1"
Introduced in Grub 1.98 (Lucid)
When uncommented, plays a single beep just prior to the Grub 2 menu display.
The format unless a file is named is: "tempo [pitch1 duration1] [pitch2 duration2] ..."
The duration is based on the tempo. A tempo of 60 gives the duration a value of 1 second, 120 is .5, 2
The length of the tone can be changed by modifying either the tempo (all tones) or duration (individua
Just a bit of fun:
Warning: The menu will not be displayed until the tone is finished
Close Encounters/5 Tone: GRUB_INIT_TUNE="480 900 2 1000 2 800 2 400 2 600 3"
Fur Elise (note long): GRUB_INIT_TUNE="480 420 1 400 1 420 1 400 1 420 1 315 1 370 1 335 1
213 1 262 1 315 1 335 3 213 1 420 1 400 1 420 1 400 1 420 1 315 1 370 1 335 1 282 3
282 3"
Online documentation is available by typing "info grub --index-search play" in a terminal.
* Entries which are not found in the default file and must be added by the user.
/etc/grub.d/
The files in this folder are read during execution of "update-grub" or "update-grub" commands. The co
/boot/grub/grub.cfg

The order of the entries in the grub menu is based on the order of the file names. File named with a st
those beginning with a letter. The order the files are run determines the menu order in grub.cfg.
Custom entries can be added to the "40_custom" file or in a newly created file.

Any file created must be executable in order to be included in the grub.cfg file during the "
00_header
05_debian_theme: Set background and text colors, themes
10_hurd Locates Hurd kernels
10_linux Locates Linux kernels based on results of the "lsb_release" command.
10_lupin Locates Linux kernels in Wubi installs within Windows, among other things.
20_memtest86+: If the file /boot/memtest86+.bin exists, it is included as a menu item.
30_os-prober: Searches for Linux and OS's on other partitions and includes them in the menu.
40_custom: A template for adding custom menu entries which will be inserted into
"update-grub" command. This and any other custom file must be made executable to allow impo

6. Adding Entries to Grub 2


Menu entries can be added to grub.cfg automatically or manually.
Automatically.
When "update-grub" or "update-grub" is executed, Grub 2 will search for linux kernels and other Opera
where is looks is based on the files contained in /etc/grub.d folder.
10_linux searches for installed linux kernels on the same partition.
30_os-prober searches for other operating systems.
Custom User Entries (/etc/grub.d/40_custom).
Entries to grub.cfg can be manually inserted by creating a file in the /etc/grub.d folder.
The name of the file determines the order in the menu. 30_os-prober entries will be
will be placed before 50_my-sample entries.
Any created file must be made executable. This can be done as root by running "sudo
The files in the /etc/grub.d folder will be read and the contents included in grub.cfg
executed as root.
A sample entry. This file creates a menu item for running the SystemRescueCD (previously installed)
sda10. Folders and files must have been copied to the correct location in accordance with the SystemR
actually use this entry. Note this entry will not work for a SystemRescue ISO. See Section 14 for instru
entry to boot ISO images.
Quote:

#!/bin/sh
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.

menuentry "System Rescue CD" {


set root=(hd0,10)
linux /sysrcd/rescuecd subdir=sysrcd setkmap=us

6 of 23 17/04/11 16:28
Grub 2 Basics - Ubuntu Forums http://ubuntuforums.org/showthread.php?t=1195275

initrd /sysrcd/initram.igz
}

Note the new partition naming convention. Devices start counting from "0" as done previou
"hd0", sdb is "hd1", etc. However the first partition is now designated as sda1. Counting
sda5 is "5".
If the user wishes to get visual confirmation in the terminal that the 40_custom fil
"update-grub" is executed, the following line can be added to the /etc/grub.d/40_cus
Quote:

echo "Adding 40_custom menu entries." >&2

Place this line immediately after the first line - "#!/bin/bash" - and before the "e
Tip: If you want to have your custom entries at the top of the menu (say you want custom
"07_xxxx". Since the files in /etc/grub.d/ are read sequentially, those in "07_custom" will be placed bef
recommend not naming a custom menu file lower than 06 so that any theme run from 05_
any custom menu is created. After creating the file, run sudo update-grub and then check the value of
/grub. If it doesn't point to the correct menuentry, change the value of DEFAULT to the correct
Omitting memtest86+: To prevent "memtest86+" entries in your Grub 2 menu, remove the "executa
/20_memtest86+. You can do this via a file browser by selecting "Properties (right click), Permissions
Code:

sudo chmod -x /etc/grub.d/20_memtest86+

Omitting Recovery Mode entries: The file /etc/grub.d/10_linux was recently updated to include
options. Edit /etc/default/grub and add or change this line:
Quote:

GRUB_DISABLE_LINUX_RECOVERY=true # GRUB 1.98 & earlier


GRUB_DISABLE_RECOVERY=true # GRUB 1.99 & later

If you have an older version of /etc/grub.d/10_linux and the above does not work after updating grub, y
mode" entries in your Grub 2 menu, by editing /etc/grub.d/10_linux. If there are no conditional "if" sta
recovery mode, place a comment symbol (#) in front of the following lines (at approximately line 146)
Quote:

# linux_entry "${OS}, Linux ${version} (recovery mode)" \


# "single ${GRUB_CMDLINE_LINUX}"

If you wish to retain one "Recovery mode" entry for insurance, you can add an entry to /etc/grub.d/40_c
the bottom of your grub menu.
Building a Totally Customized Menu: Ok, admit you are a control freak and you want to see only wh
customized titles, no "memtest86+" and no extra kernels. Here is how you do it:
Run sudo update-grub to get the current available kernels.
Copy the desired "menuentry" listings from /boot/grub/grub.cfg to /etc/grub.d/40_cus
starting with "menuentry" and ends with a line containing "}".
Add any other "menuentry" items you wish to see on the boot menu.
Edit the titles of the "menuentry" line if desired (between the quotation symbols).
"menuentry" line. Each entry should start with a "menuentry" line and end with a "}"
Remove the executable bit from /etc/grub.d/10_linux, /etc/grub.d/20_memtest86+
Removing the executable bit from any file in /etc/grub.d will exclude the file from
Code:

sudo chmod -x /etc/grub.d/10_linux /etc/grub.d/20_memtest86+ /etc/grub.d/30_os-probe

Run "sudo update-grub"


The updated /boot/grub/grub.cfg file should now contain only sections for "00_header
The grub.cfg file will not be updated with the addition of a new kernel. To add a ne
"sudo update-grub" to refresh the available kernels, and repeat these instructions.
Don't forget to run "sudo update-grub" after making any changes to your /etc/grub.d
Manual Editing of grub.cfg
Manual editing of /boot/grub/grub.cfg is not normally encouraged, as it can be overwritten by system operati

7 of 23 17/04/11 16:28
Grub 2 Basics - Ubuntu Forums http://ubuntuforums.org/showthread.php?t=1195275

created by various Grub2 scripts, and it is usually preferable to edit the content of the scripts so the changes
The files that should be edited are contained in the /etc/grub.d folders and the /etc/default/grub
should recognize these changes may be overwritten or should disable the ability of the system to update the

In order to discourage its editing, grub.cfg is read-only. If you must edit this file:
Code:

gksudo gedit /boot/grub/grub.cfg

Note: This file is returned to 'read-only' status anytime the update-grub command is run.

7. Removing Entries from Grub 2


Entries should be removed by editing or removing files in the /etc/grub.d folder. The /boot/grub/grub.cfg
require editing.
Automatically.
Too Many Kernels?
If you are not sure of the kernel you are currently using, in a terminal type "uname
Kernels removed via APT (Synaptic, "apt-get remove", etc.) will automatically update
A great tool for removing kernels (and menu entries) is Ubuntu-Tweak, a safe and eas
Many users keep one previous kernel known to work on the machine as a backup.
Synaptic
Type the kernel number in the search window at the upper right (for example - 2.6
Find the "linux-image" and "linux-headers" files for the applicable kernel (example
"linux-image-2.6.26-11-generic).
Right click and select "Mark for Complete Removal" and then press the Apply main
The kernels will be removed from your system and from the Grub menu.
Ubuntu-Tweak
Go to the Ubuntu-Tweak download page.
Add the repository as per the instructions, or download the file manually and doub
Ubuntu-Tweak will be available under Applications > System Tools.
To clean the kernels:
Select "Package Cleaner" on the left and ""Clean Kernel" from the right pane
Press the "Unlock" button at the lower right, enter your password.
Select from the displayed list the kernel images and headers you wish to rem
listed.
Press the "Cleanup" button at the lower right to remove the selected kernel
Too Many Operating Systems?
Other Operating Systems which have been removed from the computer will also be
"update-grub" is run as root.
Menu items are placed on the Grub2 menu by scripts. If you don't want other Oper
in the menu, disable /etc/grub.d/30_osprober
Run this command to stop the script from running: sudo chmod -x /etc/grub
DISABLE_30_OS_PROBER='true' in /etc/default/grub
Memtest86+
Code:

sudo chmod -x /etc/grub.d/20_memtest86+

Run the update-grub command to allow the changes to be incorporated in grub.cfg


User-Created Entries.
To remove a user-created menu entry, remove the applicable file from the /etc/grub.d folder.
If a custom file contains multiple entries, individual items may be removed and others retained.
Once the file has been removed or edited, run "update-grub" to update grub.cfg.

8. Grub 2 Splash Images & Theming


Why reinvent the wheel? Visit this site for an excellent presentation on creating Grub 2 images:
http://members.iinet.net/~herman546/p20/GRUB2%20Splashimages.html

However, if encrypted disks are not an issue, here are the basics:
Manually copy grub splash images into the /usr/share/images/grub folder or install the default grub2 splash
Code:

sudo apt-get install grub2-splashimages

8 of 23 17/04/11 16:28
Grub 2 Basics - Ubuntu Forums http://ubuntuforums.org/showthread.php?t=1195275

The grub2's splash images are normally, but not always, controlled by /etc/grub.d/05_debian_theme. There a
1.99 & later, and 2 variants in Grub 1.98 (see below).
Grub 1.98 late + Grub 1.99 (Maverick / Natty )
Rather than edit the /etc/grub.d/05_header or /usr/share/desktop-base/grub_background.sh
background image designation directly into /etc/default/grub. The path assumes the folder is located i
partition.
Quote:

GRUB_BACKGROUND=/path/filename

Example: GRUB_BACKGROUND="/home/my_username/grub_images/my_grubimage.png"

Grub 1.98 (Lucid)


For Grub 1.98, attempt to open the following two files for editing:
Code:

gksudo gedit /usr/share/desktop-base/grub_background.sh /etc/grub.d/05_debian_theme

If the file /usr/share/desktop-base/grub_background.sh is empty/blank, edit /etc/grub.d/05_debi


If the file /usr/share/desktop-base/grub_background.sh exists, edit this file and not /etc/grub.d/0

Find the following line and edit the highlighted area, replacing it with the path and grub splash imag
Quote:

WALLPAPER="/<path-to-image>/<your-image-name-here-including-extension>"

Example: WALLPAPER="/home/my_username/grub_images/my_grubimage.png"

Grub 1.97~beta4
Find the following line and edit the highlighted area, replacing it with the grub splash image you wish
/usr/share/images/grub):
Quote:

.
for i in {/boot/grub,/usr/share/images/grub}/moreblue-orbit-grub {png,tga} ; do

Note: There is a period ( . ) following the filename.


At one point Grub 2 splash images were downloaded and stored in /usr/share/images/desktop.b
images are stored, change the address in the previous command accordingly ( ... /usr
Save the file, then update grub2:
Code:

sudo update-grub

A Note About Grub 2 Theming


Theming is still under development in Grub 2. There are several different approaches being taken and users
incorporating theming into their bootlaoder menus. For those interested in trying out the experimental them
some references:
GRUB2 theming for lucid? This thread has an excellent discussion about the state of theming in in bootloa
on how to set it up as you get further into the thread. Both BURG and Grub 2 experimental are discussed.
Grub 2 Experimental:
http://grub.gibibit.com/ One method of introducing theming, when combined with this Launcpad PPA for Gr
Zielcke's PPA
BURG:
https://help.ubuntu.com/community/Burg and http://ubuntuguide.net/add-os-logos-into-grub2-boot-menu-us

9. Changing Menu Resolutions


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

9 of 23 17/04/11 16:28
Grub 2 Basics - Ubuntu Forums http://ubuntuforums.org/showthread.php?t=1195275

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 typin
The command line is accessed by typing "c" when the main GRUB 2 menu screen is displ
2. 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 "WALLPAPER=" (Grub 1.9 or " for i in {/boot
If an image of the correct size is not used, the menu may 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 Imag
Images must be .tga, .png, or .jpg (8-bit) images, saved in RGB format (non-indexed).
3. Run update-grub as root to add the new settings to /boot/grub/grub.cfg

10. Basic Password Protection


Note: To reduce the size of this entry, a separate post with information on establishing Grub 2 password protection
forums at: Grub 2 Password Protection and in the links at the bottom of this post.

Grub 2 currently supports unencrypted password protection. Encrypted password protection using PBKDF2, as we
currently under development.

Some of the major points regarding Grub 2 password protection:


Grub 2 has the ability to set password protection on individual menuentries and/or for specific users. Examp
Windows Recovery; prevent user2 from opening the Recovery mode.
If password protection is enabled, the superuser username and password are required to gain access to the G
menu editing modes.
The username and/or password do not have to be the same as the Ubuntu logon name/password.
This is basic password security. The name/password are unencrypted; anyone having physical access to the m
elementary knowledge of how Linux works will be able to access the configuration files and bypass this featu
Grub 2 password protection is still being developed. Encryption is available in experimental versions only. If
recheck your scripts for changes whenever a new Grub 2 update is released. In 1.97~beta4, passwords must
menu item. In Lucid Lynx, expect Grub 1.97 to password protect the entire Grub 2 menu if a

11. How to Boot to the Recovery Mode w/o a Menu Option


1. If you have Grub 2 set to boot without displaying the menu at all, hold the SHIFT key down until the menu d
ESC key.)
2. Press any key once the menu is displayed to 'freeze' it. Then arrow to the kernel you want to boot.
3. Press "e"
4. Scroll to the end of the "linux /boot/vmlinuz...." line. If displayed, remove "quiet" and/or "splash". Add the wo
line.
5. Press CTRL-X to boot to the Recovery menu.

12. Uninstalling GRUB 2


The command line produces a cleaner uninstall and reinstallation. While adding and removing the packages can be
certain steps must be accomplished in a terminal.
Open a terminal: Applications, Accessories, Terminal.
Make backup copies of the main GRUB 2 folders & files
Code:

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

Remove GRUB 2
Ensure you have an Internet connection and reliable power source. An interruption of either could leav
unbootable condition.
Code:

sudo apt-get purge grub-common grub-pc

The user will be warned the system will be unbootable without installing another bootloader.
Once the packages are removed, many files will still remain in '/boot/grub'
Install GRUB 2
Code:

10 of 23 17/04/11 16:28
Grub 2 Basics - Ubuntu Forums http://ubuntuforums.org/showthread.php?t=1195275

sudo apt-get install grub-common grub-pc

The user will be asked for any special commands to add to the default "linux" line.
TAB key to highlight "OK" and press ENTER.
Select the appropriate drive on which to install Grub2 (sda, sdb, etc) by highlighting the entry
Normally a partition (sda1, etc) should not be selected.
Code:

sudo update-grub

Reboot

13. Reinstalling GRUB 2 from LiveCD


If you cannot boot from GRUB 2 and need to reinstall it, here is the simple method. For more details or for advance
community documentation here: Grub2 - Reinstalling GRUB 2:
Boot the Ubuntu Live CD (Try without installing).
From the Desktop, open a terminal - Applications, Accessories, Terminal.
Determine your normal system partition - `sudo fdisk -l` (That is a lowercase L)
If you aren't sure, run `df -Th`. Look for the correct disk size and ext3 or ext4 format.
Mount your normal system partition:
Code:

sudo mount /dev/sdXY /mnt

If you aren't sure if you mounted the correct partition, once it's mounted run "nautilus /mnt" to inspec
correct partition, you should see the normal Ubuntu folders such as /bin, /boot, /etc, /home, etc
Example: sudo mount /dev/sda1 /mnt
Note: The partition to mount is normally the partition on which Ubuntu was installed: sda1, sdb5, etc
partition, use the device on which the /boot partition is located. Grub 2 works best when installed in t
BIOS boots. Also remember that you mount the partition (including the number) in this step, but you
number when you run the "sudo grub-install" command later.
Note: GRUB 2 counts the first drive (X) as "0", but the first partition (Y) as "1"
Only if you have a separate boot partition:
Code:

sudo mount /dev/sdXY /mnt/boot

with sdXY being your /boot partition designation.


Reinstall GRUB 2:
Code:

sudo grub-install --root-directory=/mnt /dev/sdX

Do NOT include the partition number.


Example: sudo grub-install --root-directory=/mnt /dev/sda
Note: Substitute the device on which Ubuntu was installed - sda, sdb, etc. Do not specify a partition n
Unmount the partition *:
Code:

sudo umount /mnt

* Note: If you mounted a separate /boot partition, unmount it first:


Code:

sudo umount /mnt/boot

11 of 23 17/04/11 16:28
Grub 2 Basics - Ubuntu Forums http://ubuntuforums.org/showthread.php?t=1195275

Reboot.

14. Booting LiveCD and Other ISOs


Grub 2 provides the capability to boot certain .iso images. These image files (ISO's) include the Ubuntu LiveCDs
Parted Magic CD.

See the following thread in the Tutorials section for information and instructions on how to boot Ubuntu and other
ISO Booting with Grub 2

15. Booting from the Rescue Mode


One of the improvements of Grub 2 is the ability to recover from a failed boot from the Grub 2 "grub rescue>" or "gr
discussion and instructions on booting from the Grub 2 prompt, please refer to this tutorial:
HOWTO: Boot & Install Ubuntu from the Grub Rescue Prompt

Additional information on the rescue mode is available in the "Command Line & Rescue Mode" section of the Ubun

16. Restoring GRUB2 / XP / Vista / Win 7 Bootloaders


talsemgeest has written an excellent guide on how to restore the bootloaders of various operating systems following
one. Make sure you reference the section for "9.10 and Beyond", which is for GRUB 2.

Rather than duplicate his efforts in this post, here is the link to the original:
http://ubuntuforums.org/showthread.php?t=1014708

Restoring Windows MBR without a Windows CD


If you want to boot directly to Windows but Grub has overwritten the MBR, the normal procdeure is to use the Win
you do not have access to the Windows CD, the following commands will rewrite the MBR, removing Grub and allow
directly into Windows.

Boot the Ubuntu LiveCD, open a terminal (Applications, Accessories, Terminal) and enter the following commands
identify the Windows device (normally sda):
Code:

sudo apt-get install lilo


sudo lilo -M /dev/sda mbr

Bonus Section: BSD Menuentry - If you need to have an entry to boot into BSD/Windows from the Grub2 menu,
into a custom file:
Quote:

menuentry "FreeBSD" {
insmod ufs2
set root=(hd1,1)
chainloader +1
}

17. Grub Rescue Image


A bootable Grub 2 rescue image is available for both floppies and CDs. To obtain the images, install "grub-rescue-p
images are available in /usr/lib/grub-mkrescue. Use the I]grub-mkrescue [/I] command to create the rescue ISO. Se
information. Note: A customized rescue ISO only uses the current systems Grub 2 /boot/grub files. No information
/etc/default/grub is imported.

The ISO only boots to the grub prompt. It uses the Grub 2 files found on the ISO; if the problem is with the system
should boot. However, the ISO contains no kernels and must be told where to find the correct kernel and initrd files
must know the drive/partition on which the boot files are located and the non-Grub files must exist and be uncorrup

If the user hasn't made a rescue floppy/ISO, other alternatives include the Ubuntu Installation/LiveCD or SuperGru
grub-rescue-floppy.img - For floppy images.
To Install:
Insert a disk in the floppy drive.
Code:

fdformat /dev/fd0
mkfs -t msdos /dev/fd0
dd if=/usr/lib/grub-rescue/grub-rescue-floppy.img of=/dev/fd0

12 of 23 17/04/11 16:28
Grub 2 Basics - Ubuntu Forums http://ubuntuforums.org/showthread.php?t=1195275

grub-rescue-cdrom.iso - When burning the image to a CD, select the option to copy an image and
Generate the image using the following command:
Code:

grub-mkrescue --output=<path/filename>

If an error message "/usr/bin/grub-mkrescue: 324: xorriso: not found", install the xorriso
Copy the ISO image to a CD using the CD burning app of your choice.

Once the grub rescue floppy/CD boots to the grub prompt, run the following commands.

The commands are slightly different than those used for booting by other means. The Grub 2 files on the floppy/CD
and initrd.img files need to be loaded.

Command line tips:


Drives start counting at 0 (sda=0, sdb=1, etc). Partitions start counting at 1 (1=1, etc). Substitute the corr
number for Y, and substitute the correct numbers for (hd0,1).
You must type the entire path and kernel and initrd names if (hdX,Y)/vmlinuz and (hdX,Y)/initrd.img do not
running this command:
ls (hdX,Y)/

If vmlinuz and initrd.img do not exist at (hdX,Y)/, you can simplify the typing using the TAB complete featur
On the linux line, type "vml" and then TAB to help complete the kernel number. Ensure the comple
fill the kernel number completely, and don't forget the "root=" and "ro" sections of the linux line.
On the initrd line, type "ini" and TAB to fill in a large part of the name. Continue typing/TABBI
used.
Sections in bold should be changed to match the user's system.

Code:

set root=(hd0,1)
linux (hdX,Y)/vmlinuz root=/dev/sdXY ro
# or if (hdX,Y)/vmlinuz does not exist:
linux (hdX,Y)/boot/vmlinuz-2.6.32.25-generic root=/dev/sdXY ro
# then
initrd (hdX,Y)/boot/initrd.img
# or if (hdX,Y)/initrd.img does not exist:
initrd (hdX,Y)/boot/initrd.img-2.6.33-25-generic
boot

18. Grub 2 Fallback


There is a little-documented 'fallback' capability which allows Grub 2 to select an alternate menuentry should the d
2/Natty uses submenus which may alter the way to use fallback, this section covers Grub 1.98/Maverick & earlie

To designate a fallback menuentry, add the following to /etc/grub.d/40_custom. X is the menuentry number (start c
menuentries at 0):
Quote:

set fallback=X

Notes regarding the Grub 2 Fallback Option:


In Maverick, using the title rather than the menuentry number does not appear to work in /etc/grub.d/40_cu
The title can be used if set fallback="<title>" is placed in /boot/grub/grub.cfg, but is not recommended as
updates.
Instructions for using the fallback option in Natty/Grub 1.99 will be added once Natty is officially released.

19. Selected Problems & Bugs

"out of disk" ,"device not found", "no such device" , "root device" Errors
Causes are many, but can be caused by Grub2 not finding partitions/files it is looking for. Some possible areas to ex
Does your BIOS see the files? Older BIOS may not see past 8GB or 137GB of the partition. You may need to c
partition or adjust the BIOS to use the 'large disk' mode or update the BIOS to allow it to use today's larger d
Some users may need to add "rootdelay=90" to the end of the "linux" line in /etc/default/grub. The might be

13 of 23 17/04/11 16:28
Grub 2 Basics - Ubuntu Forums http://ubuntuforums.org/showthread.php?t=1195275

a long time to recognize the drive.


The BIOS controller mode may need to be changed. Change the BIOS entry for the SATA Controller from from
mode.

Lubuntu Dual Booters - No Windows Menu


Lubuntu apparently doesn't ship with the package os-prober so Windows will not be added to the Grub 2 menu. To
os-prober, update grub and then check to see if Windows is now in the menu:
Code:

sudo apt-get install os-prober


sudo update-grub
grep menuentry /boot/grub/grub.cfg

http://www.gnu.org/software/grub/manual/

Grub Update results in "No Such Disk":


A late July 2010 Grub 2 update is causing a "no such disk" error for some users of WUBI, resulting in an unbootab
doesn't display the original Windows menu, the most likely cause of the failure is that Grub 2 was installed in the M
partition. To correct this, restore the Windows bootloader using this link:
How to restore the Ubuntu/XP/Vista/7 bootloader

Whether the failure is due to improper user selections or Grub 2's failure to recognize a Wubi install, it has been rep
and users can review it for status updates and recovery options when they become available:
https://bugs.launchpad.net/wubi/+bug/610898

"Fix Symbol 'grub-puts' Not Found" Error Message:


http://www.webupd8.org/2010/05/fix-symbol-grubputs-not-found-when.html
If you can get to a normal installation, run the grub-install command or use the "dpkg-reconfigure grub-pc" comma
current partition. If you have to use the Live CD, use chroot to run these commands (see chroot link in my signatur

Note: Most of this information has been incorporated, with a few graphics, into a page in the Ubuntu Help site. I w
up-to-date and users are free to continue to post comments here. The help page is located here: https://help.ubuntu

meierfra has been busily building pages which detail how to solve many of the common problems users are experie
SourceForge web page should be one of the first stops for those seeking answers to Grub 2 issues.

Wubi (Windows Ubuntu) Users - wubildr


Grub2 updates in the spring of 2010 triggered a bug in the ntfs module causing Wubi boot failures. The solution to
posted by Agostino Russo and is found in this Lucid Lynx LaunchPad Bug Report #477169, Post 210
fixed and replacing the "wubildr" file in Windows permanently solves this problem. meierfra has kindly provided cle
this problem at http://sourceforge.net/apps/mediawiki/bootinfoscript/index.php?title=Boot_Problems:W

Lose Ubuntu/Windows After Installing the Other


If you have lost the ability to boot into Windows or Ubuntu following the installation/reinstallation of the other OS i
MBR issue. If the OS was previously working, there is an excellent guide written by talsemgeest that may very wel
the link:
How to restore the Ubuntu/XP/Vista/7 bootloader (Updated for Ubuntu 9.10)

No Menu On Initial Boot


If you are already on the Ubuntu Desktop, run "sudo update-grub". This may detect additional operating systems, w
menu to be displayed on the next boot. Otherwise:
Open /etc/default/grub:
Code:

gksu gedit /etc/default/grub

Disable the "GRUB_HIDDEN_TIMEOUT=" line by placing a # symbol at the beginning of the line.

14 of 23 17/04/11 16:28
Grub 2 Basics - Ubuntu Forums http://ubuntuforums.org/showthread.php?t=1195275

Set "GRUB_TIMEOUT=" to a positive integer (number of seconds to display the menu before automatic sele
press ENTER (no timeout). The entry will look like this:
Quote:

#GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT="10"

Save the file, update grub ("sudo update-grub") and reboot.

External Drive Installs and MBR - Bug bug/414996


When installing Ubuntu to a USB drive, the potential exists for GRUB 2 to write to the hard drive's MBR or split th
hard drive and the USB drive (rather than completely on the USB device). This can render the main drive unbootab

Workaround: During the final stages of the install there is an "Advanced" button which allows the user to select the

HP Machines Fails to Load Grub after Using Windows - Bug bug/441941


After installing Grub 2 on a HP machine, the system boots normally until the first time it's booted into Windows. O
hangs at "Grub loading".

Workaround: HP protection tools are rewriting to the MBR when Windows is run. The protecttools app must be rem
#10 in the Bug Report.

"Grub loading. The symbol ' ' not found. Aborted." on Dell machines..
On Dell computers with Dell DataSafe Local Backup (DDSLB) installed, the above message is displayed with a serie
section. This is a reported bug,
bug #482757. Thanks to merry_meercat's post which details how to fix the problem.

"error: the symbol `grub_xputs` not found".


Use the Live CD to chroot into your Ubuntu partition and purge/reinstall Grub2. See post #5 here:
http://ubuntuforums.org/showpost.php?p=9836539&postcount=5.

"error: unknown filesystem" on old motherboard & BIOS.


If you are using an older motherboard/BIOS, make sure the BIOS and system can read your hard drive. There is a 13
settings that prevents the system from recognizing data placed 'deeper' into the partition. Try creating a /boot part
see if the system now recognizes it. You can also check to see if there is a BIOS update which may eliminate this pr

Grub "error: out of disk" or "failed to boot default entries".


This error message is sometimes generated when Grub 2 cannot properly write to the file /boot/grub/grubenv
Boot_Problems:Write page.

"Grub loading. The symbol ' ' not found. Aborted." on Dell machines..
On Dell computers with Dell DataSafe Local Backup (DDSLB) installed, the above message is displayed with a serie
section. This is a reported bug,
bug #482757. Thanks to merry_meercat's post which details how to fix the problem.

20. Links
Grub 2 (help.ubuntu.com)
Grub 2: Title Tweaks
Grub 2: 5 Common Tasks
Grub 2: Introduction
Grub 2: Purge & Reinstall
Grub 2: ISO Booting with Grub 2
Grub 2: Password Protection

Wubi Megathread by Rubi1200


Grub 2: A Guide for Users (from Kubuntu
Forums)
https://wiki.ubuntu.com/KernelTeam/Grub2Testing
'Official' GNU Grub 2 Manual
GNU Grub 2 Manual/Wiki (in development)
Grub 2 Wiki

15 of 23 17/04/11 16:28
Grub 2 Basics - Ubuntu Forums http://ubuntuforums.org/showthread.php?t=1195275

Herman's Grub 2 Site Comprehensive.


Herman's Grub 2 Scripts Useful scripts for many Grub 2 tasks.
How to restore the Ubuntu/XP/Vista/7 bootloader
http://grub.gibibit.com/ Grub 2 Theming (currently for Ubuntu G2 experimental)
How to restore the Ubuntu/XP/Vista/7 bootloader
http://sourceforge.net/apps/mediawik...itle=Main_Page meierfra's Grub 2 Solutions Page
How-to Install 9.10 karmic on fakeraid by gilson585
How to create a Grub 2 Floppy See post 283 of this thread. Thank you peter b
Customizing the graphics in Grub See post 283 of this thread. Thank you peter b
MultiBootUSB Script to install multiple OS's on thumb/USB drives. Thanks sundar_ima
How to: Create a Customized GRUB2 Screen that is Maintenance Free Thanks Cavsfan

__________________
GRUB2 : Tweaks : Basics : Tasks : ISO : Remove Kernels : PW : Chroot : ISO-Install : Customizer

Last edited by drs305; 2 Weeks Ago at 01:51 PM.. Reason: Editing grub.cfg

July 17th, 2009

foxy123 Re: Grub 2 Basics


Iced Almond Soy
I am running
Ubuntu, No Foam
Code:

sudo update-grub

Join Date: Apr


2005
and have the following:
Beans: 1,189
Code:

~$ sudo update-grub
Updating /boot/grub/grub.cfg ...
Found linux image: /boot/vmlinuz-2.6.28-14-generic
Found initrd image: /boot/initrd.img-2.6.28-14-generic
Found linux image: /boot/vmlinuz-2.6.28-13-generic
Found initrd image: /boot/initrd.img-2.6.28-13-generic
Found linux image: /boot/vmlinuz-2.6.28-12-generic
Found initrd image: /boot/initrd.img-2.6.28-12-generic
Found linux image: /boot/vmlinuz-2.6.28-11-generic
Found initrd image: /boot/initrd.img-2.6.28-11-generic
Found memtest86+ image: /memtest86+.bin
Found Ubuntu karmic (development branch) (9.10) on /dev/sda6
done

But it does not add the last Karmic entry in the menu:

Code:

16 of 23 17/04/11 16:28
Grub 2 Basics - Ubuntu Forums http://ubuntuforums.org/showthread.php?t=1195275

#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by /usr/sbin/update-grub using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###


set default=0
set timeout=5
set root=(hd0,9)
search --fs-uuid --set 9018bfe2-9de3-4692-9883-fc2f875e6455
if font /usr/share/grub/ascii.pff ; then
set gfxmode=640x480
insmod gfxterm
insmod vbe
terminal gfxterm
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/05_debian_theme ###


set menu_color_normal=cyan/blue
set menu_color_highlight=white/blue
### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/10_hurd ###


### END /etc/grub.d/10_hurd ###

### BEGIN /etc/grub.d/10_linux ###


set root=(hd0,8)
search --fs-uuid --set c3eb67b1-7f8f-419b-a462-c79a6c76e5de
menuentry "Ubuntu, linux 2.6.28-14-generic" {

__________________
HP DV6-2113sa Laptop, AMD Turion™ II Ultra Dual-Core Processor M620, 4Gb memory, ATI Radeon™ HD 4530
Graphics, Ubuntu 10.10 64-bit

July 17th, 2009 #3

drs305 Re: Grub 2 Basics

Ubuntu Master Roaster I don't know why grub2 isn't picking it up. I have had a few instances of grub2 not
picking up all the kernels scattered over my drives but I don't remember grub2 actually
ignoring ones that it located.

Here are a couple of things I do when troubleshooting:

a. Change one of the titles so I know the grub.cfg I see when it boots is the one I am
looking at in the editor (i.e. if there are multiple grub.cfg files on your system). You will
have to chmod +w to actually edit grub.cfg

Join Date: Jan 2007 b. Search your system for multiple instances of the file.
My beans are hidden!
Ubuntu Development c. Place the kernel you want to show up in /etc/grub.d/40_custom so at least it shows up
Release when you update grub. At best you will have two instances - the detected and the
custom entries; at worst you will have at least the one from the 40_custom file. Don't
forget to make the file executable.

d. Reinstall grub2 with grub-install.


__________________
GRUB2 : Tweaks : Basics : Tasks : ISO : Remove Kernels : PW : Chroot : ISO-Install :
Customizer

Last edited by drs305; July 18th, 2009 at 07:38 AM.. Reason: 40_custom file problem

17 of 23 17/04/11 16:28
Grub 2 Basics - Ubuntu Forums http://ubuntuforums.org/showthread.php?t=1195275

July 18th, 2009

foxy123 Re: Grub 2 Basics


Iced Almond Soy
It seems I have to unmount the Karmic partition before running 'grub-setup'. It has listed Karmic now. But I
Ubuntu, No Foam
still cannot log in. I have now a message something like:
Code:

booting from kernel on /dev/sda6


you need to load kernel first
Join Date: Apr
2005
Beans: 1,189
The entries in grub.cfg:
Code:

set root=(hd0,8)
search --fs-uuid --set c3eb67b1-7f8f-419b-a462-c79a6c76e5de
menuentry "Ubuntu, linux 2.6.28-14-generic" {
linux /vmlinuz-2.6.28-14-generic root=UUID=9018bfe2-9de3-4692-9883-fc2f875e6455 ro quiet splash
initrd /initrd.img-2.6.28-14-generic

menuentry "Ubuntu karmic (development branch), kernel 2.6.31-2-generic (on /dev/sda6)" {


set root=(hd0,7)
linux /boot/vmlinuz-2.6.31-2-generic root=UUID=6ad1f928-50b9-4aea-9495-95df46d08d58 ro quiet splash
initrd /boot/initrd.img-2.6.31-2-generic

The first entry is for Jaunty, which is my primary OS, the second is for Karmic.

This is my fstab:
Code:

# / was on /dev/sda9 during installation


UUID=9018bfe2-9de3-4692-9883-fc2f875e6455 / ext3 relatime,errors=remount-ro 0 1

# /boot was on /dev/sda8 during installation


UUID=c3eb67b1-7f8f-419b-a462-c79a6c76e5de /boot ext2 relatime 0 2

# /home was on /dev/sda5 during installation


UUID=4802e809-ecaa-4932-bd01-4a816c0bbd4f /home ext3 relatime 0 2

# /media/test_boot was on /dev/sda7 during installation


UUID=0c98fbe4-ed7c-4134-994a-07d49074e137 /media/test_boot ext2 relatime 0 2

# /test was on /dev/sda6 during installation


UUID=6ad1f928-50b9-4aea-9495-95df46d08d58 /test ext3 relatime 0 2

I am a bit lost with all this partition numbers


__________________
HP DV6-2113sa Laptop, AMD Turion™ II Ultra Dual-Core Processor M620, 4Gb memory, ATI Radeon™ HD 4530
Graphics, Ubuntu 10.10 64-bit

July 18th, 2009

drs305 Re: Grub 2 Basics


Ubuntu Master Quote:
Roaster
Originally Posted by foxy123

18 of 23 17/04/11 16:28
Grub 2 Basics - Ubuntu Forums http://ubuntuforums.org/showthread.php?t=1195275

I still cannot log in. I have now a message something like:


Code:

booting from kernel on /dev/sda6


you need to load kernel first

The entries in grub.cfg:


Join Date: Jan 2007 Code:
My beans are
hidden! menuentry "Ubuntu karmic (development branch), kernel 2.6.31-2-generic (on /dev/sda6)" {
Ubuntu set root=(hd0,7)
Development linux /boot/vmlinuz-2.6.31-2-generic root=UUID=6ad1f928-50b9-4aea-9495-95df46d08d58
Release initrd /boot/initrd.img-2.6.31-2-generic

This is my fstab:
Code:

# /test was on /dev/sda6 during installation


UUID=6ad1f928-50b9-4aea-9495-95df46d08d58 /test ext3 relatime 0 2

I am a bit lost with all this partition numbers

Edit: foxy123 has a separate boot partition for his Karmic install as well, so his sda7 entry was correct. The following was
written before I found out the separate test-boot partition was linked to the Karmic installation.

I believe the problem is with your partition numbers. First, a disclaimer. I'm relying on the comments in fstab being
accurate. Since they aren't updated, they really can't be relied upon unless confirmed via "mount", "sudo blkid", or some
other command. So I'm relying on sda6 being the correct partition number. I'm also making the assumption that the
Karmic install is on sda6 and not sda7, since it is the sda6 UUID in the boot menu.

Grub 2 counts partitions a bit differently. sdXY, with X being the device (a,b,c) and Y being the partition number (1,2,3).
The device starts counting at 0 - sda is device 0. The partitions (and this is a change) start counting at 1, so partitio
is counted as 1. So sdb3 is device 1, partition 3.

In your setup, sda6 should be listed as (0,6). Try this as your Karmic entry and see if it works correctly. If it doesn't,
confirm the device and UUID designations by running "sudo blkid -c /dev/null".

Quote:

menuentry "Ubuntu karmic (development branch), kernel 2.6.31-2-generic (on /dev/sda6)" {


set root=(hd0,6)
linux /boot/vmlinuz-2.6.31-2-generic root=UUID=6ad1f928-50b9-4aea-9495-95df46d08d58 ro quiet splash
initrd /boot/initrd.img-2.6.31-2-generic

__________________
GRUB2 : Tweaks : Basics : Tasks : ISO : Remove Kernels : PW : Chroot : ISO-Install : Customizer

Last edited by drs305; July 19th, 2009 at 11:49 AM..

July 18th, 2009 #6

methewjay Re: Grub 2 Basics


First Cup of Ubuntu
What about LILO?

You may have heard about another Linux bootloader called LILO (stands for LInux
LOader). While a sensible option for many Linux users, I believe that GRUB is a better
choice, for several reasons:

19 of 23 17/04/11 16:28
Grub 2 Basics - Ubuntu Forums http://ubuntuforums.org/showthread.php?t=1195275

Join Date: Jul 2009 LILO supports only up to 16 different boot selections; GRUB supports an
Beans: 2 unlimited number of boot entries.
LILO cannot boot from network; GRUB can.
LILO must be written again every time you change the configuration file; GRUB
does not.
LILO does not have an interactive command interface.

All in all, it seems that GRUB is the winner. So let's see what this baby can do.

July 18th, 2009

foxy123 Re: Grub 2 Basics


Iced Almond Soy
well, no luck. Same error. Also after I have it I cannot boot into Jaunty (same error) and have to reboot.
Ubuntu, No Foam
I have checked with sudo blkid -c /dev/null:

Code:
Join Date: Apr
/dev/sda2: UUID="4d5250be-75cf-4ce4-9295-ae5e2cabd441" TYPE="swap"
2005
/dev/sda5: UUID="4802e809-ecaa-4932-bd01-4a816c0bbd4f" TYPE="ext3" - my /home partition
Beans: 1,189
/dev/sda6: UUID="6ad1f928-50b9-4aea-9495-95df46d08d58" TYPE="ext3" - Karmic / partition
/dev/sda7: UUID="0c98fbe4-ed7c-4134-994a-07d49074e137" TYPE="ext2" - Karmic /boot partition
/dev/sda8: UUID="c3eb67b1-7f8f-419b-a462-c79a6c76e5de" TYPE="ext2" - Jaunty /boot partition
/dev/sda9: UUID="9018bfe2-9de3-4692-9883-fc2f875e6455" TYPE="ext3" - Jaunty / partition

In the Jaunty setup the menu points out to a /boot partition (sda8 c3eb67b1-7f8f-419b-a462-c79a6c76e5de). So
I have to use something like:

Code:

menuentry "Ubuntu karmic (development branch), kernel 2.6.31-2-generic (on /dev/sda6)" {


set root=(hd0,7)
linux /boot/vmlinuz-2.6.31-2-generic root=UUID=0c98fbe4-ed7c-4134-994a-07d49074e137 ro quiet splash
initrd /boot/initrd.img-2.6.31-2-generic

But it does not either


__________________
HP DV6-2113sa Laptop, AMD Turion™ II Ultra Dual-Core Processor M620, 4Gb memory, ATI Radeon™ HD 4530
Graphics, Ubuntu 10.10 64-bit

July 26th, 2009 #8

Fintan Re: Grub 2 Basics


Just Give Me the Beans!
Thank you for the background information.

I am having a small issue I cannot figure out. It is not world stopping but annoying.

Join Date: Oct 2004 I have also posted this on the kubuntu forum as I am running Kubuntu but since we are
Location: Switzerland all a family :
Beans: 51 http://kubuntuforums.net/forums/inde...opic=3105336.0

To be short here, my issue is the following:


I have a ubuntu 9.04 and a kubuntu karmic partition with grub2 on a separate /boot.

The grub2 boot menu shows 2 ubuntu's.


One pointing to the swap partition the other going to the correct partition.

20 of 23 17/04/11 16:28
Grub 2 Basics - Ubuntu Forums http://ubuntuforums.org/showthread.php?t=1195275

The details are on the link above.

Any help would be greatly appreciated

As some of mentioned that they cannot see the atch. on the kubuntu site I will add them
here as well. sorry.
Attached Files
grubcfg.txt (2.5 KB, 69 views)
30_os-prober.txt (4.4 KB, 44 views)

Last edited by Fintan; July 26th, 2009 at 10:25 AM..

July 26th, 2009

glide Re: Grub 2 Basics


First Cup of
Hi guys,
Ubuntu
Pretty good guide, thanx.
I have a problem that many guys have aparently,
but I think it's not exactly about the same issue.
Join Date: Feb I get...
2005 Quote:
Location: Paris,
Originally Posted by my computer
France
Invalid or unsupported executable format
Beans: 6
Ubuntu 9.04
Jaunty Jackalope ... when I hit my Windows Grub launcher.

Here is my fdisk
Code:

Disque /dev/sda: 1000.2 Go, 1000204886016 octets


255 têtes, 63 secteurs/piste, 121601 cylindres, total 1953525168 secteurs
Unités = secteurs de 1 * 512 = 512 octets
Identifiant de disque : 0x00063093

Périphérique Amorce Début Fin Blocs Id Système


/dev/sda1 * 63 1941455249 970727593+ 83 Linux
/dev/sda2 1941455250 1953520064 6032407+ 5 Etendue
/dev/sda5 1941455313 1953520064 6032376 82 Linux swap / Solaris

Disque /dev/sdb: 320.0 Go, 320072933376 octets


255 têtes, 63 secteurs/piste, 38913 cylindres, total 625142448 secteurs
Unités = secteurs de 1 * 512 = 512 octets
Identifiant de disque : 0x375e8732

Périphérique Amorce Début Fin Blocs Id Système


/dev/sdb1 * 63 40965749 20482843+ 6 FAT16
/dev/sdb2 40965750 625137344 292085797+ f W95 Etendue (LBA)
/dev/sdb5 40965813 625137344 292085766 7 HPFS/NTFS

Disque /dev/sdc: 203.9 Go, 203928109056 octets


255 têtes, 63 secteurs/piste, 24792 cylindres, total 398297088 secteurs
Unités = secteurs de 1 * 512 = 512 octets
Identifiant de disque : 0x16c175da

Périphérique Amorce Début Fin Blocs Id Système


/dev/sdc1 * 63 398283479 199141708+ 7 HPFS/NTFS

Here is my Windows Grub boot file section:

21 of 23 17/04/11 16:28
Grub 2 Basics - Ubuntu Forums http://ubuntuforums.org/showthread.php?t=1195275

Code:

title Microsoft Windows XP Professional


rootnoverify (hd2,0)
savedefault
makeactive
map (hd0) (hd2)
map (hd2) (hd0)
chainloader +1

My Windows system is actually located in sdc1.

Do somebody have a clue ?

July 26th, 2009 #10

drs305 Re: Grub 2 Basics

Ubuntu Master Roaster Quote:

Originally Posted by glide


My Windows system is actually located in sdc1.
Do somebody have a clue ?

Glide,

I don't have a lot of expertise with setting up dual boots with Windows - if it was
something obvious and I had a solution I'd post it here.
Join Date: Jan 2007
My beans are hidden!
It appears yours is a Grub legacy question. Since this thread was written about Grub 2, I
Ubuntu Development
suggest you create a new thread for your issue. It will get a bit confusing if we mix the
Release
two on this thread.

Thanks.
__________________
GRUB2 : Tweaks : Basics : Tasks : ISO : Remove Kernels : PW : Chroot : ISO-Install :
Customizer

New Reply Page 1 of 77 1 2 3 11 51 > Last »

Bookmarks

Digg del.icio.us StumbleUpon Google

Tags

grub, grub 2, grub2, howto, intro

« Previous Thread | Next Thread »

Posting Rules

You may not post new threads


You may not post replies
You may not post attachments
You may not edit your posts
Forum Jump
BB code is On
Tutorials & Tips Go

22 of 23 17/04/11 16:28
Grub 2 Basics - Ubuntu Forums http://ubuntuforums.org/showthread.php?t=1195275

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Rules

-- cleanv2 ubuntu forums - archive - top

vBulletin ©2000 - 2011, Jelsoft Enterprises Ltd. Ubuntu Logo, Ubuntu and Canonical © Canonical Ltd. Tango Icons © Tango
Desktop Project. bilberry

23 of 23 17/04/11 16:28

You might also like