Mailinglist Archive: opensuse-support (80 mails)

< Previous Next >
Re: [opensuse-support] give TW Grub-EFI menu blue background instead of black?
Andrei Borzenkov composed on 2018-10-06 08:14 (UTC+0300):

Felix Miata composed:

This is what I had:
http://fm.no-ip.com/SS/Suse/gmenu-TWsmall.jpg (menu uses <1/2 the screen)
when I filed
https://bugzilla.opensuse.org/show_bug.cgi?id=1101747

This is what I have now, which eventually resulted from removing grub*
packages
and config files, then reinstalling:
http://fm.no-ip.com/SS/Suse/gmenu-TWbig.jpg (menu uses most of screen)

This is what I'm trying to achieve (blue background, like Debian produces):
http://fm.no-ip.com/SS/Suse/gmenu-Deb.jpg

I tried YaST2, but it doesn't seem to have any way to affect menu colors (or
font size or overall menu size).
<https://doc.opensuse.org/documentation/leap/reference/html/book.opensuse.reference/cha.grub2.html>
didn't help.

Debian has a file /etc/grub.d/05_debian_theme which undoubtedly accounts for
its
boot menu colors. I tried including it in my TW /etc/grub.d/, but it didn't
have
any desired effect, likely at least in part because of its many references to
*grub/* where openSUSE has *grub2/*.

You expect us to hunt for this file to understand what you did?
...

appended/attached(?) the one from Butch
Quite different:
https://raw.githubusercontent.com/huslage/qfi-box-config/master/etc/grub.d/05_debian_theme

I didn't save any changes I tried.

Anyone know how to make my openSUSE TW Grub menu colors match Debian's, or
where
docs are that might explain?

As you are using text mode console, I'd say color_normal,
color_highlight, menu_color_normal, menu_color_highlight environment
variables may help. They are described in "info grub2".

Named, yes. Description of how and where to use (aka examples), not found
(normal for info files and man pages). Based on
<https://unix.stackexchange.com/questions/381188/how-to-set-solid-background-color-in-grub>
I tried appending
GRUB_COLOR_BACKGROUND="blue"
GRUB_COLOR_HIGHLIGHT="white/blue"
GRUB_COLOR_NORMAL="light-blue/blue"
to /etc/default/grub (attached?) and rebuilding /etc/grub2/grub.cfg, but it had
no detectable effect on the Grub menu next boot.

Based on the Debian theme, I also tried creating /etc/grub.d/05_theme:
set_default_theme(){
echo "${1}set menu_color_normal=cyan/blue"
echo "${1}set menu_color_highlight=white/blue"
}
It too had no detectable effect on the Grub menu next boot.

What I, and probably many others, would like is something that provides examples
like info and man pages almost never have. Setting menu colors to something
other than black on white shouldn't require a course in theme programming. I'm
not a programmer.

Bonus question: What controls overall Grub menu size, whether it uses only a
small portion of the center of the screen instead of most of it? I looked in
/etc/grub.d/, /etc/default/grub and /boot/grub2/grub.cfg without spotting
anything that looked like any kind of size control.

Text mode takes whatever console size is exposed by BIOS.

Something other than UEFI BIOS/UEFI BIOS font size must be controlling whether
Grub's menu is using the whole screen or not, no?
--
Bombardier Beetle Irreducible Complexity

Team OS/2 ** Reg. Linux User #211409 ** a11y rocks!

Felix Miata *** http://fm.no-ip.com/
#!/bin/sh
set -e

# grub-mkconfig helper script.
# Copyright (C) 2010 Alexander Kurtz <kurtz.alex@xxxxxxxxxxxxxx>
#
# GRUB is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# GRUB is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GRUB. If not, see <http://www.gnu.org/licenses/>.

# Include the GRUB helper library for grub-mkconfig.
. /usr/share/grub/grub-mkconfig_lib

# We want to work in /boot/grub/ only.
test -d /boot/grub; cd /boot/grub

# Set the location of a possibly necessary cache file for the background image.
# NOTE: This MUST BE A DOTFILE to avoid confusing it with user-defined images.
BACKGROUND_CACHE=".background_cache"

set_default_theme(){
case $GRUB_DISTRIBUTOR in
Tanglu|Ubuntu|Kubuntu)
# Set a monochromatic theme for Tanglu/Ubuntu.
echo "${1}set menu_color_normal=white/black"
echo "${1}set menu_color_highlight=black/light-gray"

if [ -e /usr/share/plymouth/themes/default.grub ]; then
sed "s/^/${1}/"
/usr/share/plymouth/themes/default.grub
fi
# For plymouth backward compatiblity. Can be removed
# after xenial.
if [ -e /lib/plymouth/themes/default.grub ]; then
sed "s/^/${1}/"
/lib/plymouth/themes/default.grub
fi
;;
*)
# Set the traditional Debian blue theme.
echo "${1}set menu_color_normal=cyan/blue"
echo "${1}set menu_color_highlight=white/blue"
;;
esac
}

module_available(){
local module
for module in "${1}.mod" */"${1}.mod"; do
if [ -f "${module}" ]; then
return 0
fi
done
return 1
}

