# No background image displayed with GRUB2 menu [Solved]

## Fitzcarraldo

I am trying unsuccessfully to get a background picture with my GRUB2 menu at boot. I do get a framebuffer bootsplash and console background during boot, it's just the background picture for the GRUB2 menu which illudes me. I'm using initramfs.

My GPU is an AMD ATI Mobility Radeon HD5650 and this laptop has successfully displayed a GRUB2 background picture when  another distribution was installed previously (also using initramfs).

I'm using the 3.3.5-gentoo kernel and GRUB2 version 1.99-r2:

```
# uname -a

Linux meshedgedx 3.3.5-gentoo #1 SMP Tue May 15 02:12:43 BST 2012 x86_64 Intel(R) Core(TM) i7 CPU Q 720 @ 1.60GHz GenuineIntel GNU/Linux
```

```
# eix -I sys-boot/grub

[I] sys-boot/grub

     Available versions:  

        (0)     *0.92-r1 0.94-r1 0.96-r1 0.96-r2 (~)0.96-r3 (~)0.97 0.97-r2 0.97-r3 0.97-r4 0.97-r5 0.97-r6 (~)0.97-r8 0.97-r9 0.97-r10

        (2)     (**)1.99-r2 **2.00_beta0 **2.00_beta1 **2.00_beta2 **2.00_beta2-r1 **2.00_beta3 **2.00_beta3-r2 **2.00_beta5 **9999

        {{custom-cflags debug device-mapper efiemu grub_platforms_coreboot grub_platforms_efi-32 grub_platforms_efi-64 grub_platforms_emu grub_platforms_ieee1275 grub_platforms_multiboot grub_platforms_pc grub_platforms_qemu grub_platforms_qemu-mips grub_platforms_yeeloong libzfs mount ncurses netboot nls sdl static truetype}}

     Installed versions:  1.99-r2(2)(07:06:49 15/05/12)(nls sdl truetype -custom-cflags -debug -device-mapper -efiemu -grub_platforms_coreboot -grub_platforms_efi-32 -grub_platforms_efi-64 -grub_platforms_emu -grub_platforms_ieee1275 -grub_platforms_multiboot -grub_platforms_pc -grub_platforms_qemu -grub_platforms_qemu-mips -grub_platforms_yeeloong -static)

     Homepage:            http://www.gnu.org/software/grub/

     Description:         GNU GRUB boot loader
```

```
# dmesg | grep vesa

[    1.752168] vesafb: mode is 1024x768x32, linelength=4096, pages=0

[    1.752170] vesafb: scrolling: redraw

[    1.752186] vesafb: Truecolor: size=0:8:8:8, shift=0:16:8:0

[    1.752707] vesafb: framebuffer at 0xc0000000, mapped to 0xffffc90011100000, using 3072k, total 3072k

#
```

The message "Found background: /boot/grub/splash.png" is displayed when I run the command "grub2-mkconfig -o /boot/grub/grub.cfg", and the resulting grub.cfg file is as follows:

