Friday, July 23, 2010

Configuring GRUB2 in Ubuntu

Currently, my main Linux machine is my ASUS EeePC 1000H netbook, running version 10.04 of Ubuntu Netbook Edition. I love it, mainly because it is uber-upgradeable and super-portable. I can stuff it into my small Eagle Creek urban man bag with a day's worth of essentials to cover any computing needs that may arise when my iPhone just isn't enough.

Now, call me crazy, but I like to have my computers display the GRUB boot menu at boot time, even though I generally do not run a dual-OS setup anymore now that I no longer use Windows. My reason for wanting to see the boot menu mainly has to do with the fact that I like to compile and test different kernels every so often, plus I have easy, instant access to memtest86+, should I ever need it.

In the days of old (in this case, as recently as a year or two ago), you would edit the menu.lst file in Ubuntu in order to change the GRUB boot menu settings. Beginning with the previous version of Ubuntu, version 9.10, this changed due to the fact that Ubuntu was updated to run GRUB2. As a result, the configuration file is much different. Outlined below is the very easy process for configuring GRUB2 to show the boot menu upon system startup.

First you need to know which file to edit. In Ubuntu 10.04, for GRUB2, the config file is located at /etc/default/grub. To edit the file simply issue the following command:

    ken@hostname:~$ sudo vi /etc/default/grub

The lines we are concerned with in the grub config file are GRUB_HIDDEN_TIMEOUT  and GRUB_TIMEOUT, shown below. Note that your grub config file may look a little different.

    # If you change this file, run 'update-grub' afterwards to update
    # /boot/grub/grub.cfg.


In order to show the boot menu, add a '#' character at the beginning of the GRUB_HIDDEN_TIMEOUT line.


This inactivates the line by changing it to a comment. Next, delete any values that are located after the '=' character, so that the line now looks the same as I have it below:


The above process is the key element to ensuring that the boot menu displays during startup, but we aren't finished yet. The final step in editing the grub config file is to set the amount of time that the boot menu will stay on screen. To do this, change GRUB_TIMEOUT=0 to GRUB_TIMEOUT=10, replacing 10 with whichever value you want the menu to display for in seconds. In my case, I have it set to 10 seconds.

Finally, to apply the changes that have been made to the grub config file, you'll need to save and close the file, then issue the following command:

    ken@hostname:~$ sudo update-grub

That's it! You can restart your machine and the boot menu will now display at startup. For more information about configuring GRUB2 in Ubuntu 9.10 or later, visit

Enhanced by Zemanta