Setting a grub2 Boot Splash Image (Shallow Thoughts)

Akkana's Musings on Open Source Computing and Technology, Science, and Nature.

Mon, 17 Jan 2022

Setting a grub2 Boot Splash Image

For many years, I used extlinux as my boot loader to avoid having to deal with the annoying and difficult grub2. But that was on MBR machines. I never got the sense that extlinux was terribly well supported in the newer UEFI/Secure Boot world. So when I bought my current machine a few years ago, I bit the bullet and let Ubuntu's installer put grub2 on the hard drive.

One of the things I lost in that transition was a boot splash image. When I boot my older extlinux machines, I can set the background to show a nice photo. When I booted the Ubuntu-installed machine, the boot screen was white text on a black background.

I tried several times to configure a grub2 splash image, but nothing worked (including Ubuntu's grub2-splashimages package) and I always gave up after a few hours. After all, is it really worth spending many hours fighting to install a splash image that you'll only see for a few seconds once at the beginning of the day?

But you know, it does matter. Yes, it's only a few seconds, but those seconds come at the very beginning of the day. And you know, seeing a pretty boot splash image kind of lifts my spirits, starting the day off on a high note, while that white-text-on-black-background Ubuntu screen did the opposite.

A few months ago I switched to Debian, which gave me — white text on a blue background. So much better! (Sigh.) I tried again, thinking maybe Debian would be easier, installing the grub2-splashimages package, following various howtos, to no avail. In particular, the howtos are never clear about where to put the splash image, what size and format it needs to be, and what the image path should look like in /boot/grub/grub.cfg.

But after a grub-related discussion on the SFLUG mailing list, I mentioned my problem and got a couple of replies from people who had gotten it to work. Their examples didn't quite work, but they pointed me in the right direction, and I finally got it working.

[Aspens on Pajarito Mtn, boot splash] And now, my day can start with aspens on Pajarito Mountain instead of dull black and white.

Important things for making a working grub2 boot splash

I experimented by modifying /boot/grub/grub.cfg, but once I got it working, I added it to /etc/grub.d so that it will be renewed whenever update-grub runs. You can put it in /etc/grub.d/05_debian_theme; in my case, I put it at the beginning of in /etc/grub.d/09_local which comes after 05_debian_theme and overrides it.

#
# First add a boot splash image, overriding whatever 05_debian_them
# may have set.
#
insmod png
if background_image /boot/grub/dsc02644.png; then
  # colors to go on top of the image.
  # Setting the second color to black actually means make it transparent.
  set menu_color_normal=white/black
  set menu_color_highlight=yellow/black
else
  # colors used if the boot splash image doesn't work
  set menu_color_normal=cyan/blue
  set menu_color_highlight=white/blue
fi

Tags: , , , ,
[ 19:29 Jan 17, 2022    More linux | permalink to this entry | ]

Comments via Disqus:

blog comments powered by Disqus