# grub2 will not display background image

For some reason I cannot get grub2 to display a background image. I am using a compliant png image and I was able to get this working on fc24 by editing /etc/default/grub so that it looks as follows:

GRUB_TIMEOUT="5"
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT="saved"
#GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="rd.lvm.lv=fedora/root rd.lvm.lv=fedora/swap rhgb quiet"
GRUB_DISABLE_RECOVERY="true"
GRUB_BACKGROUND="/boot/grub2/themes/system/nasa-wallpaper2.png"
export GRUB_COLOR_NORMAL="white/black"
export GRUB_COLOR_HIGHLIGHT="magenta/black"
GRUB_GFXMODE="640x480"
#GRUB_THEME="/boot/grub2/themes/system/theme.txt"


I have noticed however, that I have no "/boot/grub2/themes/system/theme.txt" file. I recall reading somewhere that an OP installed and then removed a theme, just to get this file, which allowed his background image to be displayed. I think this happened accidentally for me in fc24; however, I must be using whatever the standard system theme is because I haven't added any. Can I do something similar?

Thanks

Edit:

In case this is important, the drive is formatted as GPT/UEFI and I am updating grub2 with the following command:

grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg

The output is as follows:

[xxxxxx@localhost ~]$sudo grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg [sudo] password for xxxxxx: Generating grub configuration file ... Found background: /boot/grub2/themes/system/nasa-wallpaper2.png Found linux image: /boot/vmlinuz-4.8.10-300.fc25.x86_64 Found initrd image: /boot/initramfs-4.8.10-300.fc25.x86_64.img Found linux image: /boot/vmlinuz-4.8.6-300.fc25.x86_64 Found initrd image: /boot/initramfs-4.8.6-300.fc25.x86_64.img Found linux image: /boot/vmlinuz-0-rescue-39775cde93be4056b810772e333dfbdb Found initrd image: /boot/initramfs-0-rescue-39775cde93be4056b810772e333dfbdb.img Found Windows Boot Manager on /dev/sda2@/EFI/Microsoft/Boot/bootmgfw.efi done [xxxxxx@localhost ~]$


So, grub2 did find my background image. BTW, the system is dual-boot; but that really shouldn't matter for displaying a background image.

What I'd like to do next is load a grub2 theme, to see if I can get a background image to display. Can someone explain how to do this? I've loaded the 'breeze' theme from 'yumex-dnf;' but I don't know how to configure it. Any help appreciated.

Thanks

edit retag close merge delete

could it be because in your above

/etc/default/grub


you have this:

#GRUB_TERMINAL_OUTPUT="console"


Try un-commenting the line and using a value like "gfxterm" ?

( 2016-12-07 03:17:20 -0500 )edit

I tried this and it simply doubled the boot menu entries. These were repeats. But yeah, just commenting out the line is pretty lame; I guess I should have tried to find a real value to put there, which I will now. Oh and I have grub-customizer installed. It has its own grub.cfg at:

/etc/grub-customizer/grub.cfg

MKCONFIG_CMD=grub2-mkconfig
INSTALL_CMD=grub2-install
MKFONT_CMD=grub2-mkfont
CFG_DIR=/etc/grub.d
OUTPUT_DIR=/boot/efi/EFI/fedora
OUTPUT_FILE=/boot/efi/EFI/fedora/grub.cfg
SETTINGS_FILE=/etc/default/grub

( 2016-12-07 04:35:21 -0500 )edit

BTW, grub-customizer is notorious for NOT being able to set background images. It edits the boot menu options just fine. I'm wondering if the contents of this file are not quite "optimized?"

( 2016-12-07 04:39:12 -0500 )edit

It also appears that I'm able to apply themes. I just can't set a background image.

( 2016-12-07 04:40:12 -0500 )edit

Does anyone have a working example of an FC25/EFI system with a background image displayed?

Please post if you have them.

Thanks

( 2016-12-07 04:43:46 -0500 )edit

Sort by » oldest newest most voted

Here is my working /etc/default/grub:

GRUB_TIMEOUT="15"
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT="saved"
#GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="rhgb quiet"
GRUB_DISABLE_RECOVERY="true"

export GRUB_COLOR_NORMAL="white/black"
export GRUB_COLOR_HIGHLIGHT="yellow/red"
GRUB_BACKGROUND="/boot/grub2/themes/fedora_wall6_fixed.jpg"
GRUB_GFXMODE="800x600"


Check out the screenshot. Screenshot-grub2.png

For me, the Fedora 25 setup is virtually identical.

I had trouble with this too until I found a post suggesting commenting out the GRUB_TERMINAL_OUTPUT="console" line.

more

Thanks Glenn,

Looks beautiful.

Based on the screenshot it appears to be a Fedora 24 system. I got this working in '24; but '25 seems to be holding me up. At this point, I'm thinking that there may be something amiss with the grub2 configuration scripts on '25.

Anyone who has this working on '25 please post.

Thanks

( 2016-12-08 13:07:51 -0500 )edit

Glenn,

Thanks for adding the Fedora 25 screenshot. I tried your first /etc/default/grub and it didn't work for me. Is your '25 config any different; even a little? If so please post. Also, is it an EFI rig? I got the background image to display in '24 (by commenting out the GRUB_TERMINAL_OUTPUT="console" line), when I was still in MBR; but not in '25 under EFI. My mother board supports both legacy bios and UEFI boot. The video drivers are obviously still available under UEFI boot, since I can load my background image from a theme. I just can't do it directly for some reason.

( 2016-12-09 11:46:37 -0500 )edit