set_background_image(){
# Step #1: Search all available output modes ...
local output
for output in ${GRUB_TERMINAL_OUTPUT}; do
if [ "x$output" = "xgfxterm" ]; then
break
fi
done

# ... and check if we are able to display a background image at all.
if ! [ "x${output}" = "xgfxterm" ]; then
return 1
fi

# Step #2: Check if the specified background image exists.
if ! [ -f "${1}" ]; then
return 2
fi

# Step #3: Search the correct GRUB module for our background image.
local reader
case "${1}" in
*.jpg|*.JPG|*.jpeg|*.JPEG) reader="jpeg";;
*.png|*.PNG) reader="png";;
*.tga|*.TGA) reader="tga";;
*) return 3;; # Unknown image type.
esac

# Step #4: Check if the necessary GRUB module is available.
if ! module_available "${reader}"; then
return 4
fi

# Step #5: Check if GRUB can read the background image directly.
# If so, we can remove the cache file (if any). Otherwise the backgound
# image needs to be cached under /boot/grub/.
if is_path_readable_by_grub "${1}"; then
rm --force "${BACKGROUND_CACHE}.jpeg" \
"${BACKGROUND_CACHE}.png" "${BACKGROUND_CACHE}.tga"
elif cp "${1}" "${BACKGROUND_CACHE}.${reader}"; then
set -- "${BACKGROUND_CACHE}.${reader}" "${2}" "${3}"
else
return 5
fi

