Customize MY_Grub.cfg boot menu with additional text and architecture [i386], [amd64] MX21.

Message
Author
taraxacum
Posts: 81
Joined: Fri Dec 14, 2018 7:24 pm

Customize MY_Grub.cfg boot menu with additional text and architecture [i386], [amd64] MX21.

#1 Post by taraxacum »

Customize MY_Grub.cfg boot menu with additional text and architecture [i386], [amd64] MX21.


When you insert the installation CD, an architecture entry of 386 or x64 is displayed.

However, after completing the installation of multiple distributions, this architecture information is not displayed in the Grub main menu.
Then the question arises, which of the distro's is the 386 version and which is the x64 version?
https://forum.mxlinux.org/viewtopic.php ... 20#p680420

Furthermore, I miss the possibility to put an explanatory individual text in front of each distro in the Grub main menu.
So far I have written this text entry manually in the /boot/grub/grub.cfg file for the sake of a better overview. This is very time consuming as my entry gets overwritten and disappears with every Grub update. This process could be automated.

With this wishful thinking, I turned to the developers and, with their support (by Fehlix), have now worked out the following solution that solves the problem:


And now, dear reader!

So that you don't have to read all 30 posts and get bored, I would like to give a short version of the working solution here.

If several distributions are installed on one hard disk, a clear arrangement results:
1# Grub-Startmenü Text + Arch [i386] [amd64]_2022-06-17.png



Step 1:
In all BELOWER distributions I only edit the /etc/lsb-release file:
2# etc-lsb-release_Text-1 + Arch [amd64]_2022-06-17.png

Prefixed with my desired text. After that, I add the architecture entry manually in square brackets.
(German keyboard AltGr key + key 8 and key 9).
For reading out in the respectively started system I use terminal with entry:
dpkg --print-architectue.
After a few seconds, the read value i386 or amd64 is displayed, which I then write in the brackets:
3# Terminal_amd64_2022-06-17.png

Code: Select all

DISTRIB_DESCRIPTION="Text-1 -MX 21 Wildflower [ ]"



Step 2:
In the (first installed) controlling TOP distribution, I only edit the /etc/default/grub file:

The PRETTY_NAME value remains unchanged:
GRUB_DISTRIBUTOR="$(unset PRETTY_NAME; (. /etc/lsb-release; echo ${PRETTY_NAME:?}) 2>/dev/null || echo Debian) "
and I add four NEW lines after this line:
4# etc-default-grub_MY_GRUBMENU Text + [Arch]_2022-06-17.png

Code: Select all

MY_GRUBMENU_TEXT="Text-4"
MY_GRUBMENU_ARCH="$(dpkg --print-architecture)"
MY_DISTRIBUTOR="GRUB_DISTRIBUTOR"
eval $MY_DISTRIBUTOR=" '$MY_GRUBMENU_TEXT - $GRUB_DISTRIBUTOR [$MY_GRUBMENU_ARCH]' "
A notice:
Between the superscript double dashes "
the new MY_statement is placed with a superscript single apostrophe ' in between.



In each individual distribution - starting from the bottom up - I update a new Grub.cfg file (possibly with root or password input) in the terminal: sudo update-grub.
5# Terminal_sudo update-grub_2022-05-22.png




Provided grub is installed in a separate MBR boot partition, the TOP display of the first distro will always remain the same with the same /etc/default/grub file. With each newly added distro, Grub is installed in the respective root partition (PBR) then only the respective file /etc/lsb-release is edited.
(I prefer this).

If Grub is not installed in a separate boot partition, but is installed in every root partition, the previous TOP distribution is converted into a BELOW distribution with each new installation that is added (the most recently installed distro is always at the top). As a result, the 4 additional lines from the /etc/default/grub file must be implemented accordingly - as must the /etc/lsb-release file.


I wish you the best of luck with your imitation.

Related links on this topic might be worth reading:

Code: Select all

https://www.howtogeek.com/196655/how-to-configure-the-grub2-boot-loaders-settings/
You do not have the required permissions to view the files attached to this post.
Last edited by taraxacum on Mon Jun 27, 2022 4:15 am, edited 18 times in total.

taraxacum
Posts: 81
Joined: Fri Dec 14, 2018 7:24 pm

Customize MY_Grub.cfg boot menu with additional text and architecture [i386], [amd64] MX21.

#2 Post by taraxacum »

Here are the pictures of the problems described at the beginning of my post:
6# DVD MX-21 386_2022-06-17.png
7# DVD MX-21_x64_2022-06-17.png
8# mx-version MX-21_386_2022-06-21.png
9# mx-version MX-21_x64_2022-06-17.png
10# MX 21 Wildflower_2022-06-21.png
Link back to short version #1:
https://forum.mxlinux.org/viewtopic.php ... 11#p680411
END of the Short-Version.
You do not have the required permissions to view the files attached to this post.
Last edited by taraxacum on Mon Jun 27, 2022 8:46 pm, edited 8 times in total.

User avatar
dolphin_oracle
Developer
Posts: 19924
Joined: Sun Dec 16, 2007 1:17 pm

Re: Grub.cfg text entry 'UserName - '

#3 Post by dolphin_oracle »

on the other hand, you could just add whatever string you want to the menu in the /etc/default/grub file of the particular install you are running.

changing this line

