Brain Dump

A place to store my random thoughts and anything else I might find useful.

Archive for December, 2009

Unofficial feature for obsolete version of GRUB

Posted by mzanfardino on December 18, 2009

Recently I had been asked to ‘brand’ the GRUB menu for my company’s servers. The company has made the decision to deploy Ubuntu Long Term Support server software. And though we maintain current with security patches, we do not wish to radically alter the distribution that Canonical has release under its LTS program.

As such, we have a number of server running Ubuntu 8.04 LTS and 9.04 LTS. Canonical has seen fit to distribute these distribution with GRUB 0.97. And though GRUB2 is available, it has been decided by the company not to install GRUB2 at this time.

This, coupled with a recent change in the look of the company colors, has cause a problem with ‘branding’ the GRUB menu. It seems that GRUB 0.97 does not support the COLOR attribute if the SPLASHIMAGE attribute is in use. The result of which left me with an untenable problem: when I load the new company SPLASHIMAGE which is red lettering on a white background, I was unable to change the color of the text, which is also white by default (thankfully with black shading, so it’s at least visible).

While researching this issue, I came across bug #16190 filed with the GRUB project (https://savannah.gnu.org/bugs/?16190). In it, a helpful user (adrian15) wrote:

Non-standard grub such as the one from Ubuntu is not supported officially by Grub.

However I am going to help you. The color command when having a background image does not work as you have seen.

Use the following commands instead:

background RRGGBB
foreground RRGGBB
adrian15

I followed adrian15’s suggestion, knowing full-well that this is not an officially supported feature of GRUB. My first attempts failed to yield any results. No matter what color combination I defined it was not reflected in the GRUB menu. I continued to explore this option though, as I was certain that had adrian15 been wrong it would have been noted in the bug.

I found while editing the menu interactively I could in fact set the foreground and background colors to values of my choosing. I concluded then that it must be the order in which these settings appeared in /boot/grub/menu.lst that was the problem. Sure enough, by moving the foreground and background setting after the SPLASHIMAGE setting I was able to achieve my desired results!

In summery, if you are using GRUB 0.97 (I don’t care why) and you have need to customize your GRUB menu with a splash image of your own design and you want to change the color of the text, you can do so with the unofficial settings: FOREGROUND and BACKGROUND. Just remember that you must first specify the SPLASHIMAGE, otherwise the color choice will not appear to take effect.

ex:
...
splashimage=(hd0,0)/boot/grub/images/my_splash_image.xpm.gz
foreground ff0000
background 000000
...

This example will set the foreground color of the text to red and the background color of the text to black.

I have added a comment to the now-closed bug entry so that others may benefit. I must stress however that this is an unofficially feature of an obsolete version of GRUB! Do *NOT* expect to get support from the GRUB team or me if this does not work for you!

Posted in Uncategorized | Leave a Comment »