Also, this is my command line: GRUB_CMDLINE_LINUX="rd.lvm.lv=fedora/root rd.lvm.lv=fedora/swap rhgb quiet" I've noticed yours is just: GRUB_CMDLINE_LINUX="rhgb quiet" I suspect that if I try to change this my system won't boot anymore; so I'm reluctant to edit this.

( 2016-12-09 11:50:39 -0500 )edit

Mine is "default" with the exception of the lines for colored text, the line for the background image, the commented out line for GRUB_TERMINAL_OUTPUT and GRUB_TIMEOUT. The bootloaders I've shown you are virtual machines so I don't thing EFI or BIOS are relevant for me.

( 2016-12-10 03:34:27 -0500 )edit

Here is the one from Fedora 25.

GRUB_TIMEOUT="10"
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT="saved"
#GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="rd.lvm.lv=fedora/root rd.lvm.lv=fedora/swap rhgb quiet"
GRUB_DISABLE_RECOVERY="true"

export GRUB_COLOR_NORMAL="light-gray/black"
export GRUB_COLOR_HIGHLIGHT="yellow/red"
GRUB_BACKGROUND="/boot/grub2/themes/fedora_wall6_fixed.jpg"

( 2016-12-10 03:37:22 -0500 )edit

Gnome 3.22 / Fedora 25 / UEFI Boot / Dell Inspiron 15R 5520 Laptop

Hello,

I have been trying to display a background image in grub2; but nothing I've tried has worked. The image displayed properly in Fedora 24 with Legacy BIOS / MBR. I just recently installed the "Starfield" theme with yumex-dnf and replaced the theme.txt entry "desktop-image: fireworks.png" with "desktop-image: MyImage.png" and the image loaded just fine.

Here is a copy of my /etc/default/grub file:

GRUB_TIMEOUT="5"
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_CMDLINE_LINUX="rd.lvm.lv=fedora/root rd.lvm.lv=fedora/swap rhgb quiet"
GRUB_DEFAULT="saved"
GRUB_DISABLE_RECOVERY="true"
GRUB_TERMINAL_OUTPUT="gfxterm"
GRUB_GFXMODE="640x480"
export GRUB_COLOR_NORMAL="white/black"
export GRUB_COLOR_HIGHLIGHT="magenta/black"
GRUB_BACKGROUND="/boot/grub2/themes/system/nasa-wallpaper2.png"
#GRUB_THEME="/boot/grub2/themes/system/theme.txt"


Here's a copy of the "theme.txt" file with my edit:

#general settings
message-font: "DejaVu Sans Regular 12"
message-color: "#fff"
message-bg-color: "#000"
terminal-box: "terminal_box_*.png"
desktop-image: "nasa-wallpaper2.png" ##### My Edit ##### This is normally "fireworks.png" #####

#help bar at the bottom
+ label {
top = 100%-25
left = 0
width = 100%
height = 20
text = "@KEYMAP_MIDDLE@"
align = "center"
font = "DejaVu Sans Regular 10"
color = "#FFF"
}

left = 22%
width = 56%
top = 20%
height = 35%
item_font = "DejaVu Sans Regular 12"
item_color = "#3c6eb4"
selected_item_font = "DejaVu Sans Bold 14"
selected_item_color= "#fff"
#selected_item_pixmap_style = "blob_*.png"
#icon_height = 25
icon_width = 0
item_height = 30
#item_icon_space = 0
item_spacing = 0
scrollbar = true
scrollbar_width = 20
scrollbar_thumb = "slider_*.png"
}

#progress bar
+ progress_bar {
id = "__timeout__"
left = 15%
top = 80%
height = 20
width = 70%
font = "DejaVu Sans Regular 12"
text_color = "#fff"
fg_color = "#3c6eb4"
bg_color = "black"
border_color = "#fff"
}


Am I doing something wrong or is the code borked?

If the code is borked, can I edit the "theme.txt" fle to display 'MyImage.png" behind the normal grub2 menu?

Thanks

more

NOW THIS LOOKS INTERESTING:

I've had a look inside "/boot/efi/EFI/fedora/grub.cfg" and found two suspicious pieces of code:

if loadfont /EFI/fedora/fonts/unicode.pf2 ; then
set gfxmode=640x480
insmod gfxterm
set locale_dir=\$prefix/locale
set lang=en_US
insmod gettext
fi


**The above is NOT a fully qualified file path. The fully qualified file path from /etc/default/grub is:

/boot/efi/EFI/fedora/fonts/unicode.pf2

**The same situation exists with:

insmod png
background_image -m stretch /grub2/themes/system/nasa-wallpaper2.png

( 2016-12-10 11:44:11 -0500 )edit

Again, the path is not fully qualified. The fully qualified path from /etc/default/grub is:

/boot/grub2/themes/system/nasa-wallpaper2.png

definitely a != b.

However grub.cfg is just a config file. We don't know what the binary is doing unless we get a copy of the source code. The binary may be assuming the missing values and starting its search from /boot/efi in the first case and /boot in the second case. That being said, "I" sure wouldn't code this way... It's kind of looking like the templates in /etc/grub.d may have issues.

( 2016-12-10 11:48:54 -0500 )edit

BTW, I did try manually editing /boot/efi/EFI/fedora/grub.cfg to supply the missing values; and there was an effect. The display went to the maximum resolution; but still wouldn't display the background image. Who knows, there may be other things wrong with the code as well; if indeed what I discovered is a problem.

( 2016-12-10 11:50:48 -0500 )edit

The incomplete file path may be caused by grub2-mkconfig having to update grub.cfg on a different partition, which is the FAT32 EFI partition.

In the following file path /boot/efi/EFI/fedora/grub.cfg the /boot/efi/ folder is a symlink to the FAT32 EFI partition where I believe the /EFI folder is the first folder under root on that partition.

( 2016-12-10 17:20:42 -0500 )edit