order of /etc/grub.d scripts overriding font settings

Asked by Kim Wibbing on 2013-12-04

Hi Dan, thanks for your software, BTW.

After fiddling with grub-customizer I have a pretty good handle on how it works. However, when I change the font and colors of the font using grub-customizer, it writes it to 05_debian<whatever>, along with the background image, just fine.

However, when 10_Mint_theme comes along...which changes the fonts to something else, naturally, those font variables get overwritten as grub-customizer continues on thru my /etc/grub.d's scripts.

Now, can I go into 10_mint_theme and just comment out the font variable settings there without affecting your program in any way? I'm guessing so, but wanted to bring this up to you that this is happening with me, just in case someone else comes along with the "I can't get grub-customizer to set my fonts correctly" problem.

My /etc/grub.d looks like the following:

mom@ThinkPad-T530 /etc/grub.d $ ls -al
total 100
drwxr-xr-x 5 root root 4096 Dec 3 22:31 .
drwxr-xr-x 148 root root 12288 Dec 3 22:33 ..
-rwxr-xr-x 1 root root 7541 Apr 9 2013 00_header
-rwxr-xr-x 1 root root 5974 Apr 9 2013 05_debian_theme
-rwxr-xr-x 1 root root 1183 Oct 23 2011 10_mint_theme
-rwxr-xr-x 1 root root 358 Dec 3 22:31 11_linux_proxy
-rwxr-xr-x 1 root root 10634 Oct 1 2012 12_lupin
-rwxr-xr-x 1 root root 10258 Apr 9 2013 13_linux_xen
-rwxr-xr-x 1 root root 2063 Dec 3 22:31 17_os-prober_proxy
-rwxr-xr-x 1 root root 1688 Dec 5 2012 18_memtest86+
-rwxr-xr-x 1 root root 1426 Apr 9 2013 19_uefi-firmware
-rwxr-xr-x 1 root root 214 Apr 9 2013 20_custom
-rwxr-xr-x 1 root root 216 Apr 9 2013 21_custom
drwxr-xr-x 2 root root 4096 Dec 3 21:44 bin
drwxr-xr-x 2 root root 4096 Nov 22 20:40 images
drwxr-xr-x 2 root root 4096 Dec 3 22:31 proxifiedScripts
-rw-r--r-- 1 root root 483 Apr 9 2013 README

NOTE: I created "images" and dumped my pretty anti-microsoft images in there for grub to use... :)
-----------------------------------------------------------------------------------------------

Here's my 10_mint_theme script:
-------------------------------------------------------------------------------------
mom@ThinkPad-T530 /etc/grub.d $ more 10*
#!/bin/bash -e

source /usr/lib/grub/grub-mkconfig_lib

set_mono_theme()
{
  cat << EOF
set menu_color_normal=white/black
set menu_color_highlight=white/light-gray
EOF
}

# check for usable backgrounds
use_bg=false
#if [ "$GRUB_TERMINAL_OUTPUT" = "gfxterm" ] ; then
# for i in {/boot/grub,/usr/share/images/desktop-base}/linuxmint.{png,tga} ; 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 Debian background: `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=white/black
# set color_highlight=white/light-gray
#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

 I was also wondering if I could just simply chmod 400 on 10_mint_theme and just turn off the script altogether. Just looking at the script, it doesn't seem to do much...other than screw up my fonts... LOL.

I have Mint 15, CrunchBang and Ubuntu running on my T530. Overkill, I know ;).

Anyway, before I do anything to the scripts, wanted to verify my guesses with you. Thanks, Kim

Question information

Language:
English Edit question
Status:
Solved
For:
Grub Customizer Edit question
Assignee:
No assignee Edit question
Solved by:
Kim Wibbing
Solved:
2013-12-04
Last query:
2013-12-04
Last reply:
2013-12-04

Yes, you can comment out the line.
Chmod should work too (I'm wondering why it doesn't work on your system).
or use the grub customizer way: remove the "(script code)" placeholder of 10_mint_theme

If it doesn't work, I'll take a look at it.

