How to change Grub menu item description

Help for Current Versions of MX
When asking for help, use Quick System Info from MX Tools. It will be properly formatted using the following steps.
1. Click on Quick System Info in MX Tools
2. Right click in your post and paste.
Message
Author
fbagnato
Posts: 34
Joined: Sun Feb 12, 2023 12:56 pm

How to change Grub menu item description

#1 Post by fbagnato »

Hello all,

I recently installed MX Linux 23.2 on al old Compaq Presario C700 Laptop.

The laptop has a Dual Boot (actually Triple Boot) Windows and MX Linux setup.

In the Grub menu I have the 2 normal MX Linux entries and 2 entries for Windows Vista.

One of the 2 entries for Windows Vista is the Compaq "System Recovery" partition but it is listed as Windows Vista

To avoid confusion I would like to rename the menu item to the Compaq "System Recovery" Grub menu item.

What is the correct way to do this?

I had a look at the file /etc/default/grub but that doesn't seem to encompass the menu item descriptions.

I also had a look at the MX Boot Options programs but again that doesn't seem to encompass the menu item descriptions.

Regards,

fbagnato

Charlie Brown

Re: How to change Grub menu item description

#2 Post by Charlie Brown »

Code: Select all

sudo nano /boot/grub/grub.cfg
Just be careful.


You can also take a backup first if you like:

Code: Select all

sudo cp /boot/grub/grub.cfg{,.old}

User avatar
fehlix
Developer
Posts: 12723
Joined: Wed Apr 11, 2018 5:09 pm

Re: How to change Grub menu item description

#3 Post by fehlix »

fbagnato wrote: Sun Mar 03, 2024 2:13 am One of the 2 entries for Windows Vista is the Compaq "System Recovery" partition but it is listed as Windows Vista

To avoid confusion I would like to rename the menu item to the Compaq "System Recovery" Grub menu item.

What is the correct way to do this?
One correct way would be something like this:

1) Do not edit the GRUB menu at /boot/grub/grub.cfg
That's the wrong approach, b/c next regeneration of the grub menu would overwrite any manual changes

2) Create static windows related menu entries
* extract the the grub menu entries involved
*and place them into a new file /boot/grub/custom.cfg

3) Edit the entries and the menu title within /boot/grub/custom.cfg

4) Disable the automatic generated menu entries for WIndows, otherwise you would have them twice.

An alternative way some user may recomend would be to use "Grub Customizer".
But we had quite some issues in the past with "Grub Customizer",
so not something I would recommend.

Details:
to 2)
Either manual do this,
Or maybe simpler, extract Windows related menu entries this way:
run this command:

Code: Select all

sudo sed -nr "/^menuentry .*(windows|vista)/I,/^}/p" /boot/grub/grub.cfg | sudo tee -a /boot/grub/custom.cfg
to 3) Open text editor and adjust the windows related menu entries:

Code: Select all

fpad  /boot/grub/custom.cfg
to 4)
Post the text output of the command above in "to 2)", which should now be the same within the file /boot/grub/custom.cfg
which would provide the info needed to disable the automatic generated entries related to Windows.

fbagnato
Posts: 34
Joined: Sun Feb 12, 2023 12:56 pm

Re: How to change Grub menu item description

#4 Post by fbagnato »

Hello Charlie Brown and fehlix,

Thanks to both of you for your replies.

I am trying to take the approach that fehlix has outlined.

I have done steps 1) to 3) without a problem but am not sure what to do for step 4).

Do I have to go into /boot/grub/grub.cfg and comment out the menuentries that are now in /boot/grub/custom.cfg?

Do I have to change the same menuentries description that I made in /boot/grub/custom.cfg in /boot/grub/grub.cfg?

Once Step 4) is done do I still need to run the command sudo update-grub?

Regards,

fbagnato

User avatar
fehlix
Developer
Posts: 12723
Joined: Wed Apr 11, 2018 5:09 pm

Re: How to change Grub menu item description

#5 Post by fehlix »

fbagnato wrote: Sun Mar 03, 2024 5:21 pm I have done steps 1) to 3) without a problem but am not sure what to do for step 4).
Don't do anything, just post the extracted contents, as mentioned, so we can provide you with details,
what to do next.
++EDIT++ Or better post the content of /boot/grub/custom.cfg, in case you made already changes.

fbagnato
Posts: 34
Joined: Sun Feb 12, 2023 12:56 pm

Re: How to change Grub menu item description

#6 Post by fbagnato »

Hello fehlix,

Sorry I was a bit confused by step 4).

The following are the contents of custom.cfg (Changes to the relevant "Windows Vista" menuentry has been changed to "Compaq System Recovery"):

Code: Select all

menuentry 'Windows Vista (on /dev/sda1)' --class windows --class os $menuentry_id_option 'osprober-chain-B22CF5132CF4D2F9' {
	insmod part_msdos
	insmod ntfs
	set root='hd0,msdos1'
	if [ x$feature_platform_search_hint = xy ]; then
	  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1  B22CF5132CF4D2F9
	else
	  search --no-floppy --fs-uuid --set=root B22CF5132CF4D2F9
	fi
	parttool ${root} hidden-
	chainloader +1
}
menuentry 'Compaq System Recovery (on /dev/sda2)' --class windows --class os $menuentry_id_option 'osprober-chain-2C88743C8874071C' {
	insmod part_msdos
	insmod ntfs
	set root='hd0,msdos2'
	if [ x$feature_platform_search_hint = xy ]; then
	  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos2 --hint-efi=hd0,msdos2 --hint-baremetal=ahci0,msdos2  2C88743C8874071C
	else
	  search --no-floppy --fs-uuid --set=root 2C88743C8874071C
	fi
	parttool ${root} hidden-
	chainloader +1
}
Regards,

