Home > ubuntu > Grub2 essentials

Grub2 essentials

A very nice documentation that contains everything you need to know about Grub2: https://help.ubuntu.com/community/Grub2.

Here I will make a brief summary of the most important things.

  • /boot/grub/grub.cfg is the main file, but you are not supposed to edit it! It is generated automatically from some other config files.
  • grub.cfg is updated by running the update-grub command as root
  • grub.cfg is automatically updated with kernel installations/removals
  • /etc/default/grub : this configuration file contains information formerly contained in the upper section of GRUB’s menu.lst and items contained on the end of the kernel line. Modifications in this file will be incorporated in grub.cfg.
  • /etc/grub.d/ : the files in this directory are read during execution of the update-grub command and their instructions are incorporated into /boot/grub/grub.cfg.

Some tasks and their solutions:

Q: How to modify the countdown time at boot up?
A: Open /etc/default/grub and look for the line with GRUB_TIMEOUT. Don’t forget update-grub at the end.

Q: You had Windows and you installed Ubuntu in another partition. Now when you switch on the computer, by default Ubuntu will start up. How to set Windows to start by default?


A: First, find out the exact menu entry of Windows. For this, execute the command grep menuentry /boot/grub/grub.cfg . In my case I get this:

menuentry "Windows 7 (loader) (on /dev/sda1)" {

Now edit /etc/default/grub and modify this line:

GRUB_DEFAULT="Windows 7 (loader) (on /dev/sda1)"

Here I copied the string that I got in the previous step. In your case it can be different, so don’t copy/paste the line above!

This way location in the menu will not matter. Don’t forget update-grub when finished.

If you want to start the first entry, use this line instead:


Update (20150731)
There is a nice GUI for editing GRUB entries (remove, rename, etc.) and settings called GRUB-Customizer.

Categories: ubuntu Tags: ,
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: