Create a Custom Grub2 Screen that is maintenance free


This guide will work with any version of Ubuntu and even other distros of Linux as well as Windows. It is great for dual booting as well as multi-booting. It will give your boot screen a background picture, colored fonts of your choosing, a timeout in seconds before the default is selected and you choose which Operating System will be the default. No further changes will be necessary even when new kernels are installed unless you want to change the background picture, the font colors, the default Operating System or if you delete or add an Operating System to your computer. The only other time you might have to make a change is if one of the grub files that is modified gets updated, but that occurs rarely. Thanks to Ranch Hand for his help and valuable knowledge. Thanks to Riskable for finding a way to make the font larger. Thanks to Drs305 for his valuable help with Grub and other things.

When you make any change to one of these grub files it is imperative that you enter sudo update-grub or sudo update-grub2 or else the changes will not take effect.

Possible Grub font colors

You can use black/black and it will produce a black color with a transparent background.
However you only want to use this on a very light picture or it will appear invisible.


For All Ubuntu versions using Grub version 1.99 or 2.00.

You can use gksudo <text editor> <file-name> , sudo nano <file-name> ; or whichever editor you feel most comfortable with.
In these examples I use gksudo gedit <file-name> because it was most convenient at the time.

Setting up a Grub background picture

You need to move 1 picture that is the same size as your screen resolution to /boot/grub/ e.g. sudo cp rain.jpg /boot/grub/rain.jpg.
Accepted picture types are *.jpg, *.jpeg, *.png and *.tga pictures. PNG pictures seem to work the best.
If you change the picture be sure and remove the previous one because it looks for the first one it finds.
To remove the picture you would enter sudo rm /boot/grub/rain.jpg.

If the JPG picture is listed when you enter sudo update-grub but, does not show up at boot time try this:
Edit the JPG picture with Gimp (GNU Image Manipulation Program) and export that JPG as a PNG picture of the same size.
It is because of the existance of the picture that grub uses the font colors in /etc/grub.d/05_debian_theme.

Editing /etc/grub.d/05_debian_theme

You can have 3 font colors: a menu color, menu highlight color and a normal color.
The menu colors will be the menu box and the selections inside the box. The normal color will be at the top and bottom of the screen.
Enter gksudo gedit /etc/grub.d/05_debian_theme
For Ubuntu Precise Pangolin 12.04 using Grub version 1.99:
At line 98 where you see the 1st line below add only the three lines after that and save the file:
For Trusty Tahr 14.04 using Grub version 2.00:
At line 118 where you see the 1st line below add only the three lines after that and save the file:

Make sure you leave the one space before set in the 3 lines.

echo "if background_image `make_system_path_relative_to_its_root "${1}"`; then"
echo " set color_normal=cyan/black"
echo " set menu_color_normal=yellow/black"
echo " set menu_color_highlight=red/black"
if [ -n "${2}" ]; then

For Xenial Xerus 16.04 LTS, Yakkety Yak 16.10 and Zesty Zapus 17.04 using Grub version 2.00:
At line 122 where you see the 1st line below add only the three lines after that and save the file:

echo "if background_image `make_system_path_relative_to_its_root "${1}"`; then"
echo " set color_normal=cyan/black"
echo " set menu_color_normal=yellow/black"
echo " set menu_color_highlight=red/black"

See the available colors at 1.2 in the table of contents.

Making the custom Grub2 Menu entries

First in Terminal enter sudo blkid -c /dev/null to get the partitions to work with.

/dev/sda1: LABEL="C:" UUID="1CFC7A8DFC7A60C6" TYPE="ntfs" PARTUUID="a55f55ec-01"
/dev/sda2: UUID="a621cb7d-2a1d-4e36-bd7f-bce66b67aa4b" TYPE="swap" PARTUUID="a55f55ec-02"
/dev/sda3: LABEL="Arch-Install" UUID="97ce09d6-b701-499e-b838-93762e3b005c" TYPE="ext4" PARTUUID="a55f55ec-03"
/dev/sda5: LABEL="Xenial" UUID="74dae5ed-213e-4b44-9d51-dca4e3f847cd" TYPE="ext4" PTTYPE="dos" PARTUUID="a55f55ec-05"

You can see Windows is on sda1, Precise install is on sda2 which is drive 1 (a) partition 2, which will be depicted as (hd0,2) as the disk drive numbers start with zero. Use this below.
If you have Windows installed, make note of the UUID for use in the custom entry.

Enter gksudo gedit /etc/grub.d/40_custom in Terminal.
All you will see is 5 lines:

exec tail -n +3 $0
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.

You will need to change
exec tail -n +3 $0 to
exec tail -n +4 $0
As well as adding the 2nd line below listing your Operating systems:

echo 1>&2 "Adding Precise Pangolin 12.04, Ubuntu Version name nn.nn and Windows 7"
exec tail -n +4 $0
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.

Whatever you put between the quotes is totally up to you. This is what will display when you enter sudo update-grub
What you put between the double quotes besides each menuentry line is what will display on the Grub2 screen at boot time.