```
#

# 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 ###

if [ -s $prefix/grubenv ]; then

  load_env

fi

set default="${saved_entry}"

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 {

true

}

insmod part_msdos

insmod ext2

set root='(hd0,msdos6)'

search --no-floppy --fs-uuid --set=root 9db2f668-a682-4d6f-abc5-ed6f6c515b95

if loadfont /usr/share/grub2/unicode.pf2 ; then

  set gfxmode=1024X768

  load_video

  insmod gfxterm

fi

terminal_output gfxterm

insmod part_msdos

insmod ext2

set root='(hd0,msdos3)'

search --no-floppy --fs-uuid --set=root 597e8c88-8d50-443f-ae19-f510844f5d4e

insmod png

background_image -m stretch /grub/splash.png

if sleep --interruptible 0 ; then

  set timeout=10

fi

### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/10_linux ###

menuentry 'Gentoo GNU/Linux, with Linux x86_64-3.3.5-gentoo' --class gentoo --class gnu-linux --class gnu --class os {

        load_video

        set gfxpayload=1024x768

        insmod gzio

        insmod part_msdos

        insmod ext2

        set root='(hd0,msdos3)'

        search --no-floppy --fs-uuid --set=root 597e8c88-8d50-443f-ae19-f510844f5d4e

        echo    'Loading Linux x86_64-3.3.5-gentoo ...'

        linux   /kernel-genkernel-x86_64-3.3.5-gentoo root=/dev/sda6 ro BOOT_IMAGE=/kernel-genkernel-x86_64-3.3.5-gentoo root=/dev/ram0 ramdisk=8192 real_root=/dev/sda6 init=/linuxrc splash=silent,theme:Emergance console=tty1 quiet resume=swap:/dev/sda5 real_resume=/dev/sda5 intel_iommu=off 

        echo    'Loading initial ramdisk ...'

        initrd  /initramfs-genkernel-x86_64-3.3.5-gentoo

}

menuentry 'Gentoo GNU/Linux, with Linux x86_64-3.3.5-gentoo (recovery mode)' --class gentoo --class gnu-linux --class gnu --class os {

        load_video

        set gfxpayload=1024x768

        insmod gzio

        insmod part_msdos

        insmod ext2

        set root='(hd0,msdos3)'

        search --no-floppy --fs-uuid --set=root 597e8c88-8d50-443f-ae19-f510844f5d4e

        echo    'Loading Linux x86_64-3.3.5-gentoo ...'

        linux   /kernel-genkernel-x86_64-3.3.5-gentoo root=/dev/sda6 ro single BOOT_IMAGE=/kernel-genkernel-x86_64-3.3.5-gentoo root=/dev/ram0 ramdisk=8192 real_root=/dev/sda6 init=/linuxrc splash=silent,theme:Emergance console=tty1 quiet resume=swap:/dev/sda5 real_resume=/dev/sda5 intel_iommu=off

        echo    'Loading initial ramdisk ...'

        initrd  /initramfs-genkernel-x86_64-3.3.5-gentoo

}

### END /etc/grub.d/10_linux ###

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

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

### BEGIN /etc/grub.d/30_os-prober ###

menuentry "Windows 7 (loader) (on /dev/sda1)" --class windows --class os {

        insmod part_msdos

        insmod ntfs

        set root='(hd0,msdos1)'

        search --no-floppy --fs-uuid --set=root A6863E9F863E7043

        chainloader +1

}

menuentry "Windows 7 (loader) (on /dev/sda2)" --class windows --class os {

        insmod part_msdos

        insmod ntfs

        set root='(hd0,msdos2)'

        search --no-floppy --fs-uuid --set=root A2243DA8243D7FF9

        chainloader +1

}

### 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  $prefix/custom.cfg ]; then

  source $prefix/custom.cfg;

fi

### END /etc/grub.d/41_custom ###
```

The PNG image is 1024x768 (24-bit colour depth) and is actually the Gentoo Emergance image. I have also tried another image file that worked as a GRUB2 background image on this machine when it was running a different distribution, and that does not display either, so the problem is not caused by the PNG file itself.

I would be grateful if anyone can spot anything wrong in the above grub.cfg file or can suggest what I should try to get a working GRUB2 background image. Thanks in advance for your help.

----------

## Logicien

Hi,

I use a picture I like as a backgroung image for Grub2. When Grub2 do not want to display the image it is often because the image contain a comment:

```
file /mnt/garde/Images/Ask-about-Free-Software-wlink.jpg

/mnt/garde/Images/Ask-about-Free-Software-wlink.jpg: JPEG image data, JFIF standard 1.01, comment: "Created with The GIMP"
```

I need to remove it:

```
convert -strip /mnt/garde/Images/Ask-about-Free-Software-wlink.jpg /mnt/garde/Images/Ask-about-Free-Software-wlink.jpg
```

Then I can see the change:

```
file /mnt/garde/Images/Ask-about-Free-Software-wlink.jpg

/mnt/garde/Images/Ask-about-Free-Software-wlink.jpg: JPEG image data, JFIF standard 1.01
```

Now I can use it as a background image for Grub2. The resolution is stretch to the size of the screen by default, I think. The native resolution of the screen for the image seem's the best. Typically, 'JPEG image data, JFIF standard 1.01' work. It's the reason why use this format, but I know other formats like png works too. So, check the detail of the format you use.

To display an image, Grub do not take in account what kind of framebuffer and initrd Linux kernel use. Grub have to be installed and configure correctly. On Debian, the image must be in the /boot/grub/ directory to be use when creating /boot/grub/grub.cfg with grub-mkconfig. In ArchLinux, it is configure in /etc/default/grub file. I do not use Grub with Gentoo for the moment. I do not know where to declare the image.

