Monday, February 14, 2011

Change Grub background image in Squeeze

This is the first post of two on how to get rid of the SpaceFun theme. Obviously the first step is to change the desktop background. After that, it gets more difficult. Squeeze uses GDM (Gnome display manager) 3, which unlike GDM2 has no easy GUI to change backround image, and Grub (GNU GRand Unified Bootloader) 2, which also requires a bit of hacking to change the background image.
After following a dead end or two, I found a method for changing the Grub background image that seems to work on the Debian Forum. It involves editing the file /etc/grub.d/05_debian_theme and changing the name of the file in the line set_background_image (not WALLPAPER) as described in the link, followed by running update-grub as root.
I found a grub background image here. (Open the file with GIMP [or Inkscape], resize to fit your monitor and save with a .png extension. Drop the file in /usr/share/images/desktop-base as root and edit the 05_debian_theme file above to point to it.
Next: change the GDM2 background image.

[EDIT: The resize step is unnecessary. I'd changed the monitor resolution in Grub to get Plymouth working, but that proved to be unnecessary. The size for grub images is 640x480. Inkscape is probably a better program for editing the .svg templates/examples on the site above.]

Update: There's another method to change the background image in GRUB that I discovered today (after making an ass of myself on the Debian forum).

Edit /etc/default/grub and add this line:
Changing the location and file name as appropriate, of course, as described here, or use the location used on the Debian forum if you've installed grub2-splashimages and want to use one of those images.

I've been looking into the nature of /etc/grub.d/05_debian_theme and /etc/default/grub, what they do and which might be the best method to change the GRUB background image. Here's what I found:
The standard way of changing the configuration is execution of shell scripts in directory (such as /etc/grub.d)... Many distros provide a centralized configuration file (e.g. /etc/default/grub), but shell scripts are free to use any means to draw their information or defaults.
GRUB Wiki Manual
/etc/grub.d/ - This is the directory that contains the GRUB script files. When you run update-grub these scripts generate grub.cfg
/etc/default/grub - This file contains menu settings that are read by the GRUB scripts. It is here that you would change the default timeout.
Howto: Customize your boot menu in GRUB 2
Set a background image for use with the ‘gfxterm’ graphical terminal. The value of this option must be a file readable by GRUB at boot time, and it must end with .png, .tga, .jpg, or .jpeg. The image will be scaled if necessary to fit the screen.
GRUB Manual

In my Debian Squeeze /etc/grub.d/05_debian_theme file, the script looks for a GRUB_BACKGROUND image in /etc/default/grub, and if it finds one, will not use the set_background_image in /etc/grub.d/05_debian_theme, which means that an image set in /etc/default/grub will have priority over one set in /etc/grub.d/05_debian_theme.
However, /etc/grub.d/05_debian_theme scripts seem to vary a lot between Linux distributions and versions. Bear in mind the quote above: shell scripts are free to use any means to draw their information or defaults.
In the event of this guide failing- consult appropriate distro guide or forum.


  1. I think I have done a grub image with higher resolution (1024*768) that what you quote, but it was on Ubuntu and Grub 2.0 aka as 1.98 with the security patch for some vulnerability version. Point being you can increase resolution with new grub

  2. Yes, it's possible to change the size of the grub screen in etc/default/grub and then use a grub image of the same size, as I found out here:

  3. good job brother,i will try on my squeeze someday