Here is what the first entry will look like (copied and pasted below the 6 lines above)

menuentry "Precise Pangolin 12.04" {
    set root=(hd0,2)
        linux /vmlinuz root=/dev/sda2 ro quiet splash
        initrd /initrd.img

Second entry for Precise Recovery:

menuentry "Precise Pangolin 12.04 (Recovery Mode)" {
    set root=(hd0,2)
        linux /vmlinuz root=/dev/sda2 ro single
        initrd /initrd.img

Entries for every version after Precise Pangolin 12.04 using systemd:

menuentry "Ubuntu Version name nn.nn" {
    set root=(hd0,3)
        linux /vmlinuz root=/dev/sda3 ro quiet splash
        initrd /initrd.img

Recovery entries for every version after Precise Pangolin 12.04 using systemd:

menuentry "Ubuntu Version name nn.nn (Recovery Mode)" {
    set root=(hd0,3)
        linux /vmlinuz root=/dev/sda3 ro recovery nomodeset
        initrd /initrd.img

Add as many of the double entries above one for regular boot and one for recovery as you have systems on your computer.

Entry for whatever version of Windows match your UUID to what is beside --set (if you have Windows):

menuentry "Windows 7" {
    insmod ntfs
    set root='(hd0,1)'
    search --no-floppy --fs-uuid --set 1CFC7A8DFC7A60C6
    chainloader +1

DO NOT CLICK SAVE! Click file, save as and save it as 06_custom and not 40_custom.
This way the custom entries will be display at the top which is the goal.

Find where it is saved. If it is saved in /etc/grub.d/ you are good to go.
If it is in the home directory, enter this in Terminal sudo mv ~/06_custom /etc/grub.d/ and enter your password if asked.

Enter sudo chmod +x /etc/grub.d/06_custom to make it executable.

Then always remember to enter sudo update-grub or sudo update-grub2 and reboot to view the changes.
If you forget to enter sudo update-grub your changes will not "stick" and you will see that when you reboot.

In the 06_custom file there are no blanks between the lines.

Editing /etc/default/grub

Now change the default line number, the timeout, the resolution of the GRUB2 screen and add the font.

First, In terminal enter this command to generate the font:
(For every version prior to Xenial Xerus 16.04 LTS).

sudo grub-mkfont --output=/boot/grub/DejaVuSansMono.pf2 \
 --size=24 /usr/share/fonts/truetype/ttf-dejavu/DejaVuSansMono.ttf

For Xenial Xerus 16.04 LTS, Yakkety Yak 16.10 and Zesty Zapus 17.04:

sudo grub-mkfont --output=/boot/grub/DejaVuSansMono.pf2 \
 --size=24 /usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf

You will get errors like the ones below while making the font, but just ignore them as the font will still be created.

Unknown gsub feature 0x63636d70 (ccmp)
Unknown gsub feature 0x646c6967 (dlig)
Unsupported substitution flag: 0x9
Unsupported substitution flag: 0x9
Unknown gsub feature 0x6c6f636c (locl)
Unknown gsub feature 0x6c6f636c (locl)
Unsupported substitution flag: 0x9

In newer Ubuntu versions you will get the error below. but just ignore it as the font will still be created.

Freetype Error 21 loading glyph 0x2c7 for U+0x33f: invalid composite glyph

If you are not satisfied with the size of the font, see this link for some information about the command above.

To determine which number to put in GRUB_DEFAULT= You can enter this command in terminal and use the number you want:

grep -e "menuentry " -e "submenu" /boot/grub/grub.cfg | sed 's/^[ \t]*//' | cut -d "'" -f1,2 | nl --starting-line-number=0

Then enter this in terminal gksudo gedit /etc/default/grub
GRUB_DEFAULT=0 means to default on the 1st line at the top. The numbering starts with 0.
If you only have one Ubuntu installation, set this to 0.
If you dual boot and want Ubuntu as your default set this to 0, or set the number to which ever line you want to be default.
The default will never change unless you change it.

What will be displayed when it is customized will be Ubuntu, Ubuntu Recovery and Windows. Or if you have more than just Ubuntu and Windows there will be 2 additional lines for each other OS; one for the Ubuntu/Linux Distro and one for the Recovery.

GRUB_TIMEOUT=60 means Grub2 screen displays for 60 seconds before defaulting. You can set this to whatever you want. GRUB_GFXMODE=1920x1200-24 means screen resolution is 1920x1200 and 24 is the color bit depth. The -24 on the end is optional.
Enter this in place of #GRUB_GFXMODE=640x480.
Somewhere near the top on about the 13th or so line enter GRUB_FONT=/boot/grub/DejaVuSansMono.pf2

Make sure there is no # to the left of these commands as # means the line is commented out.

If the picture does not display at boot time, try another picture as not all of them work.

Example pictures for Grub 1.99 and 2.00

Picture of Precise, Quantal, Raring, Linux Mint and Windows 7 with Grub 1.99:


Picture of Precise, Quantal, Raring, Saucy, Linux Mint and Windows 7 with Grub 2.00:


Selecting Windows from Grub 1.99

When choosing Windows, an error message displays that says:

Error: No argument specified.

Press any key to contiue...

However, this is an erroneous error and if you wait or press any key it will go into Windows just fine.

This only happens with Grub 1.99 on Precise not on Grub 2.00.

Final changes

Once you are confident that all of the custom entries work as they should. You can eliminate the other menu entries below these custom entries.
sudo chmod -x /etc/grub.d/20_memtest86+ will make memtest unexecutable and will not show in the menu.
sudo chmod -x /etc/grub.d/10_linux will make the list of kernels not display.
sudo chmod -x /etc/grub.d/30_os-prober will make any other Linux systems and Windows entries not display.
Then always enter sudo update-grub when finished making changes.
Only having the custom menu displayed (as displayed in the example picture above), this is the output of sudo update-grub:

Generating grub.cfg ...
Found background image: dark-red-night-wallpaper.jpg
Adding Precise Pangolin 12.04, Quantal Quetzal 12.10, Saucy Salamander 13.10, Linux Mint 14 Nadia Cinnamon and Windows 7

Labelling the partitions

Labelling your partitions makes things a lot easier as you can tell by the sudo blkid -c /dev/null above.
Not only do they display in terminal, they display as labelled in Ubuntu, which makes it a lot easier than perhaps displaying a UUID.
Here is the command to label your partitions:
sudo tune2fs -L "Mint-Rebecca-7.1" /dev/sda2
sudo tune2fs -L "Trusty" /dev/sda3
sudo tune2fs -L "Vivid-Mate" /dev/sda5

Example: sudo tune2fs -L {label} {devicename}

Just change the sdax to match your partition.
You do not need to label anything other than ext4 file systems.
By not having any spaces in the label you will be able to copy files from one partition to another.

Installing or re-installing more than one Ubuntu system

You should first make sure that Grub2 is not installed on the system that you are removing or re-installing as you may be looking at grub rescue if so.

I recommend installing Grub2 on another Ubuntu if you have one by booting into that Ubuntu and entering
sudo grub-install /dev/sdx where x is the hard drive (e.g. sda).

If you install a 2nd or 3rd Ubuntu etc. or if you re-install one you may need to edit fstab for that system.

Boot into the new or re-installed Ubuntu and enter sudo blkid -c /dev/null and then cat /etc/fsab.
What appears in fstab should match the output of sudo blkid -c /dev/null.
If it does not enter gksudo gedit /etc/fstab make any changes to UUID and delete any extra lines then save the file.

Just in Case

If you need to access an older kernel or for any reason need to see the regular menu entries.
(If you are multi-booting more than one Ubuntu and the one you want to see the other kernels is not where your Grub is installed.
Login to that Ubuntu and if it is not possible to get into the system normally, Recovery for that system will do the job.
Choose "root console" from the Recovery menu.)
Enter sudo grub-install /dev/sda (where sda is the disk it is installed on) sudo blkid -c /dev/null will show the correct one if it is not known.

Enter this:
sudo chmod +x /etc/grub.d/10_linux && sudo update-grub and/or
sudo chmod +x /etc/grub.d/30_os-prober && sudo update-grub, reboot and the menu entries will be restored.

If you multiboot mutiple Linux installs and want one Grub to control all of your OSs

When you add a 2nd or 3rd Linux system you can opt to install the grub to the PBR instead of the MBR.
PBR means Partition Boot Record and MBR means Master Boot Record).

Select manual partitioning to install grub to the PBR (e.g. sda2) instead of the MBR (e.g. sda).
This way your grub will not move from one partition to another each time any grub is updated on other installs besides your main one.

If you have already installed each grub on the MBR you can fix it as above with these commands:
For non efi systems:

sudo dpkg-reconfigure grub-pc

Or on efi systems use this command:

sudo dpkg-reconfigure grub-efi-amd64

Enter thru first pages, spacebar to choose/unchoose drive, enter to accept.

Just make sure you remember which install (MBR) your grub is installed on.

Undo the changes made by this tutorial

Enter the following commands in terminal:
sudo chmod +x /etc/grub.d/20_memtest86+
sudo chmod +x /etc/grub.d/30_os-prober
sudo chmod +x /etc/grub.d/10_linux

Then you can either make the custom file unexecutable if you think you will use it in the future:
Enter in terminal sudo chmod -x /etc/grub.d/06_custom
Or you can simply delete the file: sudo rm /etc/grub.d/06_custom
Delete the picture in /boot/grub/. sudo rm /boot/grub/blue-sea.jpg
Enter gksudo gedit /etc/default/grub in terminal and comment out by placing a # at the start of the GRUB_GFXMODE= line and change the GRUB_DEFAULT= to 0. Comment out or delete the GRUB_FONT= line.
Then enter sudo update-grub in terminal, reboot and you are back to normal.

Where to post questions, problems, etc

How to have a custom Grub2 menu that is maintenance free


Original post The Ubuntu Forums (



MaintenanceFreeCustomGrub2Screen (last edited 2017-04-19 20:15:30 by cavsfan)