Has anyone managed to navigate the maze of GRUB2 scripts well enough to help with this?
In Karmic, I am able to set the grub menu resolution, and get a background image. Works fine. Exactly the same scripts fail to give me anything above the default resolution, and no background image. One alternative is to just manually make a grub.cfg, but I would like to get it sorted out.
Here is what the header for grub.cfg in Karmic looks like (the one that works right):
And here is the same part of the file in Lucid, that doesn't work:
There is quite a bit of stuff missing from the 00_header and 05_debian_theme parts, namely everything that specifies what the menu should look like. There are a bunch of "tests" throughout the 00 and 05 scripts, one or more of which is failing, and therefore not giving me the menu I am trying to get.
It would appear that this is the part of 00_header that is failing:
the third "case" is the part that needs to succeed to write the proper header. Any ideas how I can force it to do so?
And the 05_debian_theme:
OK, this is a bash script, and the whole part about setting WALLPAPER, COLOR_NROMAL and COLOR_HIGHLIGHT is failing. Maybe something about this doesn't like my system? Tough, any ideas how I can force the scripts to succeed?
Thanks, I know this is probably a bash scripting issue, any help would be instructive.
In Karmic, I am able to set the grub menu resolution, and get a background image. Works fine. Exactly the same scripts fail to give me anything above the default resolution, and no background image. One alternative is to just manually make a grub.cfg, but I would like to get it sorted out.
Here is what the header for grub.cfg in Karmic looks like (the one that works right):
Code:
### BEGIN /etc/grub.d/00_header ###
if [ -s /boot/grub/grubenv ]; then
have_grubenv=true
load_env
fi
set default="0"
if [ ${prev_saved_entry} ]; then
saved_entry=${prev_saved_entry}
save_env saved_entry
prev_saved_entry=
save_env prev_saved_entry
fi
insmod ext2
set root=(hd1,2)
search --no-floppy --fs-uuid --set a09aa7df-f040-4186-9bd6-6c99f1ed0208
if loadfont /usr/share/grub/unicode.pf2 ; then
set gfxmode=1024x768x16
# set gfxpayload=
insmod gfxterm
insmod vbe
if terminal_output gfxterm ; then true ; else
# For backward compatibility with versions of terminal.mod that don't
# understand terminal_output
terminal gfxterm
fi
fi
if [ ${recordfail} = 1 ]; then
set timeout=-1
else
set timeout=10
fi
### END /etc/grub.d/00_header ###
### BEGIN /etc/grub.d/05_debian_theme ###
insmod ext2
set root=(hd1,2)
search --no-floppy --fs-uuid --set a09aa7df-f040-4186-9bd6-6c99f1ed0208
insmod tga
if background_image /boot/grub/alienware.tga ; then
set color_normal=green/black
set color_highlight=light-red/black
else
set menu_color_normal=green/black
set menu_color_highlight=light-red/black
fi
### END /etc/grub.d/05_debian_theme ###
Code:
### 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 recordfail {
set recordfail=1
if [ -n ${have_grubenv} ]; then if [ -z ${boot_once} ]; then save_env recordfail; fi; fi
}
if [ ${recordfail} = 1 ]; then
set timeout=-1
else
set timeout=10
fi
### END /etc/grub.d/00_header ###
### BEGIN /etc/grub.d/05_debian_theme ###
set menu_color_normal=green/black
set menu_color_highlight=light-red/black
### END /etc/grub.d/05_debian_theme ###
It would appear that this is the part of 00_header that is failing:
Code:
case ${GRUB_TERMINAL_INPUT}:${GRUB_TERMINAL_OUTPUT} in
serial:* | *:serial)
if ! test -e ${grub_prefix}/serial.mod ; then
echo "Serial terminal not available on this platform." >&2 ; exit 1
fi
if [ "x${GRUB_SERIAL_COMMAND}" = "x" ] ; then
grub_warn "Requested serial terminal but GRUB_SERIAL_COMMAND is unspecified. Default parameters will be used."
GRUB_SERIAL_COMMAND=serial
fi
echo "${GRUB_SERIAL_COMMAND}"
;;
esac
case x${GRUB_TERMINAL_INPUT} in
x)
# Just use the native terminal
;;
x*)
cat << EOF
if terminal_input ${GRUB_TERMINAL_INPUT} ; then true ; else
# For backward compatibility with versions of terminal.mod that don't
# understand terminal_input
terminal ${GRUB_TERMINAL_INPUT}
fi
EOF
;;
esac
case x${GRUB_TERMINAL_OUTPUT} in
xgfxterm)
# Make the font accessible
prepare_grub_to_access_device `${grub_probe} --target=device ${GRUB_FONT_PATH}`
cat << EOF
if loadfont `make_system_path_relative_to_its_root ${GRUB_FONT_PATH}` ; then
set gfxmode=${GRUB_GFXMODE}
set gfxpayload=${GRUB_GFXPAYLOAD}
insmod gfxterm
insmod ${GRUB_VIDEO_BACKEND}
if terminal_output gfxterm ; then true ; else
# For backward compatibility with versions of terminal.mod that don't
# understand terminal_output
terminal gfxterm
fi
fi
EOF
;;
x)
# Just use the native terminal
;;
x*)
cat << EOF
if terminal_output ${GRUB_TERMINAL_OUTPUT} ; then true ; else
# For backward compatibility with versions of terminal.mod that don't
# understand terminal_output
terminal ${GRUB_TERMINAL_OUTPUT}
fi
EOF
;;
esac
And the 05_debian_theme:
Code:
#!/bin/bash -e
source /usr/lib/grub/grub-mkconfig_lib
# this allows desktop-base to override our settings
f=/usr/share/desktop-base/grub_background.sh
if test -e ${f} ; then
source ${f}
else
WALLPAPER="/boot/grub/alienware.tga"
COLOR_NORMAL="green/black"
COLOR_HIGHLIGHT="light-red/black"
fi
set_mono_theme()
{
cat << EOF
set menu_color_normal=green/black
set menu_color_highlight=light-red/black
EOF
}
# check for usable backgrounds
use_bg=false
if [ "$GRUB_TERMINAL_OUTPUT" = "gfxterm" ] ; then
for i in /boot/grub/`basename ${WALLPAPER}` ${WALLPAPER} ; do
if is_path_readable_by_grub $i ; then
bg=$i
case ${bg} in
*.png) reader=png ;;
*.tga) reader=tga ;;
*.jpg|*.jpeg) reader=jpeg ;;
esac
if test -e /boot/grub/${reader}.mod ; then
echo "Found background image: `basename ${bg}`" >&2
use_bg=true
break
fi
fi
done
fi
# set the background if possible
if ${use_bg} ; then
prepare_grub_to_access_device `${grub_probe} --target=device ${bg}`
cat << EOF
insmod ${reader}
if background_image `make_system_path_relative_to_its_root ${bg}` ; then
set color_normal=${COLOR_NORMAL}
set color_highlight=${COLOR_HIGHLIGHT}
else
EOF
fi
# otherwise, set a monochromatic theme for Ubuntu
if ${use_bg} ; then
set_mono_theme | sed -e "s/^/ /g"
echo "fi"
else
set_mono_theme
fi
Thanks, I know this is probably a bash scripting issue, any help would be instructive.

Comment