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.
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/GRUB2Related posts:
- Impostare un’immagine di sfondo all’avvio di Ubuntu linux GRUB
- [EN] Configure HP Pavilion QuickPlay multimedia buttons in Ubuntu Linux
- AcetoneISO the Daemon Tools and UltraISO for linux
- “bash: ./configure: /bin/sh: bad interpreter: Permission denied”
- Firefox: re-enable print and scale options from Print Preview
- Resize multiple pictures with a too high resolution
Print This Post
|
Email This Post

Thanks. I’d read some other instruction on adding the background but it neglected to mention the use_bg=true part. I didn’t notice that in the code. So, nothing was working for me. You took the trouble to add that crucial point and now my background is working. Thanks again.
Actually, the use_bg variable gets set in the for loop on ~line 26… You shouldn’t fiddle with it since it gets set to true if and only if the image file your trying to use as a background image is actually usable by grub. Your setup probably started working for some other reason.
Anychance on knowing what background that is in your screenshot? =P
d0od,
I’m really sorry, on a recent system upgrade I accidentally deleted the /etc folder containing the image. However you can use whatever image you like; have a look at here, I think there are even better ones!
http://art.gnome.org/backgrounds/
[...] Configure GRUB2 options and background, Speed up Ubuntu Linux! [...]
these instructions worked great with Grub2 1.96 when I installed it on my 9.04 install, after updating to 9.10 though and having Grub2 1.97 beta4 after changing use_bg to true I get this
[code]Generating grub.cfg ...
Warning: update-grub_lib is deprecated, use grub-mkconfig_lib instead
No path or device is specified.
Try ``grub-probe --help'' for more information.
No path or device is specified.
Try ``grub-probe --help'' for more information.
[/code]
my 05_debian_theme lines look like this
[code]use_bg=true
if [ "$GRUB_TERMINAL" = "gfxterm" ] ; then
for i in {/boot/grub,/usr/share/images/grub}/Sparkler.{png,tga} ; do
if is_path_readable_by_grub $i ; then
....
[/code]