I would like to reduce the size of the font of GRUB boot loader. Is it possible and so how?
5 Answers
After some research based on the answers of @fpmurphy and @hesse, also based on a comprehensive thread at ubuntuforums and on Fedora Wiki, I found out how to reduce the font size of GRUB2.
- Choose a font, in this example I chose DejaVuSansMono.ttf
- Convert the font in a format GRUB understands:
sudo grub2-mkfont -s 14 -o /boot/grub2/DejaVuSansMono.pf2 /usr/share/fonts/dejavu/DejaVuSansMono.ttf - Edit the /etc/default/grub file adding a line:
GRUB_FONT=/boot/grub2/DejaVuSansMono.pf2 - Update GRUB configuration with:
- BIOS:
sudo grub2-mkconfig -o /boot/grub2/grub.cfg - EFI:
sudo grub2-mkconfig -o /boot/efi/EFI/{distro}/grub.cfg # distro on RHEL8 is {'redhat'}
- BIOS:
- reboot.
The resolution of GRUB display may also affect the size of the font, more on resolution etc. on the ubuntuforums link above.
- 1On UEFI system one would use
grub2-mkconfig -o /boot/efi/EFI/centos/grub.cfgscrutari– scrutari2019-03-13 15:32:06 +00:00Commented Mar 13, 2019 at 15:32 - 4On Linux Mint 20 the command is
grub-mkfont. On my systems, the use of DejaVuSansMono leads to "broken" vertical lines in the box around the boot menu, probably because the vertical box drawing characters are 1 pixel too short. On Mint 20 the only pre-installed font that did it correctly was "FreeMono.ttf"sudo grub-mkfont -s 24 -o /boot/grub/FreeMono.pf2 /usr/share/fonts/truetype/freefont/FreeMono.ttfdr fu manchu– dr fu manchu2021-06-19 03:27:05 +00:00Commented Jun 19, 2021 at 3:27 - @drfumanchu thanks, the same works for Ubuntu 20.04, (along with changing any
grub2references togrub). Also, /etc/default/grub advises to runupdate-grub, which callsgrub-mkconfig, and (I'm hoping) does the right thing with regards to EFI.mwfearnley– mwfearnley2021-08-03 07:50:28 +00:00Commented Aug 3, 2021 at 7:50 - To make the font in Fedora 34, use
sudo grub2-mkfont -s 20 -o /boot/grub2/DejaVuSansMono.pf2 /usr/share/fonts/dejavu-sans-mono-fonts/DejaVuSansMono.ttfTo update GRUB on Fedora 34 usesudo grub2-mkconfig -o /etc/grub2-efi.cfgNicholas Stommel– Nicholas Stommel2021-08-19 19:30:36 +00:00Commented Aug 19, 2021 at 19:30 - I am trying to use the breeze theme. It already contains fonts as small as 12, so no need to run grub-mkfont, but it just WON'T PICK THEM UP, even if I change ALL fonts to size 12 in theme.txt. It just picks some hardcoded value.Szczepan Hołyszewski– Szczepan Hołyszewski2022-09-19 06:47:08 +00:00Commented Sep 19, 2022 at 6:47
In Debian/Ubuntu you can change the default GRUB resolution, thereby resulting in larger fonts on the GRUB menu:
- Make a backup:
sudo cp -a /etc/default/grub /etc/default/grub.bak - Open the configuration:
sudo $EDITOR /etc/default/grub - Edit
GRUB_GFXMODEentry to suit your resolution e.g. 800x600 sudo update-grub- Reboot; GRUB will display in the mode you set.
Yes, both the font and the font size can be customised. See the grub-mkfont utility. Bitmap (.pf2) and Truetype (.ttf) fonts are supported.
Just do an Internet search on grub-mkfont and you will quickly come across a number of examples of the necessary steps.
- 1Nice indeed I found this documentation but somehow I need to
update-grub, which command I don't seem to have on Fedora 16 (?).neydroydrec– neydroydrec2012-02-15 12:49:38 +00:00Commented Feb 15, 2012 at 12:49 - OK, I see elsewhere the equivalent of update-grub is
grub2-mkconfig -o /boot/grub2/grub.cfg.neydroydrec– neydroydrec2012-02-15 12:51:32 +00:00Commented Feb 15, 2012 at 12:51
I whipped up a little script to automatically scale font size to monitor/screen width.
SCREEN_WIDTH=$(xdpyinfo | grep dimensions | cut -d ':' -f 2 | cut -d 'x' -f 1) FONT_SIZE=$((${SCREEN_WIDTH} / 80)) sudo grub-mkfont -s ${FONT_SIZE} -o /boot/grub/DejaVuSansMono.pf2 /usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf printf "\nGRUB_FONT=/boot/grub/DejaVuSansMono.pf2" | sudo tee -a /etc/default/grub sudo grub-mkconfig -o /boot/grub/grub.cfg A few caveats
- This font is different from the default one
- On old systems you might need
grub2instead ofgrub - Doesn't consider multi-monitor setups
Enjoy!
- I love it, I did change your 80 to 120Pelle– Pelle2022-01-30 18:06:56 +00:00Commented Jan 30, 2022 at 18:06
If you are looking for a simpler GUI alternative, you can use Grub Customiser to change the font size, colors and background of GRUB.