GRUB 2's splash image/background capability is greatly enhanced over its predecessor, GRUB 0.97. This page provides information on how to add a background image, change font colors and resolutions on the GRUB 2 menu without using a theme. The developers have created a set of compatible background images available as a package download but GRUB 2 accepts a variety of popular image formats. The user may choose any compatible image to use on the GRUB 2 menu.
GRUB 2 themes are becoming more available and are discussed in the Grub2#Themes community documentation. A separate page for themes is under development.
A collection of compatible background images such as the one to the left is available from the Universe repository in the grub2-splashimages package. |
Choosing a GRUB 2 Background Image
GRUB 2 can use PNG, JPG/JPEG and TGA images for the background. The image must meet the following specifications:
- JPG/JPEG images must be 8-bit (256 color). Else you will get errors saying "Too many Huffman tables". Since most of the time you will not want to limit yourself to 256 colors (which is totally yesteryear) you will probably find PNG much preferable.
- Images should be non-indexed, RGB.
The GIMP image editor is one application which can edit images to conform to the GRUB 2 standards. Use the Image > Mode menu options to set the properties to RGB and ensure the mode is not set to Indexed.
Sample GRUB 2 splash images are contained in the grub2-splashimages package in the Universe repository. The package can be installed in several ways:
Synaptic (if installed). Select and install grub2-splashimages.
Ubuntu Software Center. Search for grub2-splashimages and click the Install button.
- Terminal:
sudo apt-get install grub2-splashimages
Once installed, the images are located in the /usr/share/images/grub folder.
important The grub-splashimages package was designed for GRUB 0.97 and is not compatible with GRUB 2.
Installing Splash Images
The method to include a background image in Grub 2 varies depending on the version of GRUB installed on the system. Early versions of Grub 1.98, installed on Lucid, are different than later versions of Grub 1.98 installed on Maverick. See the specific instructions for the release you are using. Instructions for Grub 1.97~beta in Karmic Koala (unsupported) are located at the end of this section.
The installed version of GRUB on the system can be obtained by running grub-install -V
The final step in adding the splash image in all the methods described below is to update the GRUB 2 menu. 1. Update GRUB to incorporate the image into the GRUB 2 menu:
sudo update-grub
As the command runs, the user should see a terminal message indicating the image was found. If the image is not found, refer to the Troubleshooting Splash Images section of this page.
Image Priority
If more than one suitable image is available to GRUB 2, the following order is used to determine which image is used as the GRUB 2 background.
GRUB_BACKGROUND setting in /etc/default/grub
- First image found in /boot/grub
- The first image found, in this order: jpg, JPG, jpeg, JPEG, png, PNG, tga, TGA
- If multiple images of the same extension, alphanumerically.
Wallpaper designated in /usr/share/desktop-base/grub_background.sh (if desktop-base installed)
WALLPAPER= line in /etc/05_debian_theme * GRUB 1.98 only
The default setting is /usr/share/images/desktop-base/desktop-grub.png (the desktop-base package must be installed)
Default theme (no image): default_theme colors specified in /etc/grub.d/05_debian_theme
Note: Not all these options are available in GRUB 1.98
GRUB 1.99 and later
The following guidance for setting the background image is for GRUB 2 version found in Ubuntu 11.04, Natty Narwhal and later.
GRUB 1.99 greatly simplified adding a GRUB 2 splash image. In addition to the following procedures, the methods detailed for GRUB 1.98 will also work.
Note: Adding a background image requires system folder operations. The user must use administrator privileges to make the required changes.
- Review image requirements in the previous section to ensure the image you select is compatible with GRUB 2.
The user has two options for selecting the splash image to be used. The first requires editing a GRUB 2 configuration file. The second is to copy a compatible image file to the grub folder.
Open /etc/default/grub with a text editor.
- Add the following line:
GRUB_BACKGROUND=/path/filename
- Example: GRUB_BACKGROUND="~/Pictures/grubbackround.png"
- This option takes precedence over the next method.
- Add the following line:
OR:
Place a suitable image in the grub folder.
The default location for this folder is /boot/grub.
If more than one suitable image resides in the grub folder, the priority for the image used in GRUB 2 is:
- First image found in /boot/grub
- The first image found, in this order: jpg, JPG, jpeg, JPEG, png, PNG, tga, TGA
- If multiple images of the same extension, alphanumerically.
- First image found in /boot/grub
- Update GRUB to incorporate the image into the GRUB 2 menu:
sudo update-grub
GRUB 1.98
The following guidance for setting the background image is for GRUB 2 version 1.98-1ubuntu13 found on Ubuntu 10.04, Lucid Lynx.
The GRUB 2 splash image, if it exists, is selected in the following order:
The image specified in /usr/share/desktop-base/grub_background.sh. This script does not exist in a default Ubuntu installation.
The file listed in the WALLPAPER line in /etc/grub.d/05_debian_theme.
The default file listed in the WALLPAPER line is /usr/share/images/desktop-base/moreblue-orbit-grub.png.
This image is present only if the desktop-base package is installed.
The image will be used if GRUB 2 locates it in either the /usr/share/images/desktop-base or the /grub folder (normally a subfolder of /boot.
The use a different splash image:
Open /etc/grub.d/05_debian_theme for editing as root:
gksu gedit /etc/grub.d/05_debian_theme
Find and edit the WALLPAPER= line. Include the new path and filename of the image you wish to use. Save the file when done editing.
- Update GRUB 2.
sudo update-grub
Troubleshooting Splash Images
If no image appears in the GRUB 2 menu, the following procedures may help determine the problem:
If "Found background image: " is not displayed as a terminal message when update-grub is executed, confirm that the file exists and that the path and filename in the appropriate configuration file are correct.
The image is of the proper size & format (8-bit JPG/JPEG, PNG, or TGA)
- The file is an RGB, non-indexed image.
The console mode is not enabled in /etc/default/grub
The update-grub command must be executed to place the background image information into the /boot/grub/grub.cfg file.
If the problem is not determined, substituting one of the images provided in the grub2-splashimages package will help determine if the cause is due to an incompatible image.
If the incorrect image appears as the GRUB 2 background:
Review the Image Priority section of this document.
Run sudo update-grub and view the terminal display to check what image is being selected.
Review the Font Background section of this document. The font background must be transparent for an image to be viewable.
Setting Menu Font Colors
Setting menu font colors is normally the job of theme files, which are discussed in greater depth in the Grub2/Themes community document. This section will detail how to change font, highlight and background colors on the GRUB 2 menu without creating detailed themes.
Note that there is a Debian wishlist bug aiming to make the process of specifying custom text/menu colours easier, especially in conjunction with a splashimage. The methods provided below require you to edit different files in different cases. The proposed GRUB patch will enable all settings to be set at a single source i.e. /etc/default/grub. Brave souls can, at their own risk, consider building from Debian GRUB sources with the patch applied or, far easier, just apply the relevant modifications to your already present /etc/grub.d/05_debian_theme and /usr/sbin/grub-mkconfig files once to enable further customization possible solely from /etc/default/grub.
GRUB 2 Colors
For each font color entry, two inputs are required, separated by a /. The first entry is the text color, while the second entry is generally the background color if an image is not present.
Example: menu_color_highlight=black/white
GRUB 2 accepts the following colors for the menu fonts and background:
black
blue
brown
cyan
dark-gray
green
light-cyan
light-blue
light-green
light-gray
light-magenta
light-red
magenta
red
white
yellow
About "Black"
GRUB 2 treats "black" differently when it is the second entry in a setting, for example " color_normal=white/black ". In this case, black is considered a value for "transparent". The underlying image will be visible rather than the color black. This distinction becomes important when an image is present in the menu. GRUB 2 automatically ignores the menu_color_highlight and menu_color_normal values when an image is present and uses color_normal=white/black and color_highlight=black/white.
Setting the background value of non-highlighted entries black (the "transparency" value) ensures the image will be viewable. Since the developers don't know what image the user might choose, they selected the other values to provide the best chance that the menuentries will be visible. The colors may be changed to other values when using themes or by writing them directly into the 05_debian_theme file.
If using a splash image and the second value of color_normal is not black the splash image will be hidden behind a solid color background.
Configuration settings (no splash image)
The 3 main font color settings which the user might wish to change on the GRUB 2 menu are listed below. These include the color codings for the menuentries (highlighted and unselected) and the colors of the background and text outside of the menu 'box'.
menu_color_highlight=text-color/bg-color
The color of the highlighted menuentry and its background within the menu 'box'.
menu_color_normal=text-color/bg-color
The color of non-selected menuentries within the menu 'box'
color_normal=text-color/bg-color
The color of the text and background outside the menu 'box'
Each setting contains two values, separated by a /. The first is the foreground color; the second is the background color. In the example below the colors of the text/background are produced by the settings in bold white.
color_normal=cyan/black * |
|
* Black in this case is treated as a transparency, revealing the Ubuntu 12.04 aubergine. |
|
menu_color_highlight=yellow/dark-gray |
|
menu_color_normal=black/light-gray |
Although specific theme files should be built and referenced in /etc/default/grub, for Ubuntu users the /lib/plymouth/themes folder contains a relatively empty GRUB 2 theme file referenced during update-grub execution. A user can add basic settings with minimal effort to this file to change the GRUB 2 menu colors if no splash image is detected. Refer to the next section for an explanation of what happens if a splash image is detected. Since this is a system file, administrator/root privileges are required to edit the file.
To modify font colors when no splash image is used:
Open /lib/plymouth/themes/default.grub for editing as root.
- Add the following entries below the existing lines. Substitute color values as desired:
set menu_color_highlight=yellow/dark-gray set menu_color_normal=black/light-gray set color_normal=yellow/black
- Add the following entries below the existing lines. Substitute color values as desired:
Save the file and run update-grub The above example entry creates yellow highlighted text on a dark gray bar with black unselected text on a light gray background. Outside the 'box' is yellow informational text and an aubergine background. The aubergine background is the result of the Ubuntu 12.04 settings. Ubuntu has a default background of aubergine, and in this case the black setting in color_normal is treated as transparent.
Configuration settings (splash image present)
When an image is present GRUB 2 uses only color_normal and color_highlight settings. Themes are recommended when the user wishes to override the default monochromatic color text scheme. The user can add the menu_color_highlight and menu_color_normal settings to system files if desired.
The color of selected menu entries is set by menu_color_highlight setting.
The color of non-selected menu entries is set by menu_color_normal setting.
The second value of the color_normal entry must be set to black for the image to be visible.
To add menu_color_normal and/or menu_color_highlight values when using a splash image:
Open /etc/grub.d/05_debian_theme as root.
- Find the following lines:
if [ -z "${2}" ] && [ -z "${3}" ]; then echo " true" fi
Change the entry to the following, replacing 'color1' and 'color2' to the desired colors. Leave /black as is!
if [ -z "${2}" ] && [ -z "${3}" ]; then # echo " true" echo " set color_highlight=color1/color2" echo " set color_normal=color1/black" fi
- Find the following lines:
Save the file and run update-grub
Testing Fonts and Splash Images
Rather than rebooting to test the color combinations, the user can see the changes by using GRUB 2's command line during the boot process. It is also a good way to ensure the color combinations are visible and the command settings are correct. Settings tested in a GRUB 2 terminal are not saved.
Tips & Techniques for Live Testing
Select the splash image and initial font colors as described above, update GRUB 2's files with update-grub, and reboot.
- When the GRUB 2 splash image/menu appears, press any key to stop the countdown timer.
Press c to enter the GRUB 2 command line.
Typing set will display the current settings.
- Experiment with various color/highlight modes. Make changes by typing:
set color_normal=color1/color2
set color_highlight=color1/color2
set menu_color=color1/color2
- Text colors are viewable immediately after the command is entered. You can use the "up" arrow to recall the last command and edit it to quicky test different color combinations.
Pressing ESC returns the user to the main menu to view the full effect
- Repeat as desired.
- Remember the desired color combinations, boot normally and edit the appropriate file(s).
Update GRUB 2 if any changes are written to file: sudo update-grub
Changing Menu Resolutions
If the user wishes to change the resolution of the GRUB 2 screen for image enhancement or general font size changes:
Set the desired resolution in /etc/default/grub
Change the value of GRUB_GFXMODE= (Example: GRUB_GFXMODE=800x600)
If unsure of what resolutions are available to GRUB 2 they can be displayed by typing vbeinfo in the GRUB 2 command line. The command line is accessed by typing "c" when the main GRUB 2 menu screen is displayed.
- Select an image of the same proportions.
GRUB 1.99 - Place the image in the grub folder or add a GRUB_BACKGROUND entry in /etc/default/grub
GRUB 1.98 - Change the value of WALLPAPER in /etc/grub.d/05_debian_theme
GRUB 1.99 - Place the image in the grub folder or add a GRUB_BACKGROUND= entry in /etc/default/grub
- If an image of the correct size is not used, the menu will not be positioned correctly.
- Use the image editor of your choice to create/resize an image to the correct size.
The user may be able to view the image size via Properties in a file browser (check the Properties Image tab in Nautilus).
Run update-grub to update GRUB 2
Creating User Splash Images
GRUB 2's splash image management makes it easy to use a wide variety of splash images.
Resolution Settings
The images in the grub2-splashimages package are primarily 640x480 images.
GRUB 2 looks for a resolution setting in /etc/default/grub. If uncommented, the resolution is determined by this line:
GRUB_GFXMODE=640x480
If no setting is found in /etc/default/grub, GRUB 2 attempts to use the highest resolution possible. GRUB 2 may not be able to handle the same resolutions as the computer can once the operating system is booted.
Image Creation and Setup
In Ubuntu, refer to the Display in DASH or via the System, Preferences, Display menu for available monitor resolutions, or run vbeinfo in the GRUB 2 terminal to display the resolutions available it.
- Determine the resolution you will use for the GRUB 2 splash image.
- Create or resize any image to to the appropriate size.
GRUB 2 currently supports PNG, TGA, and 8-bit JPG/JPEG images.
- The images should be RGB, non-indexed.
If using GIMP, naming the file with the applicable extension will save the file in the given format. Set the correct properties via the "Image > Mode" menu.
- Make the applicable changes in the GRUB 2 configuration files:
/etc/default/grub: Uncomment the GRUB_GFXMODE=640x480 line and change the value if the resolution will be other than 640x480.
- Add the GRUB 2 background image information to the configuration files(s) as discussed previously.
Run sudo update-grub to incorporate the changes into GRUB 2.
Related Links
Grub2/Themes (Under Construction)