----------

## Fitzcarraldo

Thank you for your reply, Logicien. Wow, that's an obscure cause of GRUB2 not displaying an image! How long did it take you to discover that?! However, it is not the cause of the problem in my case, as neither of the image files I have tried has an embedded comment:

```
# file /boot/grub/splash.png

/boot/grub/splash.png: PNG image data, 1024 x 768, 8-bit/color RGB, non-interlaced

```

And one of the two files is the GRUB2 image file from another distribution, so I think the problem lies elsewhere.

Notice that my /boot/grub/grub.cfg file contains the specified image file:

```
insmod png

background_image -m stretch /grub/splash.png
```

and the path is correct, as my /boot directory is on a separate partition. When I was using another distribution also with /boot on its own partition, the path in grub.cfg was exactly the same as that shown above.

Any other ideas?

----------

## Fitzcarraldo

OK, I got the background image to appear behind the GRUB2 menu. I found out what is missing from /boot/grub/grub.cfg:

```
insmod vbe
```

and I found that it needs to be in a specific position in my grub.cfg file (see below):

```
#

# 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 ###

if [ -s $prefix/grubenv ]; then

  load_env

fi

set default="${saved_entry}"

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 {

true

}

### NEED THIS TO GET IMAGE BEHIND GRUB2 MENU ###

insmod vbe

################################################

insmod part_msdos

insmod ext2

set root='(hd0,msdos6)'

search --no-floppy --fs-uuid --set=root 9db2f668-a682-4d6f-abc5-ed6f6c515b95

if loadfont /usr/share/grub2/unicode.pf2 ; then

  set gfxmode=1024x768

  load_video

  insmod gfxterm

fi

terminal_output gfxterm

insmod part_msdos

insmod ext2

set root='(hd0,msdos3)'

search --no-floppy --fs-uuid --set=root 597e8c88-8d50-443f-ae19-f510844f5d4e

insmod png

background_image -m stretch /grub/splash.png

if sleep --interruptible 0 ; then

  set timeout=10

fi

### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/10_linux ###

menuentry 'Gentoo GNU/Linux, with Linux x86_64-3.3.5-gentoo' --class gentoo --class gnu-linux --class gnu --class os {

        load_video

        set gfxpayload=1024x768

        insmod gzio

        insmod part_msdos

        insmod ext2

        set root='(hd0,msdos3)'

        search --no-floppy --fs-uuid --set=root 597e8c88-8d50-443f-ae19-f510844f5d4e

        echo    'Loading Linux x86_64-3.3.5-gentoo ...'

        linux   /kernel-genkernel-x86_64-3.3.5-gentoo root=/dev/sda6 ro BOOT_IMAGE=/kernel-genkernel-x86_64-3.3.5-gentoo root=/dev/ram0 ramdisk=8192 real_root=/dev/sda6 init=/linuxrc splash=silent,theme:Emergance console=tty1 quiet resume=swap:/dev/sda5 real_resume=/dev/sda5 intel_iommu=off 

        echo    'Loading initial ramdisk ...'

        initrd  /initramfs-genkernel-x86_64-3.3.5-gentoo

}

menuentry 'Gentoo GNU/Linux, with Linux x86_64-3.3.5-gentoo (recovery mode)' --class gentoo --class gnu-linux --class gnu --class os {

        load_video

        set gfxpayload=1024x768

        insmod gzio

        insmod part_msdos

        insmod ext2

        set root='(hd0,msdos3)'

        search --no-floppy --fs-uuid --set=root 597e8c88-8d50-443f-ae19-f510844f5d4e

        echo    'Loading Linux x86_64-3.3.5-gentoo ...'

        linux   /kernel-genkernel-x86_64-3.3.5-gentoo root=/dev/sda6 ro single BOOT_IMAGE=/kernel-genkernel-x86_64-3.3.5-gentoo root=/dev/ram0 ramdisk=8192 real_root=/dev/sda6 init=/linuxrc splash=silent,theme:Emergance console=tty1 quiet resume=swap:/dev/sda5 real_resume=/dev/sda5 intel_iommu=off

        echo    'Loading initial ramdisk ...'

        initrd  /initramfs-genkernel-x86_64-3.3.5-gentoo

}

### END /etc/grub.d/10_linux ###

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

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

### BEGIN /etc/grub.d/30_os-prober ###

menuentry "Windows 7 (loader) (on /dev/sda1)" --class windows --class os {

        insmod part_msdos

        insmod ntfs

        set root='(hd0,msdos1)'

        search --no-floppy --fs-uuid --set=root A6863E9F863E7043

        chainloader +1

}

menuentry "Windows 7 (loader) (on /dev/sda2)" --class windows --class os {

        insmod part_msdos

        insmod ntfs

        set root='(hd0,msdos2)'

        search --no-floppy --fs-uuid --set=root A2243DA8243D7FF9

        chainloader +1

}

### 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  $prefix/custom.cfg ]; then

  source $prefix/custom.cfg;

fi

### END /etc/grub.d/41_custom ###
```

