GRUB Tips
Table of Contents
- Introduction
- How To Use This Document
- Requirements
- Things You Can Do With GRUB
- Back up GRUB
- Boot into recovery mode
- Change default boot order
- Change GRUB time-out
- Display GRUB menu in color
- Display GRUB menu in custom colors
- Edit GRUB by using a Live Ubuntu or Kubuntu CD
- Edit GRUB graphically
- Edit GRUB with a specialized Live CD
- Restore GRUB by using a Live Ubuntu or Kubuntu CD
- Restore GRUB to a specific partition by using a Live Ubuntu or Kubuntu CD
- Text boot with splash screen
- Text boot no splash screen
- Unhide the GRUB menu
- Appendix
- Obligatory Happy Ending
Introduction
This document gives step-by-step instructions on how to do some common things with GRUB in Kubuntu or Ubuntu. It is by no means intended to be an all-inclusive manual. Its intent is to be a reference document containing various tasks you might wish to use GRUB for so you can find them all in one place.
How To Use This Document
- Make sure you meet the requirements in the Requirements section of this document.
- Refer to the Further Information section for links to some pages on the internet that provide more detailed information than is available here.
- Refer to the Questions And Answers section for the answers to questions that commonly come up.
- Refer to the Troubleshooting section if you’ve followed the instructions on this page and something is not working.
Requirements
- A computer running Ubuntu or Kubuntu (both of which come with GRUB by default).
- GRUB, and an understanding of GRUB. See the Further Information and Questions and Answers sections of this document.
- An understanding of how sudo, gksudo and kdesudo work. See the Further Information section of this document.
Things You Can Do With GRUB
Back up GRUB
Back up your /boot/grub/menu.lst file any time you are going to be altering any of its settings!
- This command will make a copy of the file, adding the current date and time to the backed up file’s name. Open a terminal window and type:
sudo cp /boot/grub/menu.lst /boot/grub/menu.lst.`date +%b-%d-%Y~%T`
Boot into recovery mode
WARNING: This method gives you root access to the computer without requiring a log-in.
- When you boot the machine, it will do one of two things:
- If you are dual-booting, it will pause automatically at the GRUB menu for a few seconds before booting into the default operating system.
- If you’re not dual booting, it will pause automatically at a GRUB prompt for a few seconds before booting into the operating system. While the GRUB prompt is visible, you can press the ‘Esc‘ key to bring up the GRUB menu.
- If you select recovery mode, you’ll boot into single-user mode in a terminal.
- Once inside the terminal you can troubleshoot your computer.
Change default boot order
You can change the default boot order by choosing the default entry that GRUB loads when you boot your computer.
- Back up GRUB.
- Open the /boot/grub/menu.lst file by opening a terminal window and typing one of these commands:
- GNOME users:
- KDE users:
- In the editor you just opened, read the file from the top down. Count each line that begins with “title” (ignore everything else!), stopping the count at the entry you wish to have loading by default. In this example, I’ve removed everything except for the “title” lines so you can see how it’s being done. Your title lines might look something like this:
- GRUB starts the count with zero, so begin counting at zero and work your way down to the title line that has the name of the entry you wish to load by default. If, for instance, you want XP to load by default, you must count all the title lines, finishing the count at the XP line. Since we began the count with zero, XP is the 4th entry, as seen here where I used indicators showing how the lines were counted:
- Now that you know the number to use for your default entry, do a search in the file for a line that begins with “default“. The line will look something like this:
- Change the number to the number for your chosen default entry. From our example above, XP was the 4th title entry, so the line would be changed to this:
- Save and exit the file.
- Reboot the computer.
gksudo gedit /boot/grub/menu.lst
kdesudo kate /boot/grub/menu.lst
title Ubuntu, kernel 2.6.20-14-generic title Ubuntu, kernel 2.6.20-14-generic (recovery mode) title Ubuntu, memtest86+ title Other operating systems: title Microsoft Windows XP Home
title Ubuntu, kernel 2.6.20-14-generic <--- 0 title Ubuntu, kernel 2.6.20-14-generic (recovery mode) <--- 1 title Ubuntu, memtest86+ <--- 2 title Other operating systems: <--- 3 title Microsoft Windows XP Home <--- 4
default 0
default 4
NOTE: Whenever the kernel is updated, the new kernel will be added to the file as an entry in GRUB. This will change the numbering of the entries and you’ll need to follow these instructions again to ensure that the proper entry is selected by default.
Change GRUB time-out
To change the GRUB time-out from the default setting of 3 seconds to another value, follow these instructions. In this example, we are changing the timeout to 10 seconds:
- Back up GRUB.
- Open the /boot/grub/menu.lst file by opening a terminal window and typing one of these commands:
- GNOME users:
- KDE users:
- In the editor you just opened, find the timeout line, which will look something like this:
- Change the timeout line to this:
- Save and exit the file.
- Let GRUB know you made changes:
- The next time you boot your machine, GRUB will time-out for the length of time you specified.
gksudo gedit /boot/grub/menu.lst
kdesudo kate /boot/grub/menu.lst
timeout 3
timeout 10
sudo update-grub
Display GRUB menu in color
- Back up GRUB.
- Open the /boot/grub/menu.lst file by opening a terminal window and typing one of these commands:
- GNOME users:
- KDE users:
- In the editor you just opened, find the Pretty colors entry which will look like this:
- Delete the hash mark in front of the second line so the Pretty colors entry now looks like this:
- Save and exit the file.
- Let GRUB know you made changes:
- The next time you boot your machine, GRUB will display in color.
gksudo gedit /boot/grub/menu.lst
kdesudo kate /boot/grub/menu.lst
# Pretty colours #color cyan/blue white/blue
# Pretty colours color cyan/blue white/blue
sudo update-grub
Display GRUB menu in custom colors
If the default color scheme in Pretty colors isn’t quite your style, the colors can be customized to please just about anyone.
Choose custom colors to replace the defaults
- Back up GRUB.
- Open the /boot/grub/menu.lst file by opening a terminal window and typing one of these commands:
- GNOME users:
- KDE users:
- In the editor you just opened, find the Pretty colors entry which, since you’ve already enabled it, will look like this:
- The syntax for this command is:
- Choose the colors you’d rather have the GRUB menu displayed in by using the GRUB color chart below. Note that you can make the foreground color blink by selecting colors from the blinking column of the chart.
- Replace “cyan/blue” and “white/blue” (the default colors) with the colors you picked out. An example of customized colors is:
- Save and exit the file.
- Let GRUB know you made changes:
- The next time you boot your machine, GRUB will display in the custom colors you chose.
gksudo gedit /boot/grub/menu.lst
kdesudo kate /boot/grub/menu.lst
# Pretty colours color cyan/blue white/blue
color foreground/background foreground/background
There are two sets of “foreground/background” in the command. The first set is the foreground and background color of normal menu entries and the second set is the foreground and background color of highlighted entries.
# Pretty colours color light-red/black blink-yellow/brown
sudo update-grub
Choose custom colors for specific menu entries
- Back up GRUB.
- Open the /boot/grub/menu.lst file by opening a terminal window and typing one of these commands:
- GNOME users:
- KDE users:
- In the editor you just opened, find any “title” line you’d like to change. For example:
- Directly beneath the title line you’d like to define custom colors for, add a color line like this example, substituting the colors you like from the GRUB color chart below for “foreground/background” in this example:
- An example of custom colors defined for the Linux menu entry is:
- Save and exit the file.
- Let GRUB know you made changes:
- The next time you boot your machine, GRUB will display in the custom colors you chose.
gksudo gedit /boot/grub/menu.lst
kdesudo kate /boot/grub/menu.lst
title Linux
or:
title Windows XP
color foreground/background foreground/background
title Linux color light-magenta/cyan blink-white/black
sudo update-grub
GRUB color chart
| Foreground colors | Blinking foreground colors | Background colors |
|---|---|---|
| dark-gray | blink-dark-gray | black |
| light-blue | blink-light-blue | blue |
| light-green | blink-light-green | green |
| light-cyan | blink-light-cyan | cyan |
| light-red | blink-light-red | red |
| light-magenta | blink-light-magenta | magenta |
| yellow | blink-yellow | brown |
| white | blink-white | light-gray |
Edit GRUB by using a Live Ubuntu or Kubuntu CD
NOTE: Substitute your hard drive partition information for XdYZ in these commands, using hda1 or sda2 or whatever your device’s name is.
- Boot with the Ubuntu or Kubuntu Live CD.
- Create a mount point by opening a terminal window and typing:
- Mount the partition to that mount point:
- Back up GRUB:
- Open the /boot/grub/menu.lst file:
- GNOME users:
- KDE users:
- In the editor you just opened, make whatever changes you need.
- Save and exit the file.
- Let GRUB know you made changes:
- Restart the computer and remove the Live CD.
sudo mkdir /media/XdYZ
sudo mount /dev/XdYZ /media/XdYZ
sudo cp media/XdYZ/boot/grub/menu.lst media/XdYZ/boot/grub/menu.lst.`date +%b-%d-%Y~%T`
gksudo gedit media/XdYZ/boot/grub/menu.lst
kdesudo kate media/XdYZ/boot/grub/menu.lst
sudo update-grub
Edit GRUB graphically
There’s a script available at https://ubuntuforums.org/showthread.php?t=228104 which gives you a GUI to use for editing GRUB.
NOTE: If you use Gutsy Gibbon, please do not use this script until the author removes the notice on that page stating that it’s not safe to use on Gutsy yet.
Edit GRUB with a specialized Live CD
Super Grub Disk is a Live CD available from https://www.supergrubdisk.org/. You can download the .iso file, burn it to a CD and boot the computer with it to edit GRUB.
Restore GRUB by using a Live Ubuntu or Kubuntu CD
If you had GRUB installed, but somehow lost it because the Master Boot Record got erased or overwritten, you can recover from this by using the Ubuntu or Kubuntu Live CD.
- Boot with the Ubuntu or Kubuntu Live CD.
- Open a terminal window and type:
- Have GRUB search for the device(s) it was previously on:
- Substitute the device GRUB found in step 3 for “hdX,Y” in this command:
- Install GRUB to the Master Boot Record:
- Exit the GRUB shell:
- Restart the computer and remove the Live CD.
sudo grub
This will put you into the GRUB shell where you should have a GRUB prompt like this:
grub>
find /boot/grub/stage1
NOTE: If this command returns more than one device, select the one you’d like GRUB to be installed on.
root (hdX,Y)
setup (hd0)
quit
Restore GRUB to a specific partition by using a Live Ubuntu or Kubuntu CD
If you had GRUB installed to a specific partition instead of to the Master Boot Record, but somehow lost it because the files got erased or overwritten (or you need to restore GRUB after restoring a ghosted drive), you can recover from this by using the Ubuntu or Kubuntu Live CD.
- Boot with the Ubuntu or Kubuntu Live CD.
- Open a terminal window and type:
- Have GRUB search for the device(s) it was previously on:
- Substitute the device GRUB found in step 3 for “hdX,Y” in this next command:
- Substitute the device GRUB found in step 3 for “hdX,Y” in this next command:
- Exit the GRUB shell:
- Restart the computer and remove the Live CD.
sudo grub
This will put you into the GRUB shell where you should have a GRUB prompt like this:
grub>
find /boot/grub/stage1
NOTE: If this command returns more than one device, select the one you’d like GRUB to be installed on.
root (hdX,Y)
setup (hdX,Y)
quit
Text boot with splash screen
Choose one of these methods if you’d like a text boot accompanying the splash screen:
Temporary method 1
- When the Ubuntu or Kubuntu logo is on the screen, press all of these keys at the same time:
Ctrl + Alt + left arrow
Note: I haven’t tested this method (I keep forgetting to), so try it at your own risk.
Temporary method 2
- When the GRUB menu appears, highlight the Ubuntu Linux entry.
- Press the ‘e‘ key.
- Go to the kernel line that looks something like this:
- Press the ‘e‘ key again.
- Remove the word ‘quiet‘ from that line.
- Press the ‘Enter‘ key to accept the change.
- Press the ‘b‘ key to boot the machine.
kernel /vmlinuz-2.6.22-14-generic root=UUID=XXXXXXXXXX ro quiet splash
Text boot no splash screen
Choose one of these methods if you’d like a full text boot with no splash screen:
Temporary method 1
- When the Ubuntu or Kubuntu logo is on the screen, press both of these keys at the same time:
Alt + left arrow
Temporary method 2
- When the GRUB menu appears, highlight the Ubuntu Linux entry.
- Press the ‘e‘ key.
- Go to the kernel line that looks something like this:
- Press the ‘e‘ key again.
- Remove the ‘quiet’ and ‘splash’ options.
- Press the ‘Enter‘ key to accept the changes.
- Press the ‘b‘ key to boot the machine.
kernel /vmlinuz-2.6.22-14-generic root=UUID=XXXXXXXXXX ro quiet splash
Permanent method 1
This will need to be repeated whenever you get a new kernel.
- Back up GRUB.
- Open the /boot/grub/menu.lst file by opening a terminal window and typing one of these commands:
- GNOME users:
- KDE users:
- In the editor you just opened, find the kernel line which will look something like this:
- Delete the words ‘quiet‘ and ‘splash‘ and replace them with the word ‘verbose‘.
- Save and exit the file.
- Let GRUB know you made changes:
- The next time you boot your machine, you’ll have a full text boot in that kernel.
gksudo gedit /boot/grub/menu.lst
kdesudo kate /boot/grub/menu.lst
kernel /vmlinuz-2.6.22-14-generic root=UUID=XXXXXXXXXX ro quiet splash
sudo update-grub
Permanent method 2
This will work even when you get a new kernel.
- Back up GRUB.
- Open the /boot/grub/menu.lst file by opening a terminal window and typing one of these commands:
- GNOME users:
- KDE users:
- In the editor you just opened, find this line:
- Remove the words ‘quiet‘ and ‘splash‘ from the line.
- Advanced: If you’d like high resolution text, you can add ‘vga=791‘ to the line.
- Save and exit the file.
- Let GRUB know you made changes:
- The next time you boot your machine, you’ll have a full text boot.
gksudo gedit /boot/grub/menu.lst
kdesudo kate /boot/grub/menu.lst
# defoptions=quiet splash
sudo update-grub
Unhide the GRUB menu
If you only have one operating system on your computer, you need to press the Esc key to get into the GRUB menu on boot. If you’d rather have the menu displayed for a few seconds during each boot, this setting can be changed.
- Back up GRUB.
- Open the /boot/grub/menu.lst file by opening a terminal window and typing one of these commands:
- GNOME users:
- KDE users:
- In the editor you just opened, find the line that says “hiddenmenu” as in this example:
- Place a hash mark in front of that line, as in this example:
- Save and exit the file.
- Let GRUB know you made changes:
- The next time you boot your machine, the GRUB menu will be displayed automatically.
gksudo gedit /boot/grub/menu.lst
kdesudo kate /boot/grub/menu.lst
## hiddenmenu # Hides the menu by default (press ESC to see the menu) hiddenmenu
## hiddenmenu # Hides the menu by default (press ESC to see the menu) #hiddenmenu
sudo update-grub
Appendix
Further Information
- To learn how sudo, gksudo and kdesudo work, see https://help.ubuntu.com/community/RootSudo and https://www.psychocats.net/ubuntu/graphicalsudo for detailed information.
- Instructions for using GrubEd can be found at https://www.arsgeek.com/?p=455.
- The GNU GRUB home page at https://www.gnu.org/software/grub/ contains a wealth of information about GRUB.
Questions and Answers
- What is GRUB?
- GRUB stands for GRand Unified Bootloader. A boot loader is the first program that runs when your computer starts, determining which operating system gets loaded.
- I have a question that hasn’t been asked here. How do I ask it?
- If you use the contact address at the top of this document, you will receive a reply via email and your question may be added to this section.
Troubleshooting
- Make sure that you meet the requirements in the Requirements section.
- If you need more interactive help, see my GettingHelp page.
Obligatory Happy Ending
And they all lived happily ever after. The end.

That’s probaby the best guide for Grub. I like to read a similar one for Grub 2.
Comment by Ikem — September 4, 2012 @ 6:16 am
Thanks! I’ll see if I can put one together, although Grub 2 and I haven’t been formally introduced yet since I haven’t had any reason to do any Grub work lately (knock on wood). :)
Comment by mostlylinux — June 2, 2013 @ 8:39 am