Configure GRUB2 options and background

Starting from next Ubuntu version Karmic 9.10 new GRUB2 boot loader in installed by default. GRUB2 comes with a bunch of technical enhancements, most notably support for new filesystems, a modularized settings configuration, recovery support and indeed better background image support.

grub2

After installing GRUB2 (now simply called grub-pc in ubuntu/debian repositories) you would probably wonder where the heck is the long time being configuration file menu.lst. Actually there isn’t any more! GRUB2 configuration files lay in /boot/grub/grub.cfg  however this is automatically generated and should be not edited. Any editing would soon be automatically reverted.

To configure boot loader preferences and settings you should check:

- /etc/default/grub file (for default boot option, timeout, screen resolution and splash/quiet default options for newer kernels)

- /etc/grub.d directory In this directory you would find several files sorted by a two-number code which sets the sequence in which they are read (this is actually a standard also for linux startup/shutdown processes).

Rather than editing one of those files, in order to keep your settings from being overwritten you should create a new file. You can safely copy the existing 05_debian_themeand as 06_custom_theme, then start editing the latter.

after the first few lines you can see the lines setting the menu font colour and background if no background is available.

set menu_color_normal=white/black
set menu_color_highlight=light-red/black

colors can be chosen among this list: http://www.gnu.org/software/grub/manual/html_node/color.html

a few lines below

use_bg=true
if [ "$GRUB_TERMINAL_OUTPUT" = "gfxterm" ] ; then
  for i in {/boot/grub,/usr/share/images/desktop-base}/picture.{jpg,png,tga}

You have to set the variable use_bg=true to true. Then set the path and name of your desired GRUB background image. As you can see in the example the background image is searched in

/boot/grub and /usr/share/images/desktop-base

you can however provide your own path.

You should also replace the picture filename with the actual filename. Allowed extensions are jpg, png and tga.

Of course there is a fairly simpler way for setting the background, which does not involve editing this script and instead writing your own exact settings, however I guess editing the script can help preventing mistakes. The script takes care of telling GRUB which module to load according to the picture format.

below you should once again set the  menu font colour and background, this time for when the background image is available and loaded

if background_image `make_system_path_relative_to_its_root ${bg}` ; then
  set color_normal=black/black
  set color_highlight=light-red/black

Now you are nearly done, the last set is merging your new setting file into the main /boot/grub/grub.cfg . This can be accomplished by typing in a terminal:

sudo update-grub2

Reboot and Enjoy!

—————————————–
further reference:
Grub 2 – Ubuntu Wiki https://wiki.edubuntu.org/Grub2
http://blogs.koolwal.net/2008/12/16/how-to-grub2-and-grub-pc-installing-splash-images/
http://wiki.archlinux.org/index.php/GRUB2