Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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_DISABLE_SUBMENU=false
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
  load_env
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
  menuentry_id_option="--id"
else
  menuentry_id_option=""
fi

export menuentry_id_option

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
}

function load_video {
  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
  load_video
  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' {
    load_video
    set gfxpayload=keep
    insmod gzio
    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
    linuxefi /boot/vmlinuz-4.13.16-300.fc27.x86_64 root=UUID=c71e3b1d-4bb4-483b-8c33-616a59502613 ro rd.driver.blacklist=nouveau modprobe.blacklist=nouveau nvidia-drm.modeset=1 rhgb quiet 
    initrdefi /boot/initramfs-4.13.16-300.fc27.x86_64.img
}
submenu 'Advanced options for Fedora' $menuentry_id_option 'gnulinux-advanced-c71e3b1d-4bb4-483b-8c33-616a59502613' {
    menuentry 'Fedora (4.13.16-300.fc27.x86_64) 27 (Workstation Edition)' --class fedora --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-4.13.16-300.fc27.x86_64-advanced-c71e3b1d-4bb4-483b-8c33-616a59502613' {
        load_video
        set gfxpayload=keep
        insmod gzio
        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
        linuxefi /boot/vmlinuz-4.13.16-300.fc27.x86_64 root=UUID=c71e3b1d-4bb4-483b-8c33-616a59502613 ro rd.driver.blacklist=nouveau modprobe.blacklist=nouveau nvidia-drm.modeset=1 rhgb quiet 
        initrdefi /boot/initramfs-4.13.16-300.fc27.x86_64.img
    }
    menuentry 'Fedora (4.13.9-300.fc27.x86_64) 27 (Workstation Edition)' --class fedora --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-4.13.9-300.fc27.x86_64-advanced-c71e3b1d-4bb4-483b-8c33-616a59502613' {
        load_video
        set gfxpayload=keep
        insmod gzio
        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
        linuxefi /boot/vmlinuz-4.13.9-300.fc27.x86_64 root=UUID=c71e3b1d-4bb4-483b-8c33-616a59502613 ro rd.driver.blacklist=nouveau modprobe.blacklist=nouveau nvidia-drm.modeset=1 rhgb quiet 
        initrdefi /boot/initramfs-4.13.9-300.fc27.x86_64.img
    }
    menuentry 'Fedora (0-rescue-c1cb0a03efa04a1ca72ba302998daa94) 27 (Workstation Edition)' --class fedora --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-0-rescue-c1cb0a03efa04a1ca72ba302998daa94-advanced-c71e3b1d-4bb4-483b-8c33-616a59502613' {
        load_video
        insmod gzio
        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
        linuxefi /boot/vmlinuz-0-rescue-c1cb0a03efa04a1ca72ba302998daa94 root=UUID=c71e3b1d-4bb4-483b-8c33-616a59502613 ro rd.driver.blacklist=nouveau modprobe.blacklist=nouveau nvidia-drm.modeset=1 rhgb quiet 
        initrdefi /boot/initramfs-0-rescue-c1cb0a03efa04a1ca72ba302998daa94.img
    }
}
if [ "x$default" = 'Fedora (4.13.16-300.fc27.x86_64) 27 (Workstation Edition)' ]; then default='Advanced options for Fedora>Fedora (4.13.16-300.fc27.x86_64) 27 (Workstation Edition)'; fi;
### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_linux_xen ###

### END /etc/grub.d/20_linux_xen ###

### BEGIN /etc/grub.d/20_ppc_terminfo ###
### END /etc/grub.d/20_ppc_terminfo ###

### BEGIN /etc/grub.d/30_os-prober ###
menuentry 'Windows Boot Manager (on /dev/nvme0n1p1)' --class windows --class os $menuentry_id_option 'osprober-efi-AE0C-F05B' {
    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
    chainloader /EFI/Microsoft/Boot/bootmgfw.efi
}
### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.
### END /etc/grub.d/40_custom ###

### BEGIN /etc/grub.d/41_custom ###
if [ -f  ${config_directory}/custom.cfg ]; then
  source ${config_directory}/custom.cfg
elif [ -z "${config_directory}" -a -f  $prefix/custom.cfg ]; then
  source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###