Ubuntu Splash Screen Customization

Customizing Linux is always an interesting task, as Linux on contrary to Windows OS gives us much more freedom to play around and modify it, encouraging us to create our own flavour. For now lets play with a basic fun factor element; customising the Splash screen.

So Splash screen is the first image that you would see while loading an OS. In windows you will see the four square logo of the windows OS and in Ubuntu, it is a glowing “Ubuntu” OS tag along with its loading dots. So lets take things to our hand and lets put a custom wallpaper as a splash screen. Animating the same will require more complex scripting, so for now sticking onto the basics.

First things first. To make things easier we require an application known as the Plymouth in our Linux system, which is by default in your Ubuntu Linux unless the version is customized. Assuming Plymouth is installed in your system, lets move on to the next step.

Open your terminal and create a directory using the command shown below

sudo mkdir /lib/plymouth/themes/sample

This is the directory in which we are going to write the script for our new splash screen. Now choose a custom wallpaper or graphic that you want to use for the splash screen. Please note that the file must be in PNG format. Now copy it into the sample directory created in the above step. For example the PNG file I had was in my home directory, so to copy it I used

sudo cp /home/syam/wallpaper.png    /lib/plymouth/themes/sample/wallpaper.png

Once that is finished now we need to write in the necessary .plymouth file and .script file inside the same sample directory we have created, and also it must have the same file name as that of the directory (i.e. in this case, “sample”). To create the .plymouth file, open your favourite text editor and type in the .plymouth script shown below. For e.g. I use nano editor as

sudo nano /lib/plymouth/themes/sample/sample.plymouth

Copy paste or type in the contents shown below and save the file (use cntrl + o, to save the file and cntrl + x to exit the editor).

[Plymouth Theme]
Name=Sample
Description=Wallpaper only
ModuleName=script

[script]
ImageDir=/lib/plymouth/themes/sample
ScriptFile=/lib/plymouth/themes/sample/sample.script

Similarly create sample.script file using the command sudo gedit /lib/plymouth/themes/sample/sample.script

and type in the following and save the file

wallpaper_image = Image(“wallpaper.png”);
screen_width = Window.GetWidth();
screen_height = Window.GetHeight();
resized_wallpaper_image = wallpaper_image.Scale(screen_width,screen_height);
wallpaper_sprite = Sprite(resized_wallpaper_image);
wallpaper_sprite.SetZ(-100);

Here sample.plymouth contains information about the location of the script, and the location where the image is placed. This is required while running the script as you will see the boot image is generated using this plymouth template. The script file contains the basic codes for loading the image and then resizing it to the resolution of your computer screen. The Sprite() function is used to show the image and also properly positions the image. And hence our coding is done. Now all we have to do is update our plymouth and then generate the splash screen image.

To update the default plymouth type in the following

sudo update-alternatives –install /lib/plymouth/themes/default.plymouth default.plymouth /lib/plymouth/themes/sample/sample.plymouth 100

where the value 100 shows the priority of the splash. Highest priority is automatically chosen as the default splash screen. However we can use manual selection to choose the boot screen. This is what we are going to do next. Type in

sudo update-alternatives –config default.plymouth

On entering this a list of themes in your system will be shown. From this select our ‘sample’ theme by typing in the corresponding number and pressing enter key.

Now simply update the system and generate the boot image using the command below

sudo update-initramfs -u

Now reboot and see the magic..

Sample Screen shots of live command entry is shown below. The screen shots does not contain sudo as I was already logged in as a Super User (i.e. system administrator), with highest permission.

“Enjoy Linux with a cup of Coffee 😀 “

Published by

Syam Nair

Technocrat, Traveler, & Researcher

Leave a comment