bug-grub
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

grub-mkconfig generates broken paths for themes and fonts located in mou


From: Marco Bonelli
Subject: grub-mkconfig generates broken paths for themes and fonts located in mountpoints different than "/"
Date: Thu, 11 Mar 2021 05:13:16 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.0

Hello,

I'm running Debian Buster with the following partitions set up:

    $ lsblk
    ...
    nvme0n1p5 259:5    0 102.8G  0 part /
    nvme0n1p6 259:6    0  31.9G  0 part [SWAP]
    nvme0n1p7 259:7    0   492M  0 part /boot

I was trying to install a theme into /boot/grub/themes by adding the
following to /etc/default/grub:

    GRUB_THEME=/boot/grub/themes/mytheme/theme

The theme also references a pf2 font file in the same folder as the "theme"
file.

Updating with grub-mkconfig this results in the following in
/boot/grub/grub.cfg:

    loadfont ($root)/grub/themes/mytheme/font.pf2
    set theme=($root)/grub/themes/mytheme/theme

And when booting GRUB isn't able to load the theme nor the font:

    error: can't open '/grub/themes/mytheme/theme': No such file or directory.
    error: can't open '/grub/themes/mytheme/font.pf2': No such file or 
directory.

This appears to happen because my files are inside the partition which is
mounted at "/boot" instead of "/". If I put my theme in another folder in
the main partition ("/"), like e.g. under / or /usr, the generated path
seems correct and everything works as expected. Furthermore, keeping the
theme inside "/boot/grub" and manually editing grub.cfg after it's
generated to change "($root)/grub/..." into "($root)/boot/grub/..." also
seems to fix the issue.

So AFAICT, it looks like grub-mkconfig should _not_ strip the leading
mountpoint ("/boot") from my paths. Looking at the source code it seems
that this is done in "util/grub.d/00_header.in" using the function
"make_system_path_relative_to_its_root":

    loadfont (\$root)`make_system_path_relative_to_its_root $x`
    ...
    set theme=(\$root)`make_system_path_relative_to_its_root $GRUB_THEME`

So, is this a bug or is it intended? If intended, does this mean that I
should not load fonts/themes from inside "/boot"? It looks
counter-intuitive to say the least, so I hope this is not the case.

Additional information:

    $ uname -a
    Linux xxx 4.19.0-14-amd64 #1 SMP Debian 4.19.171-2 (2021-01-30) x86_64 
GNU/Linux

    $ grub-mkconfig --version
    grub-mkconfig (GRUB) 2.02+dfsg1-20+deb10u4

    $ dpkg -l | grep ii | grep grub
    ii  grub-common              2.02+dfsg1-20+deb10u4       amd64
    ii  grub-efi-amd64           2.02+dfsg1-20+deb10u4       amd64
    ii  grub-efi-amd64-bin       2.02+dfsg1-20+deb10u4       amd64
    ii  grub-efi-amd64-signed    1+2.02+dfsg1+20+deb10u4     amd64
    ii  grub-emu                 2.02+dfsg1-20+deb10u4       amd64
    ii  grub2-common             2.02+dfsg1-20+deb10u4       amd64


Regards,
Marco Bonelli



reply via email to

[Prev in Thread] Current Thread [Next in Thread]