So my next question is, how do I get "insmod vbe" to be inserted (and in the correct position) in my grub.cfg file when I run grub2-mkconfig? Yesterday I added "GRUB_VIDEO_BACKEND=vbe" to my /etc/default/grub file and re-ran "grub2-mkconfig -o /boot/grub/grub.cfg" but it didn't insert "insmod vbe" in the position in grub.cfg where I added it manually today, and no background image was displayed when I rebooted. So I removed "GRUB_VIDEO_BACKEND=vbe" from /etc/default/grub.

I suppose I now need to investigate how to edit /etc/default/grub to get "insmod vbe" inserted in /boot/grub/grub.cfg in the position shown above. What a pain this stuff is!

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

EDIT: OK, found out what to do with "GRUB_VIDEO_BACKEND=vbe". Below is my latest version of /etc/default/grub and the resulting /boot/grub/grub.cfg after I run grub2-mkconfig. I can mark this thread 'Solved' now.

/etc/default/grub

```
# Copyright 1999-2012 Gentoo Foundation

# Distributed under the terms of the GNU General Public License v2

# $Header: /var/cvsroot/gentoo-x86/sys-boot/grub/files/grub.default,v 1.3 2012/02/29 01:52:23 floppym Exp $

#

# To populate all changes in this file you need to regenerate your

# grub configuration file afterwards:

#     'grub2-mkconfig -o /boot/grub2/grub.cfg'

#

# See the grub info page for documentation on possible variables and

# their associated values. 

GRUB_DISTRIBUTOR="Gentoo"

GRUB_DEFAULT=saved

GRUB_HIDDEN_TIMEOUT=0

GRUB_HIDDEN_TIMEOUT_QUIET=true

GRUB_TIMEOUT=10

GRUB_CMDLINE_LINUX_DEFAULT=""

GRUB_CMDLINE_LINUX=""

# Uncomment to disable graphical terminal (grub-pc only)

#GRUB_TERMINAL=console

# The resolution used on graphical terminal.

# Note that you can use only modes which your graphic card supports via VBE.

# You can see them in real GRUB with the command `vbeinfo'.

GRUB_VIDEO_BACKEND=vbe

GRUB_GFXMODE=1024x768

GRUB_GFXPAYLOAD_LINUX=1024x768

# Background image used on graphical terminal.

# Can be in various bitmap formats.

GRUB_BACKGROUND="/boot/grub/splash.png"

GRUB_COLOR_NORMAL="white/black"

GRUB_COLOR_HIGHLIGHT="magenta/black"

# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to kernel

GRUB_DISABLE_LINUX_UUID=true

# Uncomment to disable generation of recovery mode menu entries

#GRUB_DISABLE_RECOVERY=true

# The code below was added by me (I got the idea from Sabayon Linux) so that I

# can leave GRUB_CMDLINE_LINUX empty when I re-run the grub2-mkconfig command.

# DO NOT REMOVE THIS IF YOUR GRUB_CMDLINE_LINUX IS EMPTY (BACKWARD COMPAT)

if [ -z "${GRUB_CMDLINE_LINUX}" ]; then

        if [ ! -e "/proc/cmdline" ]; then

                echo "ATTENTION ATTENTION ATTENTION" >&2

                echo "GRUB_CMDLINE_LINUX is not set inside /etc/default/grub" >&2

                echo "  cannot generate a bootable configuration." >&2

        else

                echo "ATTENTION ATTENTION ATTENTION" >&2

                echo "GRUB_CMDLINE_LINUX is not set inside /etc/default/grub" >&2

                echo "  grub is going to use your /proc/cmdline content" >&2

                GRUB_CMDLINE_LINUX="`cat /proc/cmdline | sed -e 's#BOOT_IMAGE=.* ro ##g'`"

        fi

fi
```

/boot/grub/grub.cfg (/boot in its own partition)

```
#

# 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 ###

if [ -s $prefix/grubenv ]; then

  load_env

fi

set default="${saved_entry}"

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 {

  insmod vbe

}

insmod part_msdos

insmod ext2

set root='(hd0,msdos6)'

search --no-floppy --fs-uuid --set=root 9db2f668-a682-4d6f-abc5-ed6f6c515b95

if loadfont /usr/share/grub2/unicode.pf2 ; then

  set gfxmode=1024x768

  load_video

  insmod gfxterm

fi

terminal_output gfxterm

insmod part_msdos

insmod ext2

set root='(hd0,msdos3)'

search --no-floppy --fs-uuid --set=root 597e8c88-8d50-443f-ae19-f510844f5d4e

insmod png

background_image -m stretch /grub/splash.png

if sleep --interruptible 0 ; then

  set timeout=10

fi

### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/10_linux ###

menuentry 'Gentoo GNU/Linux, with Linux x86_64-3.3.5-gentoo' --class gentoo --class gnu-linux --class gnu --class os {

        load_video

        set gfxpayload=1024x768

        insmod gzio

        insmod part_msdos

        insmod ext2

        set root='(hd0,msdos3)'

        search --no-floppy --fs-uuid --set=root 597e8c88-8d50-443f-ae19-f510844f5d4e

        echo    'Loading Linux x86_64-3.3.5-gentoo ...'

        linux   /kernel-genkernel-x86_64-3.3.5-gentoo root=/dev/sda6 ro BOOT_IMAGE=/kernel-genkernel-x86_64-3.3.5-gentoo root=/dev/ram0 ramdisk=8192 real_root=/dev/sda6 init=/linuxrc splash=silent,theme:Emergance console=tty1 quiet resume=swap:/dev/sda5 real_resume=/dev/sda5 intel_iommu=off 

        echo    'Loading initial ramdisk ...'

        initrd  /initramfs-genkernel-x86_64-3.3.5-gentoo

}

menuentry 'Gentoo GNU/Linux, with Linux x86_64-3.3.5-gentoo (recovery mode)' --class gentoo --class gnu-linux --class gnu --class os {

        load_video

        set gfxpayload=1024x768

        insmod gzio

        insmod part_msdos

        insmod ext2

        set root='(hd0,msdos3)'

        search --no-floppy --fs-uuid --set=root 597e8c88-8d50-443f-ae19-f510844f5d4e

        echo    'Loading Linux x86_64-3.3.5-gentoo ...'

        linux   /kernel-genkernel-x86_64-3.3.5-gentoo root=/dev/sda6 ro single BOOT_IMAGE=/kernel-genkernel-x86_64-3.3.5-gentoo root=/dev/ram0 ramdisk=8192 real_root=/dev/sda6 init=/linuxrc splash=silent,theme:Emergance console=tty1 quiet resume=swap:/dev/sda5 real_resume=/dev/sda5 intel_iommu=off

        echo    'Loading initial ramdisk ...'

        initrd  /initramfs-genkernel-x86_64-3.3.5-gentoo

}

### END /etc/grub.d/10_linux ###

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

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

### BEGIN /etc/grub.d/30_os-prober ###

menuentry "Windows 7 (loader) (on /dev/sda1)" --class windows --class os {

        insmod part_msdos

        insmod ntfs

        set root='(hd0,msdos1)'

        search --no-floppy --fs-uuid --set=root A6863E9F863E7043

        chainloader +1

}

menuentry "Windows 7 (loader) (on /dev/sda2)" --class windows --class os {

        insmod part_msdos

        insmod ntfs

        set root='(hd0,msdos2)'

        search --no-floppy --fs-uuid --set=root A2243DA8243D7FF9

        chainloader +1

}

### 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  $prefix/custom.cfg ]; then

  source $prefix/custom.cfg;

fi

### END /etc/grub.d/41_custom ###
```

Hope this helps others with the same problem avoid spending the time it took me to get this to work.

----------