Code: Select all

GRUB_DISTRIBUTOR="$(unset PRETTY_NAME; (. /etc/lsb-release; echo ${PRETTY_NAME:?}) 2>/dev/null || echo Debian)"
to

Code: Select all

GRUB_DISTRIBUTOR="WHATEVER STRING YOU WANT $(unset PRETTY_NAME; (. /etc/lsb-release; echo ${PRETTY_NAME:?}) 2>/dev/null || echo Debian)"
will survive update-grubs. (which is what I would do if I were inclined to add such a custom string).

alternatively, you could just edit the "PRETTY_NAME" value of /etc/lsb-release to say whatever you want, "update-grub", and leave the /etc/default/grub alone. this is what I do to tell different test installations of MX apart (KDE, flubox, ahs).

Code: Select all

─> cat /etc/lsb-release 
PRETTY_NAME="MX 21.1 Wildflower"
DISTRIB_ID=MX
DISTRIB_RELEASE=21.1 
DISTRIB_CODENAME="Wildflower"
DISTRIB_DESCRIPTION="MX 21.1 Wildflower"
http://www.youtube.com/runwiththedolphin
lenovo ThinkPad X1 Extreme Gen 4 - MX-23
FYI: mx "test" repo is not the same thing as debian testing repo.

User avatar
figueroa
Posts: 1049
Joined: Fri Dec 21, 2018 12:20 am

Re: Grub.cfg text entry 'UserName - '

#4 Post by figueroa »

But, WHY?
Andy Figueroa
Using Unix from 1984; GNU/Linux from 1993

taraxacum
Posts: 81
Joined: Fri Dec 14, 2018 7:24 pm

Customize MY_Grub.cfg boot menu with additional text and architecture [i386], [amd64] MX21.

#5 Post by taraxacum »

Thank you for your quick reply. I followed your last advice.
I just prepended my UserName text entry to the MX version in each version:
(With Thunar root) /etc/lsb-release
PRETTY_NAME="UserName - MX ..........."

Finally, after the entry in each version, I loaded it with Grub Customizer and created a Grub.cfg.
When loading, all the added entries were loaded.
To my surprise, however, only the top text entry was displayed in the start menu - see photo.
What is the reason for the wrong output?
You do not have the required permissions to view the files attached to this post.
Last edited by taraxacum on Tue Jun 21, 2022 10:35 am, edited 3 times in total.

User avatar
dolphin_oracle
Developer
Posts: 19924
Joined: Sun Dec 16, 2007 1:17 pm

Re: Grub.cfg text entry 'UserName - '

#6 Post by dolphin_oracle »

ah, for those other installations you would need to edit the last entry in /etc/lsb-release, run update-grub on each of those installs, and then run update-grup on the install that is controlling your grub menu that gets displayed.
http://www.youtube.com/runwiththedolphin
lenovo ThinkPad X1 Extreme Gen 4 - MX-23
FYI: mx "test" repo is not the same thing as debian testing repo.

taraxacum
Posts: 81
Joined: Fri Dec 14, 2018 7:24 pm

Customize MY_Grub.cfg boot menu with additional text and architecture [i386], [amd64] MX21.

#7 Post by taraxacum »

Well done!
The expert (developer) is amazed ---- and the layman (beginner) is amazed...
These entries lead to a usable result.
In /etc/lsb-release
I have the text entries "UserName - MX .....Version"
added in both PRETTY_NAME= and DISTRIB_DESCRITION= . -This is the working solution.
Finally, I reloaded each version with Grub Customizer and then saved it with the save button.
Finally, edit the top entry in the same way.
You do not have the required permissions to view the files attached to this post.
Last edited by taraxacum on Tue Jun 21, 2022 10:35 am, edited 3 times in total.

xaol
Posts: 263
Joined: Wed Mar 03, 2021 9:30 am

Re: Grub.cfg text entry 'UserName - '

#8 Post by xaol »

i may be wrong, but i think /etc/lsb-release will be overwritten by a new version when mx comes to a new point release. i think 21.1 was just released so that could be a while. i don't know if there will be another for 19.

User avatar
dolphin_oracle
Developer
Posts: 19924
Joined: Sun Dec 16, 2007 1:17 pm

Re: Grub.cfg text entry 'UserName - '

#9 Post by dolphin_oracle »

xaol wrote: Fri Apr 15, 2022 10:51 pm i may be wrong, but i think /etc/lsb-release will be overwritten by a new version when mx comes to a new point release. i think 21.1 was just released so that could be a while. i don't know if there will be another for 19.
nope. if you edit the fields, it won't be overwritten. I match the whole string in PRETTY_NAME and DISTRIB_DESCRIPTION so they won't be touched if they get edited. kind of a nicety for spinners.
http://www.youtube.com/runwiththedolphin
lenovo ThinkPad X1 Extreme Gen 4 - MX-23
FYI: mx "test" repo is not the same thing as debian testing repo.

xaol
Posts: 263
Joined: Wed Mar 03, 2021 9:30 am

Re: Grub.cfg text entry 'UserName - '

#10 Post by xaol »

thank you for the correction. does that mean in the case of the ones used in the example, the point release won't get updated in those fields? i.e. the others will say 21.2, but pretty_name and distrib_description would stay 21.1 as they were?

Post Reply

Return to “General”