GRUB 2 boot menu basics and how to add a custom splash image

GRUB 2 is the boot loader that is used by all current Linux Distributions. In this guide, I will explain how to modify the GRUB boot loader menu on your server or desktop, how to add menu entries and add a custom splash screen image.

GRUB 2 overview.

One of the important features in GRUB 2 is flexibility; GRUB understands filesystems and kernel executable formats, so you can load an arbitrary operating system the way you like, without recording the physical position of your kernel on the disk. Thus you can load the kernel just by specifying its file name and the drive and partition where the kernel resides.

The configuration file of GRUB has a new name (‘grub.cfg’ rather than ‘menu.lst’ or ‘grub.conf’), new syntax and many new commands. Configuration cannot be transferred directly, although most GRUB Legacy users should not find the syntax too surprising. The file "grub.cfg" is automatically generated by the command:


Editing your GRUB menu.

Starting with the main file of GRUB "/boot/grub/grub.cfg". This file is automatically generated and is not meant to be edited directly.You can use any editor you want to display the file. Have a look at the image below.

The GRUB 2 user file to be edited can be found in two places.

/etc/default/grub to change boot menu options.
/etc/grub.d/ to edit the script files which create "grub.cfg".

To start editing boot menu options go ahead and type :

gksu gedit /etc/default/grub

The things you will be able to change are :

GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`

Explaining each one of them lets start with

GRUB_DEFAULT= The default menu entry. This may be a number, in which case it identifies the Nth entry in the generated menu counted from zero, or the title of a menu entry, or the special string "saved". Using the title may be useful if you want to set a menu entry as the default even though there may be a variable number of entries before it.


GRUB_HIDDEN_TIMEOUT= Boot the default entry this many seconds after the menu is displayed, unless a key is pressed. The default is "5". Set to "0" to boot immediately without displaying the menu, or to "-1" to wait indefinitely.

GRUB_HIDDEN_TIMEOUT_QUIET= Will display a count down timer if set to false, If set to true will simply display a blank screen all before displaying the actual GRUB menu.

GRUB_TIMEOUT= This is the number of seconds GRUB will display the menu before booting the default option. Setting it to "0" will boot the default option instantly without displaying the menu. Whereas setting in to "-1" will hold up the menu till the user selects an option.

GRUB_DISTRIBUTOR=lsb_release -i -s 2> /dev/null || echo Debian This line simply retrieves the name in the menu entry.

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash" Removing "quiet" out here will display a text output during the boot, whereas removing "splash" will display a black screen instead of the splash image.

You can go ahead and set up your own splash image by adding it to the /boot/grub/ directory

sudo cp splash1.jpg /boot/grub/

This was what you could do with the /etc/default/grub file. Now if you want to add your own boot menu entry this is where you will be able to do it. Type in the following as per the image.

Now, you will have to use the file 40_custom for writing your own menu entries.

gksu gedit 40_custom

You can go ahead and refer the entries generated by os_prober in /boot/grub/grub.cfg for your reference. The name of the file determines in which order the scripts are run so basically 30_os_prober will generate menu entry before 40_custom and then 41_custom. To make any file executable you will have to change the file permission. To change permission use

sudo chmod +x /etc/grub.d/40_custom

These were the basics. Now to apply all the settings and changes you will have to update GRUB.

sudo update-grub

Restart your system and check out the changes by yourself.

Share this page:

4 Comment(s)

Add comment

Please register in our forum first to comment.


By: JOn

1) In the text you spell "quiet" as "quite", which is incorrect.

2) What graphic formats and sizes are supported by Grub 2?

By: Chris

I don't get it, you show us what the config files are, how to ls a directory, copy a file and what the default contents of those config files are.

Where are the actual CHANGES we have to make? How does grub decide which image file to choose? Did you actually MISS the most important thing to rename your "splash1.jpg" to "splash.jpg" or does grub understand that? The scripts seem to explicitly look for splash.{jpg,png,...}

Back to the docs.

By: kalle

this is a total misleading howto, ... not working, incomplete

By: Derek Simon-- Rayiik Solutions

a. not all distrobutions default to grub. and b for those who come looking for more specifics on customization of grub than editing the default configi file

are the sources i use and cover every everything you need to pimp out your bootloader rosalab is probally the best themeing guide if your just looking to make a flashy bootloader but the rest are worth reading  as they contain good information and tecnical stuff and tricks, such has having final countdown played on boot (arch tips/tricks).

If you have any questions regarding the subject shoot me a email at my personal email [email protected]