GRUB Menu tips for Linux

Posted in
Linux, Tips, Tutorials

Posted on
26-03-2009

0 comments

0

If you have installed Linux (any format) onto your machine, either standalone or as part of a dual boot system, you would have seen the GRUB menu pop up. This screen usually appears when you start your machine and offers you a choice of operating system to install.

Sometimes, you may want to hide this menu (ie, go straight to the login screen) or show it if it is hidden or change the amount of time it stays up.

This article shows you how to change the above parameters. While you can use packages such as "start up manager" to do your changes, I wanted to edit the configuration files manually just so that we can get a bit of practice on how to use the terminal window and editing text files :)

Before we begin, a warning please:

Be very careful when you are making changes to this file. It is possible that if you accidently overwrite, or delete lines in here, your GRUB menu may get corrupted. So follow the instructions carefully.

How to Show or Hide the GRUB Menu in Ubuntu Linux:

In order to do this, log into your Linux sytem (We’re using Ubuntu here so our text editor will be gedit. For others, it may be nano or vi, etc) and open up the terminal window.

Ubuntu LinuxStep 1 – click on Programs –> Accessories –> Terminal Client. A window will open up.

Step 2 – type in the following and hit enter:

sudo gedit /boot/grub/menu.lst

You will get a password prompt. Enter your root password here. This is the password you would have set up when installing the system and is also known as the admin password.

The command sudo simply gives your administration rights as the file you will be editing is a "system" one.

Once you have entered the password correctly, your text editor will open up as below:

Ubuntu Linux Step 3 – scroll down the page until you see the following section:

     ## hiddenmenu
     # Hides the menu by default (press ESC to see the menu)
     hiddenmenu

To show the GRUB menu, put a “#” in front of the third line.. The “#” means that that line will be ignored by the application and so the line is not run and the menu is not hidden.

To hide the GRUB menu, ensure that the third line above doesn’t have a “#” in front of it.

 

 

Step 4 – Save the file and close the text editor. Reboot your machine and the menu should appear (or not) based on your settings above :)

How to change the timeout on the GRUB Menu

Right, so we may have the menu appearing, but (if you are like me), you may wish to change the amount of time it stays up before it chooses the default OS.

Lets start. Do Steps 1 and 2 above again. So we start with you on Linux having your menu.lst file open in a text editor.

Step 3 – find the following line in the window:

## timeout sec
# Set a timeout, in SEC seconds, before automatically booting the default entry
# (normally the first entry defined).
timeout 30 <— the number here may be different

Ubuntu Linux GRUBStep 4 – the number after the “timeout” line (fourth line above) dictates that amount of time in seconds the menu will stay up for. Feel free to change that number to something larger or smaller depending on your requirements.

Step 5 – Save the file, and exit the text editor by closing the window. Feel fee to close the terminal window too.

Thats pretty much it. Reboot and the GRUB menu should now be shown for as long as your defined it

Note: putting a “#” in front of the “timeout 30″ line will comment it out and not make it run. This will mean that the computer will not choose any default options and will wait for you to choose one before loading. Effectively removes the “timeout”.

Write a comment