0

I would like to make the menu titles of grub2 shorter for them to fit in my theme. Namely,

  Fedora 38 rescue

instead of

  Fedora Linux (0-rescue-7ad84fe099814e3388129347d2a46891) 38 (KDE Plasma)

and

  Fedora 38 (6.2.13-300)

instead of

  Fedora Linux (6.2.13-300.fc38.x86_64) 38 (KDE Plasma)

If I am not mistaken, I should need to edit by hand the file /etc/grub.d/10_linux, which is not a trivial task. And, more importantly, this file will be changed by an update of grub2-tools package. This is not practical, I want a 'maintenance free' thing.

Is there any way to configure a different grub2 menu title in a persistent way?

I use the 40_custom file for my menu entries, but the kernel entries are handled automatically.

Artem S. Tashkinov
  • 26,392
  • 4
  • 33
  • 64
Luis A. Florit
  • 293
  • 1
  • 11

1 Answers1

0

Add a line

export BLS_POPULATE_MENU="true"

in /etc/default/grub, and change the title=${value} line in /etc/grub.d/10_linux by

title=$(echo "${value}" | sed 's/.../.../')

to your liking. Remember to update back the file /etc/grub.d/10_linux each time grub2-tools is updated.

Explanation: The menu title is built by the parser in the variable bls_parser in /etc/grub.d/10_linux, that's why the line in /etc/default/grub. This parser obtains the information inside the files in /boot/loader/entries/.

Luis A. Florit
  • 293
  • 1
  • 11