Adding a GRUB2 background image and custom font
Solution 1
Info about changing GRUB font to Ubuntu-Mono that I should have found earlier:
In this question, OP tried to change font without results. Problem appears to be a bug with ascending order glyphs as per this answer.
So basically I can't use anything from the Ubuntu Font Family for my GRUB font (sad but true) until the bug is fixed.
Info about background image:
If no option is specified in /etc/default/grub
, GRUB will use the first found image in /boot/grub
. The image must in RGB colorspace and, if a JPEG, 8-bit. GRUB will automatically detect the screen resolution, no configuration needed, and stretch/shrink the image if necessary (from thegeekstuff.com).
So to sum up, all that was needed was for me to just go with the default font (no way around it) and edit my image in GIMP to fit the parameters.
Solution 2
Grub Themes
The problem may have been caused by a grub customizer bug. An alternative to grub customizer (a third party program) is to use grub-themes which comes standard on every Ubuntu installation:
Make Grub fonts
Even if you are just using regular grub, if you want a different font you must use grub-mkfont
program first. The same holds true for Grub Customizer used by OP and Grub Themes used in first section of this answer.
Here are the fonts I have made for grub to use:
$ ll /usr/share/grub/themes/Tuxkiller2/*.pf2
-rwxrwx--- 1 root root 176923 Jun 9 16:41 /usr/share/grub/themes/Tuxkiller2/dejavu_14.pf2*
-rwxrwx--- 1 root root 20041 Jun 9 16:41 /usr/share/grub/themes/Tuxkiller2/droidlogo_bold_17.pf2*
-rwxrwx--- 1 root root 23339 Jun 9 16:41 /usr/share/grub/themes/Tuxkiller2/droidlogo_bold_20.pf2*
-rwxrwx--- 1 root root 31498 Jun 9 16:41 /usr/share/grub/themes/Tuxkiller2/droidlogo_bold_26.pf2*
-rwxrwx--- 1 root root 15244 Jun 9 16:41 /usr/share/grub/themes/Tuxkiller2/droidlogo_regular_12.pf2*
-rwxrwx--- 1 root root 19148 Jun 9 16:41 /usr/share/grub/themes/Tuxkiller2/droidlogo_regular_17.pf2*
-rwxrwx--- 1 root root 113623 Jul 11 17:05 /usr/share/grub/themes/Tuxkiller2/ubuntu_bold_italic_36.pf2*
-rwxrwx--- 1 root root 45391 Jul 11 17:08 /usr/share/grub/themes/Tuxkiller2/ubuntu_light_20.pf2*
-rwxrwx--- 1 root root 41020 Jul 11 17:16 /usr/share/grub/themes/Tuxkiller2/ubuntu_regular_18.pf2*
-rwxrwx--- 1 root root 46423 Jul 11 17:16 /usr/share/grub/themes/Tuxkiller2/ubuntu_regular_20.pf2*
-rwxrwx--- 1 root root 68602 Jul 11 16:59 /usr/share/grub/themes/Tuxkiller2/ubuntu_regular_28.pf2*
To create a font use the grub-mkfont
program like this guide outlines: Increase Font in GRUB for High DPI Screens:
sudo grub-mkfont --output=/boot/grub/fonts/DejaVuSansMono24.pf2 \
--size=24 /usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf
Then in your /etc/default/grub
configuration file tell it to use the new .pf2
font file:
# More readable font on high dpi screen, generated with
# sudo grub-mkfont --output=/boot/grub/fonts/DejaVuSansMono24.pf2 \
# --size=24 /usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf
GRUB_FONT=/boot/grub/fonts/DejaVuSansMono24.pf2
Finally run:
sudo update-grub
Reply to comment: Grub themes are built into grub so use:
$ apt policy grub2-common
grub2-common:
Installed: 2.02~beta2-36ubuntu3.18
Candidate: 2.02~beta2-36ubuntu3.18
Version table:
*** 2.02~beta2-36ubuntu3.18 500
500 http://ca.archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages
100 /var/lib/dpkg/status
2.02~beta2-36ubuntu3 500
500 http://ca.archive.ubuntu.com/ubuntu xenial/main amd64 Packages
Related videos on Youtube
WindowsEscapist
Updated on September 18, 2022Comments
-
WindowsEscapist over 1 year
I am trying to use grub-customizer to add a custom background image and use the Ubuntu Condensed font. The preview looks fine:
But when I actually boot up, I get a messed-up configuration. The text is messed-up, with "unknown character" symbols appearing for the box around the boot menu options (because apparently only the default grub font has these special characters?). However, the boot options are in the Ubuntu font. There is only a black screen as the background.
I'm trying to use a 1366x768 (same as my screen res) .png as the background image. This should be compatible, right? What can I do to get a background image working?
Sorry for the wait:
-
nanofarad over 11 yearsStill , a camera-made screenshot would help. Please try to provide one.
-
WindowsEscapist over 11 yearsOK. I will post a photo tomorrow.
-
WindowsEscapist over 11 yearsSorry for the delay, I need to get a piece of additional hardware (camera is SDHC, laptop can only read SD). Will post tomorrow.
-
dr fu manchu almost 3 yearsMany modern fonts are missing the box-drawing characters. On Linux Mint DejaVuSansMono has them, but the vertical box drawing character is one pixel too short, leading to a broken vertical line. The only pre-installed font on Mint 20 which does it right is FreeMono.ttf
-
-
WindowsEscapist over 11 yearsJust a quick question - the page was last current for Lucid Lynx. Does this impact anything?
-
WinEunuuchs2Unix over 5 yearsYou can use any font you like, you just need to generate it in grub
.pf2
format. See: linux.org/docs/man1/grub2-mkfont.html I can also write an answer if you have difficulties. -
WindowsEscapist over 5 years@WinEunuuchs2Unix The system in question has long since perished, so I may not be able to accept a new answer, but I think it might be a useful thing to have up. I believe the original problem was an issue with grub-customizer, which has probably been fixed by now.
-
WinEunuuchs2Unix over 5 yearsWindowsEscapist I notice our screen names share a theme :) On that note I've posted an answer on grub themes. I've also upvoted your question and answer as compensation for putting in my two cents worth.
-
WinEunuuchs2Unix over 5 yearsLink only answers are discouraged in Ask Ubuntu. The reason being that the link could become abandoned in the future. As it turns out the link here is not found. Please see my answer just posted as a comparison. Below the link I've included the essential parts of what it contains. This is insurance if one day the link is no longer supported by the author / organization.
-
Organic Marble over 5 yearsWhen I do
apt policy grub-themes
I getunable to locate package
so I'm perplexed by the statement "comes standard in every Ubuntu installation"! If this tool was used to make that awesome grub screen, please tell me where to get it! -
WinEunuuchs2Unix over 5 years@OrganicMarble Excellent comment I forgot I went through the same mind-bending exercise. I've added new section in the answer to reply to your comment. However I think I may have to post a tutorial on how to create a grub theme.
-
WinEunuuchs2Unix over 5 years@OrganicMarble I just changed
apt
policy fromgrub
togrub2-common
. First time and second time was wrong name. :( -
Organic Marble over 5 yearsThanks! I've googled
grub themes
and now understand this better. +1 for introducing this concept to me, if for no other reason. -
WinEunuuchs2Unix over 5 years@OrganicMarble thanks for upvote. I spent many weeks fine tuning grub-theme so if you post a question ping me here with link and I'll try to answer it.
-
WindowsEscapist over 5 yearsAlso downvoting this until information from the link is incorporated. The relevant section of the page in question can be found on archive.org (although it doesn't directly answer the question).
-
WindowsEscapist over 5 years@WinEunuuchs2Unix Thanks for your work! This is a fine answer, and probably better than the accepted one for present-day readers. I'm going to leave the current one as accepted, since it directly answers the question about grub-customizer. But since (I think) this question was caused by a historical bug in grub-mkfont, which grub-customizer was calling, nobody should be affected by it anymore.
-
WinEunuuchs2Unix over 5 years@WindowsEscapist You're welcome for the work. I agree leaving the accepted answer is best. My intention was to only share a little bit of what I learned this year about generating Grub Fonts. I haven't tried grub customizer yet but can certainly appreciate it's broad appeal after scratching my head over some grub scenarios such as hidden menus, timeouts, next reboot, get/save environment and even compiling the code for EFI 64-bit. If I may say thank you for your kind words and taking time to reflect.