November 12, 2018

Customizing GRUB2 Splash Screen in Linux

I actually got bored of seeing the same bootloader splash screen every day. So, I decided to change it’s appearance completely to something new. I use GRand Unified Bootloader(GRUB) and here’s how you can customize its splash screen.

While writing this post, I used Manjaro Linux for demonstration purpose. So, this process is totally correct for Manjaro, Arch and similar OS. However, this tutorial should work fine with other distributions as well.

First off, check your GRUB version. There’s two kinds of GRUB. GRUB Legacy and GRUB2. GRUB Legacy is up to(including) version 1.9 and GRUB2 is version 2.0 onwards.

$ grub-install --version
grub-install (GRUB) 2.03.1

If you are getting 1.x.x instead of 2.x.x, please refer here.

In-case you don't know what a splash screen is, it's the GRUB window you always been greeted with while turning on your machine.

GRUB settings

Editing and customizing in GRUB2 is pretty simple and straight-forward. GRUB and its grub.cfg file is located at /boot/grub with other directories like themes, fonts etc. You can manually edit grub.cfg but it's generally not recommended to edit it directly. If you open this file, you should see a warning like this:

#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

It's stating that you have to edit templates from /etc/grub.d and settings from /etc/default/grub. Because, I am showing how to customize the splash screen, we only need to edit settings file i.e. /etc/default/grub.

If you never edited /etc/default/grub before, it should look like the following code snippet(Manjaro Linux):

GRUB_DEFAULT=saved
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR='Manjaro'
GRUB_CMDLINE_LINUX_DEFAULT="quiet resume=UUID=dbccef0b-2509-4386-a02e-eb534341394d"
GRUB_CMDLINE_LINUX=""

# If you want to enable the save default function, uncomment the following
# line, and set GRUB_DEFAULT to saved.
GRUB_SAVEDEFAULT=true

# Preload both GPT and MBR modules so that they are not missed
GRUB_PRELOAD_MODULES="part_gpt part_msdos"

# Uncomment to enable booting from LUKS encrypted devices
#GRUB_ENABLE_CRYPTODISK=y

# Uncomment to enable Hidden Menu, and optionally hide the timeout count
#GRUB_HIDDEN_TIMEOUT=5
#GRUB_HIDDEN_TIMEOUT_QUIET=true

# Uncomment to use basic console
GRUB_TERMINAL_INPUT=console

# Uncomment to disable graphical terminal
#GRUB_TERMINAL_OUTPUT=console

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
GRUB_GFXMODE=auto

# Uncomment to allow the kernel use the same resolution used by grub
GRUB_GFXPAYLOAD_LINUX=keep

# Uncomment if you want GRUB to pass to the Linux kernel the old parameter
# format "root=/dev/xxx" instead of "root=/dev/disk/by-uuid/xxx"
#GRUB_DISABLE_LINUX_UUID=true

# Uncomment to disable generation of recovery mode menu entries
GRUB_DISABLE_RECOVERY=true

# Uncomment and set to the desired menu colors.  Used by normal and wallpaper
# modes only.  Entries specified as foreground/background.
GRUB_COLOR_NORMAL="cyan/black"
GRUB_COLOR_HIGHLIGHT="green/black"

# Uncomment one of them for the gfx desired, a image background or a gfxtheme
GRUB_BACKGROUND="/usr/share/grub/background.png"
#GRUB_THEME="/path/to/gfxtheme"

# Uncomment to get a beep at GRUB start
# GRUB_INIT_TUNE="480 440 1"

To know what all those keys actually mean, please refer here.

Customizing GRUB

Now to add a new background image, you need to edit GRUB_BACKGROUND key. For that, you need a background image. GRUB supports .png, .tga, .jpg, and .jpeg file formats. I created an image using Canva for my GRUB splash screen and named it bg.png. You can download it if you want.

manjaro linux grub splash screen

Move this image to a suitable location. For example, /usr/share/grub. You would most probably find your current GRUB splash screen background image in that directory.

$ sudo cp Downloads/bg.png /usr/share/grub

Open /etc/default/grub with any text editor. I will use nano.

$ sudo nano /etc/default/grub

edit the value of GRUB_BACKGROUND and provide a valid path to your background image. In my case, it's /usr/share/grub/bg.png.

GRUB_BACKGROUND="/usr/share/grub/bg.png"

Save this file. In nano, you can save using CTRL + O, then CTRL + X to exit nano.

Now, update your GRUB config file i.e. grub.cfg using the following line of command:

$ sudo update-grub
[sudo] password for user:
Generating grub configuration file ...
Found background: /usr/share/grub/bg.png
Found linux image: /boot/vmlinuz-4.14-x86_64
Found initrd image: /boot/intel-ucode.img /boot/initramfs-4.14-x86_64.img
Found initrd fallback image: /boot/initramfs-4.14-x86_64-fallback.img
Found memtest86+ image: /boot/memtest86+/memtest.bin
done
$

Found background: /usr/share/grub/bg.png - It successfully loaded background image!

Now if you reboot, you should see a new GRUB splash screen!

Editing text colours

To edit text foreground colour, edit value of GRUB_COLOR_NORMAL. It should be in this format GRUB_COLOR_NORMAL=foreground/background. For example, GRUB_COLOR_NORMAL=cyan/black.

Note that, black in GRUB isn't actually the black colour(#000000). It's transparent. If you want to make your background image visible, keep background color as black.


Thank you for making it up to here. If you have any query(s), drop them in the comment box. Share this post with others if you find it useful.