HOWTO Embellish the Boot Screen (grub2)

MagicMint
  10 years ago
  11

Prerequisites

Once upon a time, with the arrival of Lisa in November 2011 to be more exact, the boot splash screen has been removed from Linux Mint, probably because of problems related to the transition from the previous version of grub (the boot loader) to the present one (v2), and the changes in the splash system of Ubuntu. But nowadays (i.e. from LM 14 Nadia on), there is no such reason apart from the black screen being compatible, read: equally boring on all computers sad

Hence if you feel the need to improve the initial appearance of your machine according to Mint’s motto “From freedom came elegance”, you should do so. Fortunately that task is much easier to perform in Linux Mint yes than all the outdated guides for Ubuntu or Debian suggest (compare their date!).

The software you need

You should install both the grub2-splashimages and ttf-unifont packages either via the Software Manager or the command line:
…$ sudo apt-get install grub2-splashimages ttf-unifont
The splash images will be installed in /usr/share/images/grub where you will have to choose your preferred one from, and install it manually as explained below.

A new image for the boot menu

First of all, reboot the computer in order to find out the maximum resolution grub is capable of on your machine. Once in grub’s boot menu, press the 'c' key. Then in grub’s command line, enter:
grub> vbeinfo
From the list of available resolutions, write down the greatest one for a color depth of 24 or 32 bits (True Color), depending on your display. Once done, press escape ("Esc") and let the computer boot up.

Any splash image of your choice for grub must have this exact pixel size, and be of the type TarGA which has the extension .tga that you can see on the freshly installed images. In other words, if you happen to dislike all images of that official splash collection (which originates, by the way, in Debian by virtue of their free software policy from Wikipedia’s Commons featured desktop or widescreen desktop backgrounds, among others), you could as well take any other picture of your liking, providing that you can transform it into the size and format prescribed by grub.

But make sure that the background image has a dark bottom area and a dark top left corner, otherwise the help text and the menu itself will be difficult to discern, since the default Mint theme has a white text (and grub itself communicates in light gray anyway) — and if we begin to fiddle around with that, then we cannot satisfy our claim of simplicity anymore broken heart.

Image editing

Now that you made your choice, open up your preferred image in or with the GIMP image editor. In a first step, save it to, say, my_background.xcf in your home directory. Then, you can crop it and scale it (it won’t be read-only anymore) to fit nicely the size you’ve noted above. Finally, export it (File› Export…) to my_background.tga. That’s it — the background is adapted to your display.

Image installation

You must then put the new splash image into the right place by the following command in a terminal (which you can repeat later on at will; as long as you don’t change the image resolution, you won’t need to redo any of the following steps thereafter):
 …$ sudo cp -i ~/my_background.tga /boot/grub/linuxmint.tga
 
You must also register the value of its resolution into:
 …$ sudo gedit /etc/default/grub
 
where the GFXMODE line must match your screen resolution (with the initial # comment sign removed):
 GRUB_GFXMODE=…
 
Therein, you must also change or add in the GRUB_FONT line to look like (see next section):
 GRUB_FONT=/boot/grub/fonts/unifont.pf2 
 

Make the font better visible

Indeed, to get rid of the last remainder of the DOS era, you should change grub’s default font too. Unfortunately, you won’t have many choices for its replacement at the moment as most fonts in the repository (LM14 Nadia) will not work well with grub. After having tried most of the monotype fonts available, the only one I’ve found usable is the TrueType version of the GNU Unifont.

You must first transform this font (which has been installed above) into grub’s own format (the font style and its size matter):
…$ sudo grub-mkfont --bold -s 16 -o /boot/grub/fonts/unifont.pf2 \
   /usr/share/fonts/truetype/unifont/unifont.ttf
Finally, you must tell grub about all these changes made:
…$ sudo update-grub
If everything went well, i.e. when update-grub did mention linuxmint.tga and did not complain about anything else, you can reboot again to see the result — and you’re done.
Comments
fotonix 9 years ago

This proved, along with the comments, to be a valuable guide to adding a lovely splash of color to my GRUB2 on Mint 17.3. Thank you.

Along this journey I discovered one tip about JPeG files. When you are preparing the file (to the exact screen dimensions), ensure that as you save/export, that you avoid: 'Optimized' and 'Progressive'. These prevent the image from being displayed by GRUB, you will get a black screen.


jaytdee 9 years ago

I spent a number of hours trying to add an image to grub2 using this tutorial and wasn't successful. I knew it was something simple, because after placing the image (as jpg) in /boot/grub/ and setting gfxmode in
/etc/default/grub and running update-grub the terminal was showing recognition the background image. After fooling around and trying a miriad of different things still couldn't solve the problem.

Finally decided to search for the ubuntu documentation for Grub2 (https://help.ubuntu.com/community/Grub2/Displays). Finally! My mistake was using a jpeg image file. So basically, the tutorial is good. If you just Export the image file to /boot/grub/ as png or tga your golden. So if you're using the terminal to do this you'd type: cp -i yourfile.png /boot/grub/grub_pix.png
then update-grub; restart and see the results.

The problem with using a jpeg file seems to be it has to be an 8 bit (256) rgb non-indexed file. Using the Gimp image editor I couldn't confirm this. Changing the image file to .png was the solution. I could see no difference in the image quality.

So the tutorial is good. Following jr. mints instructions worked great. Thanks! This was done in The Mint17.1 Cinammon Edition. So unless you can verify the jgeg file meets the requirements, I'd go with png.

I'd encourage anyone who's interested in installing a splashimage to get the ubuntu documentation; it helps you understand better what's going on.

I've used it to change grub's text and highlight colors too. Just follow the steps. The only thing I had to figure out was where the setting for the menu color and highlight etc. could be found. In Mint 17.1 Cinnamon edition; look in /etc/grub.d/06_mint_theme. You'll find them there.

I,m a Newbie to linux, so even with all the trials I'm having a ball. Learning to use the terminal has been fun.

Thanks again guys!


MagicMint 10 years ago

@jr_mint: Indeed, your solution would be easier if you stated it this way — without duplicating your own tutorial; a simple link would have been enough ;-) — :

’The (alphabetically) first image in /etc/default/grub would be taken as splash image (as long as GRUB_GFXMODE is appropriately defined), hence the copy operation, unless GRUB_BACKGROUND is set in /etc/default/grub.’

But the point is, we want to ‘embellish’ the boot screen :-), so the resolution of any image should MATCH that of the physical screen, and the readability of the text matters as well — hence all the detailed steps above.


