how to tell GRUB to show the user preferred names of OS'es. Ubuntu 18.04
I am new to Ubuntu.
I am Using Ubuntu 18.04 along with Windows10.
I have gone through the below Q&A and could able to change the name of Ubuntu,
Editing OS names in /etc/default/grub - where is the OS name read from?
But
- if i edit the Ubuntu OS name to my choice, it is then adding "GNU/Linux" at the end. for ex. if i want "Ubuntu 18.04" it is then showing as "Ubuntu 18.04 GNU/Linux". how to avoid this text "GNU/Linux"
- how to edit the name to my choice which is shown as "Windows Boot Manager (on /dev/sda1)"
Update:
I Confirm about the text "GNU/Linux" is solved by @Terrance comments.
I still need to try about windows entry.
Final Update:
Solved.
I thank @Terrance, @Oldfred, @WinEunuuchs2Unix.
All the three methods are working great.
i felt the small script is awesome and very very easy to use. which is written by WinEuuuchs2Unix.
Solution 1:
If you just want to change Ubuntu.
sudo nano -B /etc/default/grub
#GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_DISTRIBUTOR="Xubuntu-12.04-amd64 Precise"
sudo update-grub
If you want to change other installs, turn off os-prober in /etc/default/grub, by adding this line:
GRUB_DISABLE_OS_PROBER=true
And then in 40_custom you can put anything you want.
https://help.ubuntu.com/community/MaintenanceFreeCustomGrub2Screen
How to update grub on a dual boot machine?
I also can boot ISO directly from grub.
How do I boot an ISO file from my drive using grub2 on UEFI machines?
I also am converting hd1,gpt4 type entries to use search & labels. Too often I have to manually change drive as I boot, as plugging in USB changes drive number.
How to add a GRUB2 menu entry for booting installed Ubuntu on a USB drive?
cosmic_b is my install of cosmic on drive sdb, so I labeled it cosmic_b.
menuentry "Cosmic 18.10 on sdb12 test" {
search --set=root --label cosmic_b --hint hd2,gpt12
configfile /boot/grub/grub.cfg
}
Solution 2:
I hate to break a taboo but the easiest way is modifying grub.cfg
.
Create the script my-update-grub
containing:
#!/bin/bash
# NAME: my-update-grub
# PATH: /mnt/e/bin
# DESC: Run update-grub and then rename menu entries
# DATE: July 13, 2018. (yah it's a Friday)
# Must not prefix with sudo when calling script
if [[ $(id -u) != 0 ]]; then
zenity --error --text "You must call this script using sudo. Aborting."
exit 99
fi
#sudo update-grub # Optional remove # in column 1
sed -i "s|Windows Boot Manager (on /dev/nvme0n1p2)|Windows 10|g" /boot/grub/grub.cfg
sed -i "s|Windows Boot Manager (on /dev/sda1)|Windows 10 original|g" /boot/grub/grub.cfg
sed -i "s|Ubuntu 18.04 LTS (18.04) (on /dev/nvme0n1p6)|Ubuntu 18.04|g" /boot/grub/grub.cfg
exit 0
- Change comment
PATH:
to where you put script, probably/usr/local/bin
- Change
Windows Boot Manager (on /dev/nvme0n1p2)
to your menu option. - Change
Ubuntu 18.04 LTS (18.04) (on /dev/nvme0n1p6)
to your menu option. - Delete line with
Windows Boot Manager (on /dev/sda1)
which probably isn't needed. - Remove
#
in front of# sudo update-grub
so you don't have to type that manually before typingsudo my-update-grub
. - Make the script executable. In your case use:
chmod a+x /usr/local/bin/GrubTextEntries
- After every kernel update, run
sudo my-grub-update
I tested this on my system first but, if in doubt, backup first using:
sudo cp /boot/grub/grub.cfg /boot/grub/grub.sav
Before and After
The images are a little skewed because I'm limited to capturing them at distorted 1600x1200 in Virtualbox in Ubuntu 16.04: