How to edit Grub menu labels?

Hello everyone.

I need to know how to change the Grub menu entry labels. I have Win 10, Manjaro KDE and I will be installing another version of Manjaro (haven’t decided yet). I would like it to change the labels to say:
Manjaro KDE
Win 10 Pro
Manjaro XFCE

If there is some documentation I should read please include that as well. I’m still learning linux and manjaro. Thanks.

In my opinion, the best way to do this is to edit the scripts in /etc/grub.d/. If you edit the 30_os-prober script, you can change how the detected operating systems from os-prober are displayed; 10_linux is the script that you can edit to change the display name for the operating system that you are using GRUB from. Alternatively, you can use the 40_custom script to write custom entries.

This will require some knowledge of shell scripting, but these scripts will then continue to correctly create your desired entries after kernel updates. Always backup before doing this type of editing, and do not edit all the files at once (i.e. make sure you haven’t made any mistakes before moving on to the next one).

I don’t understand how the scripts work in order to change the menu labels.

we can change /etc/lsb-release, key DISTRIB_DESCRIPTION, os-prober use this key

In my second manjaro, i use a pacman hook for next update

/etc/pacman.d/hooks/lsb-release.hook

[Trigger]
Operation = Install
Operation = Upgrade
Type = File
Target = etc/lsb-release

[Action]
Description = lsb-release change grub description
When = PostTransaction
Exec = /usr/bin/sed -i 's/^DISTRIB_DESCRIPTION.*/DISTRIB_DESCRIPTION="Manjaro Cinnamon"/' /etc/lsb-release

Does the /etc/lsb-release file get changed with system updates/upgrades and/or switching of the kernel? Also, the “/etc/pacman.d/hooks/” folder does not exist. I’m on Manjaro KDE 22.0.0.

It’s at us to create this /etc/pacman.d/hooks/” directory (and file)

This hook change /etc/lsb-release content only when this file is updated by pacman

OK so I did a 2nd install of Manjaro KDE (I’ll change it do a different Manjaro edition later) and upgraded it to 22.0.0 and installed the 5.19.17 kernel on both installs.

In the first Manjaro install I updated the /etc/lsb-release file to have:

 DISTRIB_DESCRIPTION="KDE 1 Manjaro Linux" as the value for the 

The 2nd install has:

DISTRIB_DESCRIPTION="KDE 2 Manjaro Linux"

I added the appropriate hooks content as specified above by @papajoke that matches the quoted text strings above. I logged into the 2nd install (KDE 2), and ran:

sudo grub-mkconfig -o /boot/grub/grub.cfg

When I reboot I get:

  • Manjaro Linux
  • KDE 1 Manjaro Linux (22.0.0) on …
  • Windows boot loader

It is strange that the grub-mkconfig picks up the changes in the 1st install (KDE 1), but not the changes in the 2nd install (KDE 2). Is there something I missed?

lsb_release is only for os-prober :wink:

for default linux (grub owner), entry (prefix) is in etc/default/grub , key : GRUB_DISTRIBUTOR
so, for you: GRUB_DISTRIBUTOR="KDE 2 Manjaro"

if I made the appropriate change to the /etc/default/grub in each Manjaro install, as well as the changes to /etc/lsb-release in each Manjaro, and create the appropriate pacman hooks, then can I run grub-mkconfig or update-grub in either Manjaro install and still get the desired result?

Update:
I did the above and it worked. I haven’t tested after upgrading to a newer version of Manjaro since I’m already on the latest version.

The solution to editing grub menu labels is contained in the posts in this thread by @papajoke.

Thank you.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.