jr_mint 10 years ago

Hi, if you simply want to ADD a background and change it at your will anytime without any hassle (only a command to copy the new image to the required grub directory) there is a more elegant way (and using the .jpg format instead of those huge .tga images):

01) Find your own grub PREFERED resolution, not the max resolution: reboot your machine and in the grub menu press 'c' and type:

vbeinfo

Your grub's PREFERED resolution will be the LAST ONE ON THE LIST. Press esc to continue your booting process.

02) Create somewhere a directory to store the image(s) you want to use and copy to that directory one or more images (in the .jpg format) that are either the exact same size or larger (grub will fit larger or smaller images to the resolution it is using but the detailing will not be as good as using an image with the same resolution as grub's).

03) Copy (and rename to "grub_pix.jpg") the image you want to use by opening a Terminal on the directory where the images are and type:

sudo cp -i [name of your image without brackets].jpg /boot/grub/grub_pix.jpg

04) To change grub's resolution to its PREFERED one you can from terminal open (with gedit or leafpad or other text editor) the grub's configuration file at /etc/default/grub. With gedit the command will be:

sudo gedit /etc/default/grub

05a) Add the following lines to the file and save it (for this example let's suppose a resolution of 800x600:

# Changed grub's resolution to grub's PREFERED resolution
GRUB_GFXMODE=800x600

05b) If you want to you can also change the time grub waits until it loads the default operating system by changing the value on the line

GRUB_TIMEOUT=10

to another value (in seconds), for example to wait 30 seconds:

GRUB_TIMEOUT=30

06) Update grub from terminal with the command:

sudo update-grub

07) Reboot to see the results.

08) When later you want to CHANGE THE PICTURE to another you simply open a terminal in the directory where your grup pictures are and issue the command:

sudo cp -i [name of the new picture without brackets].jpg /boot/grub/grub_pix.jpg

and type "y" to accept replacing the current grub_pix.jpg with the new one. This way you DO NOT NEED to constantly update your grub's configuration settings, only the picture.

Simple and easy...

PREFERED COMMENT FROM JR: "I don't use Linux because it is FREE, I am free because I use LINUX"


Verwijs69 10 years ago

Gub customiser doesn't add "GRUB_BACKGROUND" option, witch you need to set background.... 


Verwijs69 10 years ago

works GREAT!!
https://plus.google.com/111310545842863442992/posts/SLWAKpUR4cz


MagicMint 10 years ago

@rod_d: The unicode.pf2 font is grub’s own font — the ugly one we want to replace by the better looking unifont.pf2. The TTF version of the latter needs to be transformed into grub’s pf2 format manually as described above.


jahid_0903014 11 years ago

nice!


mhbell 11 years ago

Excellent and it works great
Mel


MagicMint 11 years ago

@MnKiwi: Unfortunately, the only step in the procedure above that “Grub Customizer” as a graphical interface might save you is “Image installation” for a single image :-(


MnKiwi 11 years ago

Nice tutorial. Another option might be to use 'Grub Customizer' although following your tutorial is likely to be the better learning opportunity.


Raze 11 years ago

You've made a very clear, detailed and unambiguous tutorial here, MagicMint. Thank you.

I'll be enjoying a new background on GRUB for about one second every day now.


Hammer459 11 years ago

Never really understood the point of spending all that energy on the boot screen. It is visible for 1-3 seconds at boot...
Oh well :-) Your tutorial seem to describe the procedures in good detail. I will promote it.