# grub2 error: can't find command 'background_image'.

So, I have been trying to add a background image to the grub2 bootloader and been having no luck. I am running Fedora 27 and using UEFI boot. I did notice when booting grub flashes an error very quickly, and by manually editing grub.cfg and adding a sleep command at the the end, I was able to to determine that the error was:error: can't find command 'background_image'. I have included my /etc/default/grub and the /boot/efi/EFI/fedora/grub.cfg that is generated by grub2-mkconfig below if those are any help, but I think the problem is due to the missing command error. I just don't know how to solve this. Any help is greatly appreciated.

My /etc/default/grub:


GRUB_TIMEOUT=60
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_TERMINAL_OUTPUT="gfxterm"
GRUB_CMDLINE_LINUX="rd.driver.blacklist=nouveau modprobe.blacklist=nouveau nvid$GRUB_DISABLE_RECOVERY="true" GRUB_TERMINAL=gfxterm export GRUB_COLOR_NORMAL="white/black" export GRUB_COLOR_HIGHLIGHT="yellow/red" GRUB_BACKGROUND="/boot/efi/EFI/fedora/tardis_inside.png" GRUB_GFXMODE=auto  and my /boot/efi/EFI/fedora/grub.cfg:  # # DO NOT EDIT THIS FILE # # It is automatically generated by grub2-mkconfig using templates # from /etc/grub.d and settings from /etc/default/grub # ### BEGIN /etc/grub.d/00_header ### set pager=1 if [ -f${config_directory}/grubenv ]; then
load_env -f ${config_directory}/grubenv elif [ -s$prefix/grubenv ]; then
fi
if [ "${next_entry}" ] ; then set default="${next_entry}"
set next_entry=
save_env next_entry
set boot_once=true
else
set default="${saved_entry}" fi if [ x"${feature_menuentry_id}" = xy ]; then
else
fi

if [ "${prev_saved_entry}" ]; then set saved_entry="${prev_saved_entry}"
save_env saved_entry
set prev_saved_entry=
save_env prev_saved_entry
set boot_once=true
fi

function savedefault {
if [ -z "${boot_once}" ]; then saved_entry="${chosen}"
save_env saved_entry
fi
}

if [ x$feature_all_video_module = xy ]; then insmod all_video else insmod efi_gop insmod efi_uga insmod ieee1275_fb insmod vbe insmod vga insmod video_bochs insmod video_cirrus fi } if [ x$feature_default_font_path = xy ] ; then
font=unicode
else
insmod part_gpt
insmod ext2
if [ x$feature_platform_search_hint = xy ]; then search --no-floppy --fs-uuid --set=root c71e3b1d-4bb4-483b-8c33-616a59502613 else search --no-floppy --fs-uuid --set=root c71e3b1d-4bb4-483b-8c33-616a59502613 fi font="/usr/share/grub/unicode.pf2" fi if loadfont$font ; then
set gfxmode=auto
insmod gfxterm
set locale_dir=$prefix/locale set lang=en_US insmod gettext fi terminal_input gfxterm terminal_output gfxterm insmod part_gpt insmod fat if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root  AE0C-F05B
else
search --no-floppy --fs-uuid --set=root AE0C-F05B
fi
insmod png
background_image -m stretch /EFI/fedora/tardis_inside.png
if [ x$feature_timeout_style = xy ] ; then set timeout_style=menu set timeout=60 # Fallback normal timeout code in case the timeout_style feature is # unavailable. else set timeout=60 fi ### END /etc/grub.d/00_header ### ### BEGIN /etc/grub.d/01_users ### if [ -f${prefix}/user.cfg ]; then
source ${prefix}/user.cfg if [ -n "${GRUB2_PASSWORD}" ]; then
set superusers="root"
export superusers
password_pbkdf2 root ${GRUB2_PASSWORD} fi fi ### END /etc/grub.d/01_users ### ### BEGIN /etc/grub.d/10_linux ### menuentry 'Fedora' --class fedora --class gnu-linux --class gnu --class os --unrestricted$menuentry_id_option 'gnulinux-simple-c71e3b1d-4bb4-483b-8c33-616a59502613' {
insmod gzio
insmod part_gpt
insmod ext2
if [ x\$feature_platform_search_hint = xy ...
edit retag close merge delete

Sort by » oldest newest most voted

Try putting the background image in /boot/grub2/themes. This is where my background image is and it works flawlessly. Rerun grub2-mkconfig.

I also use GRUB_GFXMODE="800x600". Seems to make a difference.

more

Thanks for the quick response. Unfortunately, after making these changes, nothing changed. Same error message, still no background.

( 2017-12-03 02:22:03 -0500 )edit

So not really an answer, but I found a work around. By applying a theme to grub I am able to change the background in the theme.txt and it works. Still don't know why I was getting the error when trying to just set the background image, and I am still somewhat curious, but at least it is working now. Thanks for your help Glenn.

more