Sunday, November 6, 2011

Changing Grub Splash screen in Debian 6.0.3

Recently changed my MTNL plan from the Rs. 748 plan (2 Mbps, 5GB download limit) to the newly introduced Happy Hours plan Unlimited 666 (Rs. 666 service charges, 320 kbps during the day and 1 Mbps after 8 pm, unlimited download). This after receiving a hefty bill of Rs. 4500 last month accompanied by a severe dressing down from mom and dad. We concluded after an experiment that Skype was the culprit. Anyways, this brought good along. I am now free to download any file size and have already downloaded and installed the latest Ubuntu 11.10 and Debian 6.0.3 (Squeeze) in the last few days.

So coming back to the topic, I was always curious about changing the boring splash screen that we get at startup. I knew it was and is easy. But just wanted to tick another point in my "to-do" list.

First of all, where does Debian store all the pre-login wallpapers? The location is 

/usr/share/images/desktop-base/       (was actually trying to TAB my way while typing this...:D)

All the grub configuration gets stored in the grub.cfg file. The exact location is 

/boot/grub/grub.cfg

This is an auto generated config file that uses the templates from the /etc/grub.d and settings from /etc/default/grubWhen you want to change the timeout of the splash screen or the default boot selection of the OS list, the /etc/default/grub is the file to use. It has variables defined as GRUB_DEFAULT and GRUB_TIMEOUT for the same. Root privileges are required for these changes and also for the steps that follow. The 05_debian_theme file in /etc/grub.d is the brain behind deciding the grub background that goes into the grub.cfg file. Now after studying the 05_debian_theme file, I have found there are 3 ways of setting the desktop background:


1. Simplest: Just copy the required image into the /boot/grub/ folder and run "update-grub". Done. This method has second priority.


2. Define a variable GRUB_BACKGROUND in the /etc/default/grub file and provide the path of the image as its value.


GRUB_BACKGROUND = /usr/share/images/desktop-base/james_bond.jpg


(Yes, I have Daniel Craig as my splash screen..:D)

Save and exit. Then run "update-grub".


This method is given the highest priority. So if you have defined the one image as a variable and also pasted another image in the /boot/grub/ folder, the variable value will be considered.


3. The next method is using another file grub_background.sh. This method has third priority. In the file /usr/share/desktop-base/grub_background.sh, just define the variable WALLPAPER as the path of the image.

WALLPAPER = /usr/share/images/desktop-base/james_bond.jpg

Save and exit. Then run "update-grub".


If the 05_debian_theme file finds none of the above images or defined variables, it will load the default desktop background "desktop-grub.png". If it does not find the desktop-grub.png file too, it will load the default theme, which is just a black background and a blue foreground for the text.

After any change in the grub configuration, the command "update-grub" is necessary. While this command runs, it shows that it has accepted the background image. This command actually generates the updated grub.cfg file (auto-generated, as I have mentioned before) which is used during the booting process. You can check the updated file for confirmation.

Now just give the "poweroff" command and reboot again (Prior to power off, save any other open files). Noted one more thing, this release behaves differently on the "reboot" command. When you say "reboot", it actually assumes that you will be back into Debian and so you do not even see the OS selection grub menu and boot directly into Debian. Hence, I mentioned using the "poweroff" command.

So, there you go, my PC is now dressed to kill...even before the OS boots..:D


No comments: