Bug 760686

Summary: change grub2 background color
Product: [Fedora] Fedora Reporter: hhlp <hhlouzao>
Component: grub2Assignee: Peter Jones <pjones>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: unspecified    
Version: 16CC: dennis, mads, pjones
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-04-16 22:42:37 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description hhlp 2011-12-06 19:10:00 UTC
Description of problem:

you can change background color in grub2

Version-Release number of selected component (if applicable):

grub2-1.99-12.fc16.x86_64

How reproducible:

yes always

Steps to Reproduce:

1. Edit /etc/default/grub and include this line:

2. GRUB_COLOR_NORMAL="light-blue/black"
   GRUB_COLOR_HIGHLIGHT="light-cyan/blue"

3. sudo grub2-mkconfig -o /boot/grub2/grub.cfg

4. reboot

Actual results:

always the same colour

Expected results:

permit to change default colours...

Additional info:

here is my grub configuration file 

GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null`
GRUB_DEFAULT=0
GRUB_CMDLINE_LINUX="rd.md=0 rd.lvm=0 rd.dm=0 quiet SYSFONT=latarcyrheb-sun16 rhgb rd.luks=0 LANG=es_ES.UTF-8  KEYTABLE=es"
GRUB_GFXMODE=1280x960x16
GRUB_GFXPAYLOAD_LINUX=keep
GRUB_BACKGROUND=/boot/grub2/wallpaper.png

also i can see anything related in 00_headers to change this behaviour 

related question :

http://ask.fedoraproject.org/question/583/grub2-color

Comment 1 hhlp 2011-12-07 02:14:27 UTC
as you can see in the answer there is a workaround but it isn't optimal...

I think there is two option:

1.- the first one ...

Edit /etc/default/grub and include this 2 line with its variables GRUB :

GRUB_COLOR_NORMAL="light-blue/black"
GRUB_COLOR_HIGHLIGHT="light-cyan/blue"

in any part of 00_headers files for example here after that : 

make_timeout ()
{
    if [ "x${1}" != "x" ] ; then
	if [ "x${GRUB_HIDDEN_TIMEOUT_QUIET}" = "xtrue" ] ; then
	    verbose=
	else
	    verbose=" --verbose"
	fi
	cat << EOF
if sleep$verbose --interruptible ${1} ; then
  set timeout=${2}
fi
EOF
    else
	cat << EOF
set timeout=${2}
EOF
    fi
}

set color_normal=${GRUB_COLOR_NORMAL}
set color_highlight=${GRUB_COLOR_HIGHLIGHT}

2.- isn't optimal but work modify the file 41_custom and permit access to grub variables:

set color_normal=${GRUB_COLOR_NORMAL}
set color_highlight=${GRUB_COLOR_HIGHLIGHT}

I think this option isn't well enough because this file isn't for this function....

I attach my /boot/grub2/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 ###
if [ -s $prefix/grubenv ]; then
  load_env
fi
set default="0"
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 vga
  insmod video_bochs
  insmod video_cirrus
}

insmod part_msdos
insmod ext2
set root='(hd0,msdos1)'
search --no-floppy --fs-uuid --set=root cb1f1dc3-a149-4a4e-93ba-034afef0f7b4
if loadfont /boot/grub2/unicode.pf2 ; then
  set gfxmode=1280x960x16
  load_video
  insmod gfxterm
fi
terminal_output gfxterm
insmod part_msdos
insmod ext2
set root='(hd0,msdos1)'
search --no-floppy --fs-uuid --set=root cb1f1dc3-a149-4a4e-93ba-034afef0f7b4
insmod png
background_image -m stretch /boot/grub2/wallpaper.png
set timeout=5
set color_normal=white/black           <-------------------------- see   
set color_highlight=light-cyan/black   <-------------------------- see
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/10_linux ###
menuentry 'Fedora Linux, with Linux 3.1.2-1.fc16.x86_64' --class fedora --class gnu-linux --class gnu --class os {
	load_video
	set gfxpayload=keep
	insmod gzio
	insmod part_msdos
	insmod ext2
	set root='(hd0,msdos1)'
	search --no-floppy --fs-uuid --set=root cb1f1dc3-a149-4a4e-93ba-034afef0f7b4
	echo	'Loading Linux 3.1.2-1.fc16.x86_64 ...'
	linux	/boot/vmlinuz-3.1.2-1.fc16.x86_64 root=UUID=cb1f1dc3-a149-4a4e-93ba-034afef0f7b4 ro rd.md=0 rd.lvm=0 rd.dm=0 quiet SYSFONT=latarcyrheb-sun16 rhgb rd.luks=0 LANG=es_ES.UTF-8  KEYTABLE=es 
	echo	'Loading initial ramdisk ...'
	initrd	/boot/initramfs-3.1.2-1.fc16.x86_64.img
}
menuentry 'Fedora Linux, with Linux 3.1.2-1.fc16.x86_64 (recovery mode)' --class fedora --class gnu-linux --class gnu --class os {
	load_video
	set gfxpayload=keep
	insmod gzio
	insmod part_msdos
	insmod ext2
	set root='(hd0,msdos1)'
	search --no-floppy --fs-uuid --set=root cb1f1dc3-a149-4a4e-93ba-034afef0f7b4
	echo	'Loading Linux 3.1.2-1.fc16.x86_64 ...'
	linux	/boot/vmlinuz-3.1.2-1.fc16.x86_64 root=UUID=cb1f1dc3-a149-4a4e-93ba-034afef0f7b4 ro single rd.md=0 rd.lvm=0 rd.dm=0 quiet SYSFONT=latarcyrheb-sun16 rhgb rd.luks=0 LANG=es_ES.UTF-8  KEYTABLE=es
	echo	'Loading initial ramdisk ...'
	initrd	/boot/initramfs-3.1.2-1.fc16.x86_64.img
}
menuentry 'Fedora Linux, with Linux 3.1.1-2.fc16.x86_64' --class fedora --class gnu-linux --class gnu --class os {
	load_video
	set gfxpayload=keep
	insmod gzio
	insmod part_msdos
	insmod ext2
	set root='(hd0,msdos1)'
	search --no-floppy --fs-uuid --set=root cb1f1dc3-a149-4a4e-93ba-034afef0f7b4
	echo	'Loading Linux 3.1.1-2.fc16.x86_64 ...'
	linux	/boot/vmlinuz-3.1.1-2.fc16.x86_64 root=UUID=cb1f1dc3-a149-4a4e-93ba-034afef0f7b4 ro rd.md=0 rd.lvm=0 rd.dm=0 quiet SYSFONT=latarcyrheb-sun16 rhgb rd.luks=0 LANG=es_ES.UTF-8  KEYTABLE=es 
	echo	'Loading initial ramdisk ...'
	initrd	/boot/initramfs-3.1.1-2.fc16.x86_64.img
}
menuentry 'Fedora Linux, with Linux 3.1.1-2.fc16.x86_64 (recovery mode)' --class fedora --class gnu-linux --class gnu --class os {
	load_video
	set gfxpayload=keep
	insmod gzio
	insmod part_msdos
	insmod ext2
	set root='(hd0,msdos1)'
	search --no-floppy --fs-uuid --set=root cb1f1dc3-a149-4a4e-93ba-034afef0f7b4
	echo	'Loading Linux 3.1.1-2.fc16.x86_64 ...'
	linux	/boot/vmlinuz-3.1.1-2.fc16.x86_64 root=UUID=cb1f1dc3-a149-4a4e-93ba-034afef0f7b4 ro single rd.md=0 rd.lvm=0 rd.dm=0 quiet SYSFONT=latarcyrheb-sun16 rhgb rd.luks=0 LANG=es_ES.UTF-8  KEYTABLE=es
	echo	'Loading initial ramdisk ...'
	initrd	/boot/initramfs-3.1.1-2.fc16.x86_64.img
}
### 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 ###
### 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 ###

### BEGIN /etc/grub.d/90_persistent ###
### END /etc/grub.d/90_persistent ###

I could make the patch but i don't know why the follow variables aren't availables or I'm missing something :

GRUB_COLOR_NORMAL
GRUB_COLOR_HIGHLIGHT

P.S : i modify /boot/grub2/grub.cfg manualy to probe that this option will work well....

Comment 2 Mads Kiilerich 2011-12-08 19:47:08 UTC
grub2 do not have any support for specifying the colors directly in /etc/default/grub . There is no indication that GRUB_COLOR_NORMAL and GRUB_COLOR_HIGHLIGHT should work.

The right way to set the color is to create a theme and specify GRUB_THEME in /etc/default/grub.