fbagnato

User avatar
fehlix
Developer
Posts: 12723
Joined: Wed Apr 11, 2018 5:09 pm

Re: How to change Grub menu item description

#7 Post by fehlix »

fbagnato wrote: Sun Mar 03, 2024 7:08 pm Hello fehlix,

Sorry I was a bit confused by step 4).

The following are the contents of custom.cfg (Changes to the relevant "Windows Vista" menuentry has been changed to "Compaq System Recovery"):

Code: Select all

menuentry 'Windows Vista (on /dev/sda1)' --class windows --class os $menuentry_id_option 'osprober-chain-B22CF5132CF4D2F9' {
	insmod part_msdos
	insmod ntfs
	set root='hd0,msdos1'
	if [ x$feature_platform_search_hint = xy ]; then
	  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1  B22CF5132CF4D2F9
	else
	  search --no-floppy --fs-uuid --set=root B22CF5132CF4D2F9
	fi
	parttool ${root} hidden-
	chainloader +1
}
menuentry 'Compaq System Recovery (on /dev/sda2)' --class windows --class os $menuentry_id_option 'osprober-chain-2C88743C8874071C' {
	insmod part_msdos
	insmod ntfs
	set root='hd0,msdos2'
	if [ x$feature_platform_search_hint = xy ]; then
	  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos2 --hint-efi=hd0,msdos2 --hint-baremetal=ahci0,msdos2  2C88743C8874071C
	else
	  search --no-floppy --fs-uuid --set=root 2C88743C8874071C
	fi
	parttool ${root} hidden-
	chainloader +1
}
Regards,

fbagnato
OK, thanks:
Do add this line to /etc/default/grub
e.g. edit with featherpad

Code: Select all

fpad /etc/default/grub
and add the line at the end of the file

Code: Select all

GRUB_OS_PROBER_SKIP_LIST="B22CF5132CF4D2F9 2C88743C8874071C"

and run this command to get a new menu generated:

Code: Select all

sudo update-grub
which should now only display Linux installation entries found, and all shown windows entries are ignored.
And b/c we have now the Windows related entries placed into /boot/grub/custom.cfg
they are available for grub.
That's it.
PS: In case you want adjust the display names again within custom.cfg,
you don't need to re-generate the grub menu again, b/c custom.cfg
will be "loaded" by grub at boot.

fbagnato
Posts: 34
Joined: Sun Feb 12, 2023 12:56 pm

Re: How to change Grub menu item description

#8 Post by fbagnato »

Hello fehlix,

Firstly, for some reason I am not getting email notifications when you answer my thread.

Don't know why as it says that I am subscribed to the topic.

I made the changes as you instructed but I have duplicate entries for the Windows Vista partitions.

The second lot look like they're coming from the custom.cfg file as the second entry of the second set is correctly described as "Compaq System Recovery (on /dev/sda2)"

I looked at the /etc/default/grub file and there seems to be an entry that may relate?

Code: Select all

#run dpkg-reconfigure grub-pc to allow toggle of os-prober
#GRUB_DISABLE_OS_PROBER=false
The full /etc/default/grub file is as follows:

Code: Select all

# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
#   info -f grub -n 'Simple configuration'

GRUB_DEFAULT=0
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(unset PRETTY_NAME; (. /etc/lsb-release; echo ${PRETTY_NAME:?}) 2>/dev/null || echo Debian)"
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash resume=UUID=3ad8f4af-9d40-4655-b13f-8ed7cb4acb71 resume_offset=1476608"
GRUB_CMDLINE_LINUX=""

# Uncomment to enable BadRAM filtering, modify to suit your needs
# This works with Linux (no patch required) and with any kernel that obtains
# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
#GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"

# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL=console

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
GRUB_GFXMODE="1024x768"

# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID=true

# Uncomment to disable generation of recovery mode menu entries
GRUB_DISABLE_RECOVERY="true"

# Uncomment to get a beep at grub start
#GRUB_INIT_TUNE="480 440 1"

#run dpkg-reconfigure grub-pc to allow toggle of os-prober
#GRUB_DISABLE_OS_PROBER=false

if [ -e /etc/default/grub.mx-defaults ]; then
     .  /etc/default/grub.mx-defaults
fi

GRUB_THEME="/boot/grub/themes/mx_linux/theme.txt"
GRUB_OS_PROBER_SKIP_LIST="B22CF5132CF4D2F9 2C88743C8874071C"
Regards,

fbagnato

User avatar
fehlix
Developer
Posts: 12723
Joined: Wed Apr 11, 2018 5:09 pm

Re: How to change Grub menu item description

#9 Post by fehlix »

fbagnato wrote: Sun Mar 03, 2024 9:07 pm I made the changes as you instructed but I have duplicate entries for the Windows Vista partitions.
What's the output of:

Code: Select all

sudo update-grub

fbagnato
Posts: 34
Joined: Sun Feb 12, 2023 12:56 pm

Re: How to change Grub menu item description

#10 Post by fbagnato »

Hello fehlix,

The output of sudo update-grub is as follows:

Code: Select all

$ sudo update-grub
[sudo] password for End-User:         
Generating grub configuration file ...
Found theme: /boot/grub/themes/mx_linux/theme.txt
Found linux image: /boot/vmlinuz-6.1.0-18-amd64
Found initrd image: /boot/initrd.img-6.1.0-18-amd64
Found linux image: /boot/vmlinuz-6.1.0-17-amd64
Found initrd image: /boot/initrd.img-6.1.0-17-amd64
Found Windows Vista on /dev/sda1
Found Windows Vista on /dev/sda2
done

Post Reply

Return to “MX Help”