Kim Wibbing (titianmom) said : #2

Thanks Dan. Works fine, now; just chmoded the script.

Also, have been reading the grub2 doc on GNU and apparently its a mute point to add a variety of fonts? see:
-----------------------------------------------
6.2.2 Fonts
The fonts GRUB uses “PFF2 font format” bitmap fonts. Fonts are specified with full font
names. Currently there is no provision for a preference list of fonts, or deriving one font
from another. Fonts are loaded with the “loadfont” command in GRUB. To see the list of
loaded fonts, execute the “lsfonts” command. If there are too many fonts to fit on screen,
do “set pager=1” before executing “lsfonts”.
------------------------------------------------------------------------------------
At any rate, I can't get the fonts to work correctly; I can get SANS 14 but there are spaces btwn letters and of course, the box is hosed. So I just turned off fonts altogether so that its using the /boot/grub/<whatever>.pf2 file. I realize this isn't nec a grub-customizer problem....

Altho, how did you get it to display a nice splash and nice fonts in your lovely screenshots?? (Overview section)

Here's the final grub.cfg (AND my default/grub, down further) after using grub-customizer (just the 00 and 05_debian sections to show font and resolution). as you can see its prob getting the /boot/grub/unicode.pf2 from /etc/default/grub. I'm wondering if I go into defaut/grub and hardcode a font if that would work, but grub-customizer *should* be re-setting the GRUB_FONT variable, correct?? Its picking up the new resolution just fine and modifying default/grub, but it won't touch the fonts as you can see because of that silly "if" statement?:

if loadfont /boot/grub/unicode.pf2 ; then
  set gfxmode=1920x1080x24
  load_video
  insmod gfxterm
  set locale_dir=$prefix/locale
  set lang=en_US
  insmod gettext
fi
terminal_output gfxterm
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 part_msdos
insmod ext2
set root='hd0,msdos1'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1 54a592cd-eaa1-48cc-b7d9-c151ec5dc981
else
  search --no-floppy --fs-uuid --set=root 54a592cd-eaa1-48cc-b7d9-c151ec5dc981
fi
insmod jpeg
if background_image /etc/grub.d/images/full_linuxVillage.jpg; then
  set color_normal=black/black
  set color_highlight=brown/black
else
  set menu_color_normal=cyan/blue
  set menu_color_highlight=white/blue
fi
### END /etc/grub.d/05_debian_theme ###

----------------------------------------------------------------------------------------------------------------

mom@ThinkPad-T530 /etc/default $ more grub
# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
# info -f grub -n 'Simple configuration'

GRUB_DEFAULT="0"
GRUB_HIDDEN_TIMEOUT="0"
GRUB_HIDDEN_TIMEOUT_QUIET="true"
GRUB_TIMEOUT="10"
GRUB_DISTRIBUTOR="`lsb_release -i -s 2> /dev/null || echo Debian`"
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""

# 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="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_GFXMODE="1920x1080x24"

# 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_RECOVERY="true"

# Uncomment to get a beep at grub start
#GRUB_INIT_TUNE="480 440 1"

export GRUB_MENU_PICTURE="/etc/grub.d/images/full_linuxVillage.jpg"
export GRUB_COLOR_NORMAL="black/black"
export GRUB_COLOR_HIGHLIGHT="brown/black"
GRUB_FONT="/boot/grub/unicode.pf2"

Kim Wibbing (titianmom) said : #3

Okay, Dan; I think I figured out the problem with the fonts. They basically work fine, and you can get the decent box and arrow keys instructions at the bottom *IF* you do not use the "bold" when selecting your font using grub-customizer. Don't mess with the scripts by hand to fix the fonts.

If you leave it at "regular" (in whatever you choose, like DejaVu Sans (I think that's the name), then it turns out fine.

So just don't use bold....

Also, you need to view ALL of the Screenshots--in order-- under the Overview section to change the general settings screen as shown.

Kim

Yes, the font style (bold etc) is a doesn't work correctly. The font isn't formatted correctly when trying to find the font file using fc-match. I fixed it in version 4.0 which will be released soon.