TransWikia.com

Can GRUB font size be customised?

Unix & Linux Asked by neydroydrec on February 5, 2021

I would like to reduce the size of the font of GRUB boot loader. Is it possible and so how?

5 Answers

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 grub2 instead of grub
  • Doesn't consider multi-monitor setups

Enjoy!

Answered by xjcl on February 5, 2021

If you are looking for a simpler GUI alternative, you can use Grub Customiser to change the font size, colors and background of GRUB.

Answered by Juan C. Roldán on February 5, 2021

In Debian/Ubuntu you can change the default GRUB resolution, thereby resulting in larger fonts on the GRUB menu:

  1. Make a backup: sudo cp -a /etc/default/grub /etc/default/grub.bak
  2. Open the configuration: sudo $EDITOR /etc/default/grub
  3. Edit GRUB_GFXMODE entry to suit your resolution e.g. 800x600
  4. sudo update-grub
  5. Reboot; GRUB will display in the mode you set.

Answered by arunk on February 5, 2021

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.

  1. Choose a font, in this example I chose DejaVuSansMono.ttf
  2. Convert the font in a format GRUB understands:
    sudo grub2-mkfont -s 14 -o /boot/grub2/DejaVuSansMono.pf2 /usr/share/fonts/dejavu/DejaVuSansMono.ttf
  3. Edit the /etc/default/grub file adding a line:
    GRUB_FONT=/boot/grub2/DejaVuSansMono.pf2
  4. 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'}
  5. reboot.

The resolution of GRUB display may also affect the size of the font, more on resolution etc. on the ubuntuforums link above.

Answered by neydroydrec on February 5, 2021

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.

Answered by fpmurphy on February 5, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP