PDA

View Full Version : How to set the default GRUB2 font and splash screen in Fedora



plasmonics
20th February 2012, 02:08 PM
When I installed F16 on my laptop, the installer set up a coarse default font and a blank background. You have to use a manual method the set up the font and background splash. The following works for a wide screen. If you have a non-wide screen, adjust the numbers accordingly, and change the "wide" subdirectory to "standard".

Make a GRUB2 font using (ignore the screen messages - the font is still made)


grub2-mkfont --output=/boot/grub2/DejaVuSansMono.pf2 --size=24 /usr/share/fonts/dejavu/DejaVuSansMono.ttf


Edit /etc/default/grub and insert the following lines:


GRUB_FONT=/boot/grub2/DejaVuSansMono.pf2
GRUB_GFXMODE=1280x800
GRUB_GFXPAYLOAD_LINUX=keep
GRUB_BACKGROUND=/usr/share/backgrounds/verne/default/wide/verne.png


Rebuild the cfg file using


grub2-mkconfig -o /boot/grub2/grub.cfg


------------------Edited Jun 9, 2012--------------------

Note that F17 implements an alternative method of setting the grub2 theme. If you wish to use the new method, comment out GRUB_FONT and GRUB_BACKGROUND and uncomment GRUB_THEME. It points to a text file theme.txt which contains the variables you need to adjust. After adjusting, rebuild the cfg file as described above.

kkshethin
21st February 2012, 06:24 PM
thanks, i will try

glennzo
23rd February 2012, 12:12 PM
I've tried this and it worked well. I give it an 8 out of 10. There are some minor issues but nothing critical.

Thank you Plasmonics. I've been waiting for someone to figure this out. Since I like to have a menu background I've researched exaustively but the avalable (yes, I've seem them all) GRUB2 documentation, while good, is far from complete and quite lacking in a lot of areas.

nonamedotc
23rd February 2012, 04:21 PM
When I installed F16 on my laptop, the installer set up a coarse default font and a blank background. You have to use a manual method the set up the font and background splash. The following works for a wide screen. If you have a non-wide screen, adjust the numbers accordingly, and change the "wide" subdirectory to "standard".

Make a GRUB2 font using (ignore the screen messages - the font is still made)


grub2-mkfont --output=/boot/grub2/DejaVuSansMono.pf2 --size=24 /usr/share/fonts/dejavu/DejaVuSansMono.ttf


Edit /etc/default/grub and insert the following lines:


GRUB_FONT=/boot/grub2/DejaVuSansMono.pf2
GRUB_GFXMODE=1280x800
GRUB_GFXPAYLOAD_LINUX=keep
GRUB_BACKGROUND=/usr/share/backgrounds/verne/default/wide/verne.png


Rebuild the cfg file using


grub2-mkconfig -o /boot/grub2/grub.cfg


This will not work if the / partition is encrypted and there is no separate /usr partition - right? Can the image also be copied to /boot like the font?

PabloTwo
23rd February 2012, 04:29 PM
Can the image also be copied to /boot like the font?
Yes. This is mine: GRUB_BACKGROUND=/boot/grub/farcry_3-1440x900.jpg

nonamedotc
23rd February 2012, 04:32 PM
Ah ! Excellent! Time to make the splash screen colorful :)

plasmonics
23rd February 2012, 08:48 PM
The image file can be in any directory. It also doesn't have to be png.

The font can also be any ttf. I gave that example, because DejaVu is my default for many applications.


-----------------------
Correction (2/24/2012): It supports only tga, jpg, and png. grub2-mkconfig warns if the graphics format is unsupported.

synic
24th March 2012, 10:17 PM
I'm having trouble with this. I've placed an image in /boot/grub/blue_energy_tornado_grub_splash.jpg but when I run grub2-mkconfig I get nothing..

GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="Fedora"
GRUB_DEFAULT=0
GRUB_GFXMODE=1366x768
GRUB_GFXPAYLOAD_LINUX=keep
GRUB_BACKGROUND=/boot/grub/blue_energy_tornado_grub_splash.jpg
GRUB_CMDLINE_LINUX="rd.md=0 rd.lvm=0 rd.dm=0 KEYTABLE=us quiet SYSFONT=latarcyrheb-sun16 rhgb rd.luks=0 LANG=en_US.UTF-8"

and


[root@Faeland ~]# grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-3.3.0-4.fc16.x86_64
Found initrd image: /boot/initramfs-3.3.0-4.fc16.x86_64.img
Found linux image: /boot/vmlinuz-3.1.0-7.fc16.x86_64
Found initrd image: /boot/initramfs-3.1.0-7.fc16.x86_64.img
No volume groups found
done
[root@Faeland ~]#


What am I doing wrong?

EDIT:

Off topic but what about the Fedora loading screen; that comes up after grub but before the login screen? That takes longer. Anyone point me in the right direction for changing that one?

Thanks

PabloTwo
24th March 2012, 10:23 PM
What am I doing wrong?
You're failing to follow all the instructions. Go back up to post#1 of this thread and read it.
It won't work without the font file.

synic
24th March 2012, 10:24 PM
Ah... you HAVE to have the font title. ;)

EDIT:

KOOOOOL Hell Yes..:dance:

Thanks.

plasmonics
25th March 2012, 12:46 PM
There is a code fragment in the bash script /etc/grub.d/00_header that looks for the font file. If it is not defined, it does not load the graphics part.

This is also the standard behaviour in another (non-Fedora) distro that I use.

synic
25th March 2012, 07:33 PM
There is a code fragment in the bash script /etc/grub.d/00_header that looks for the font file. If it is not defined, it does not load the graphics part.

This is also the standard behaviour in another (non-Fedora) distro that I use.

That's what I wanted to know. Weird that Grub2 would require this feature in order to be customisable.

callado
3rd June 2012, 10:35 AM
Works well with Fedora 17 with the beefy-miracle image. I have two questions:
I used the same font and size as in #1, but the vertical borderlines are not continuous, they are broken between the lines. Should I use other font or how could I fix that?
How can I change the main title at the top?

plasmonics
3rd June 2012, 12:14 PM
The vertical lines remain broken with DejaVu. This is true with Debian/grub2 as well. I believe that the border decorations are written into the font definition file. You can try reducing the font size. You can also experiment with other fonts in /usr/share/fonts. Not all of them work. In the end, I switched back to DejaVu.

I think the title is in /etc/defaults/grub.

elias12
8th June 2012, 11:56 AM
Nice Thank you:)

Furthermore you do not want anything if you do a fresh install simply use the following steps to enable background.

Please open /etc/default/grub and uncomment the line "GRUB_THEME". Here an example for my config:


GRUB_TIMEOUT=30
GRUB_DISTRIBUTOR="Fedora"
GRUB_DEFAULT=saved
GRUB_CMDLINE_LINUX="rd.md=0 rd.lvm=0 rd.dm=0 SYSFONT=True KEYTABLE=de rd.luks=0 LANG=en_US.UTF-8 rhgb quiet"
GRUB_THEME="/boot/grub2/themes/system/theme.txt"


In the "theme.txt" is all you need to install a theme. Sure, you can change the background by simple change the background with your favourite one. This is a standard-entry after the fresh FD17 install.

Don't forget to update grub as shown by @plasmonics

callado
8th June 2012, 01:52 PM
I tried both the system and the starfield theme. The borders are really nicely rounded. But I did not like the font colors and the font size. So, I tried to edit them. The font color changes as it should, but apparently changing the font size has no impact. So the font is still too small for my monitor.

elias12
8th June 2012, 02:09 PM
Try another font and change (if you needed) the size in the /boot/grub2/system or starfield/theme.txt - hope this helps.

Don't forget after changing to update grub