# Step #6: Prepare GRUB to read the background image.
if ! prepare_grub_to_access_device "`${grub_probe} --target=device
"${1}"`"; then
return 6
fi

# Step #7: Everything went fine, print out a message to stderr ...
echo "Found background image: ${1}" >&2

# ... and write our configuration snippet to stdout. Use the colors
# desktop-base specified. If we're using a user-defined background, use
# the default colors since we've got no idea how the image looks like.
# If loading the background image fails, use the default theme.
echo "insmod ${reader}"
echo "if background_image `make_system_path_relative_to_its_root
"${1}"`; then"
if [ -n "${2}" ]; then
echo " set color_normal=${2}"
fi
if [ -n "${3}" ]; then
echo " set color_highlight=${3}"
fi
if [ -z "${2}" ] && [ -z "${3}" ]; then
echo " true"
fi
echo "else"
set_default_theme " "
echo "fi"
}

# Earlier versions of grub-pc copied the default background image to /boot/grub
# during postinst. Remove those obsolete images if they haven't been touched by
# the user. They are still available under /usr/share/images/desktop-base/ if
# desktop-base is installed.
while read checksum background; do
if [ -f "${background}" ] && [ "x`sha1sum "${background}"`" =
"x${checksum} ${background}" ]; then
echo "Removing old background image: ${background}" >&2
rm "${background}"
fi
done <<EOF
648ee65dd0c157a69b019a5372cbcfea4fc754a5 debian-blueish-wallpaper-640x480.png
0431e97a6c661084c59676c4baeeb8c2f602edb8 debian-blueish-wallpaper-640x480.png
968ecf6696c5638cfe80e8e70aba239526270864 debian-blueish-wallpaper-640x480.tga
11143e8c92a073401de0b0fd42d0c052af4ccd9b moreblue-orbit-grub.png
d00d5e505ab63f2d53fa880bfac447e2d3bb197c moreblue-orbit-grub.png
f5b12c1009ec0a3b029185f6b66cd0d7e5611019 moreblue-orbit-grub.png
EOF

# Include the configuration of desktop-base if available.
if [ -f "/usr/share/desktop-base/grub_background.sh" ]; then
. "/usr/share/desktop-base/grub_background.sh"
fi

# First check whether the user has specified a background image explicitly.
# If so, try to use it. Don't try the other possibilities in that case
# (#608263).
if [ -n "${GRUB_BACKGROUND+x}" ]; then
set_background_image "${GRUB_BACKGROUND}" || set_default_theme
exit 0
fi

# Next search for pictures the user put into /boot/grub/ and use the first one.
for background in *.jpg *.JPG *.jpeg *.JPEG *.png *.PNG *.tga *.TGA; do
if set_background_image "${background}"; then
exit 0
fi
done

# Next try to use the background image and colors specified by desktop-base.
if set_background_image "${WALLPAPER}" "${COLOR_NORMAL}" "${COLOR_HIGHLIGHT}";
then
exit 0
fi

# If we haven't found a background image yet, use the default from desktop-base.
case $GRUB_DISTRIBUTOR in
Ubuntu|Kubuntu)
;;
Tanglu)
if set_background_image "/usr/share/images/grub/grub.png"; then
exit 0
fi
;;
*)
if set_background_image
"/usr/share/images/desktop-base/desktop-grub.png"; then
exit 0
fi
;;
esac

# Finally, if all of the above fails, use the default theme.
set_default_theme
# If you change this file, run 'grub2-mkconfig -o /boot/grub2/grub.cfg'
afterwards to update
# /boot/grub2/grub.cfg.

# Uncomment to set your own custom distributor. If you leave it unset or empty,
the default
# policy is to determine the value from /etc/os-release
GRUB_DISTRIBUTOR="opensusetw"
GRUB_DEFAULT=saved
GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=15
GRUB_CMDLINE_LINUX_DEFAULT="net.ifnames=0 ipv6.disable=1 video=1440x900@60
noresume 3 "
GRUB_CMDLINE_LINUX=""

# Uncomment to automatically save last booted menu entry in GRUB2 environment

# variable `saved_entry'
# GRUB_SAVEDEFAULT="true"
#Uncomment to enable BadRAM filtering, modify to suit your needs

# This works with Linux (no patch required) and with any kernel that obtains
# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
# GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"
#Uncomment to disable graphical terminal (grub-pc only)

GRUB_TERMINAL="gfxterm"
# 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_GFXMODE="auto"
# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
# GRUB_DISABLE_LINUX_UUID=true
#Uncomment to disable generation of recovery mode menu entries

# GRUB_DISABLE_LINUX_RECOVERY="true"
#Uncomment to get a beep at grub start

# GRUB_INIT_TUNE="480 440 1"
SUSE_BTRFS_SNAPSHOT_BOOTING="true"
GRUB_USE_LINUXEFI="true"
GRUB_DISABLE_OS_PROBER="true"
GRUB_ENABLE_CRYPTODISK="n"
GRUB_CMDLINE_XEN_DEFAULT="vga=gfx-1024x768x16"

GRUB_COLOR_BACKGROUND="blue"
GRUB_COLOR_HIGHLIGHT="white/blue"
GRUB_COLOR_NORMAL="light-blue/blue"
< Previous Next >
Follow Ups