bugGNU GRUB - Bugs: bug #60568, grub-mkconfig generates broken...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #60568: grub-mkconfig generates broken paths for themes and fonts located in mountpoints different than "/"

Submitter:  Marco Bonelli <mebeim>
Submitted:  Mon 10 May 2021 12:37:55 AM UTC
   
 
Category:  Configuration Severity:  Major
Priority:  5 - Normal Item Group:  Software Error
Status:  None Privacy:  Public
Assigned to:  None Originator Name: 
Open/Closed:  Open Release:  2.02
Release:  Reproducibility:  Every Time
Planned Release:  None

Mon 10 May 2021 12:37:55 AM UTC, original submission:  

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`

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

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

Marco Bonelli <mebeim>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by mebeim (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    No changes have been made to this item

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code