grub themes fail to load due to missing dependencies
Grub 1.98 comes with the gfxmenu patch. The code used to include the entries in 00_header currently only adds the theme name, but nothing else. Due to either a bug or feature, currently grub do not load dependencies automatically. This means that when using a theme, it will not load the image modules or fonts required by the selected theme, causing it to fail to load at all.
I included a patch that searches the theme directory, and add the entries just before the theme file.
How to reproduce:
1. Put a GRUB_THEME entry with your theme in /etc/default/grub.
2. Generate your grub.cfg with grub-mkconfig
3. Reboot
4. The theme will not load at all.
The patch was tested against both grub 1.98 and trunk r2263
https://savannah.gnu.org/bugs/?29251
util/grub.d/00_header.in +22 -0
@@ -108,6 +108,28 @@ && is_path_readable_by_grub $GRUB_THEME; then echo "Found theme: $GRUB_THEME" >&2 prepare_grub_to_access_device `${grub_probe} --target=device $GRUB_THEME` | sed -e "s/^/ /" + theme_dir=`dirname $GRUB_THEME` + old_reader="null" + # add any font dependency + for f in ${theme_dir}/*.pf2 ; do + if [ -e $f ] ; then + echo " loadfont (\$root)`make_system_path_relative_to_its_root $f`" + fi + done + # adding insmod dependencies for images + for f in ${theme_dir}/*.{jpg,jpeg,png,tga} ; do + if [ -e $f ] ; then + case $f in + *.png) reader=png ;; + *.tga) reader=tga ;; + *.jpg|*.jpeg) reader=jpeg ;; + esac + if [ $old_reader != $reader ] ; then + echo " insmod ${reader}" + old_reader=$reader + fi + fi + done cat << EOF insmod gfxmenu set theme=(\$root)`make_system_path_relative_to_its_root $GRUB_THEME`
Quoted 8 lines · Mario Vazquez
Grub 1.98 comes with the gfxmenu patch. The code used to include the entries in 00_header currently only adds the theme name, but nothing else. Due to either a bug or feature, currently grub do not load dependencies automatically. This means that when using a theme, it will not load the image modules or fonts required by the selected theme, causing it to fail to load at all.
Good idea but the implementation has problems like e.g: it may load the same module twice in a setup like:
a.png
b.jpg
c.png
I've made my patch based on your idea and I'm currently testing and comitting it.
Quoted 18 lines
I included a patch that searches the theme directory, and add the entries just before the theme file.
How to reproduce:
1. Put aGRUB_THEMEentry with your theme in/etc/default/grub.
2. Generate your grub.cfg with grub-mkconfig
3. Reboot
4. The theme will not load at all.The patch was tested against both grub 1.98 and trunk r2263
https://savannah.gnu.org/bugs/?29251------------------------------------------------------------------------
_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel
Signature · 2 lines
Regards Vladimir 'φ-coder/phcoder' Serbinenko