1

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

  1. 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"
  2. how to edit the name to my choice which is shown as "Windows Boot Manager (on /dev/sda1)"

enter image description here enter image description here

Update:
I Confirm about the text "GNU/Linux" is solved by @Terrance comments.
I still need to try about windows entry.

enter image description here

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.

enter image description here

PRATAP
  • 22,460
  • 1
    I don't have anything official, but if you look at my answer from a long time ago it is the OS-Prober files that set the names: https://askubuntu.com/a/666318/231142 I could be off though for the Ubuntu name though. – Terrance Jul 13 '18 at 22:41
  • For windows naming I will try it and get back to you. But about adding the text "GNU/ Linux" do you have any idea. Thanks. – PRATAP Jul 13 '18 at 22:46
  • I am looking and testing some things right now. I will let you know. =) – Terrance Jul 13 '18 at 22:48
  • Thank you. I will try and get back to you. But it's late night now 2am. Morning I will workout. Thanks for your time. – PRATAP Jul 13 '18 at 22:58
  • Looks like I found something for you. In the file /etc/grub.d/10_liunx on line 45 it is if you change the name of Ubuntu or whatever it shows 4 lines up that is where it adds the GNU/Linux. You can copy that line and paste it below or above it, then comment out the original line and I bet that will fix what you are seeing. – Terrance Jul 13 '18 at 23:03
  • I will make it now. – PRATAP Jul 13 '18 at 23:04
  • Make sure on the new line you remove the GNU/Linux off it. – Terrance Jul 13 '18 at 23:05
  • Yes, i confirm your comment about "GNU/Linux" is solved point no. 1 of my Q. I need to try for windows entry. I will do it in few hours. Thanks for your quick response. I have updated my question. please have a look. – PRATAP Jul 13 '18 at 23:16
  • @Terrance, i have gone through your answer in first comment. But not able to understand where to change, here is the file /usr/lib/os-probes/mounted/20microsoft https://paste.ubuntu.com/p/W53x644qdb/ Please have a look. – PRATAP Jul 13 '18 at 23:35
  • I am sorry, it is in the /usr/lib/os-probes/mounted/efi/20microsoft file – Terrance Jul 13 '18 at 23:42
  • ya, trying now.. – PRATAP Jul 13 '18 at 23:54
  • https://i.stack.imgur.com/xyWuF.jpg. Its almost done. now we need to avoid the text "(on /dev/sda1)" – PRATAP Jul 14 '18 at 00:02

2 Answers2

3

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 
}
oldfred
  • 12,100
  • Hi, seems this is the answer. I am trying the answer but stuck at editing 40_custom file. I dont know from where to copy paste menuentrys here in this text file. it contains 5 lines. – PRATAP Jul 13 '18 at 23:48
  • @PRATAP Copy from /boot/grub.cfg – mook765 Jul 14 '18 at 00:12
  • yes, i got one entry for windows in /boot/grub/grub.cfg....trying now.. – PRATAP Jul 14 '18 at 00:16
  • @mook765 i think i have to workout much in this method. i am worried about 06_os-prober as it is already there in /etc/grub.d and i am worried if i have to save as 40_os-prober.. I felt Terrance comments are easy to achieve what i want. – PRATAP Jul 14 '18 at 00:20
  • Grub uses files in number order. So if you want your manual entries first, use 06_custom. If you want yours last use 40_custom. You can backup grub.cfg generated by os_prober & copy entries from it into 40_custom. Once you know they work then you can change descriptions. Examples from grub manual: https://www.gnu.org/software/grub/manual/grub/grub.html#Multi_002dboot-manual-config & https://ubuntuforums.org/showthread.php?t=2076205&p=13767911#post13767911 – oldfred Jul 14 '18 at 03:36
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 typing sudo 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:

Before

Before

After

ResizedGrub2.png

  • Shoot: forgot to tell you chmod a+x /usr/local/bin/GrubTextEntries to make the script executable.I'll update the answer. – WinEunuuchs2Unix Jul 14 '18 at 14:29
  • If you run sudo update-grub alot, remove the # in front of the command in the script. Then you only need to run sudo GrubTextEntries which calls sudo update-grub itself. However, when Ubuntu installs a new kernel you will need to run sudo GrubTextEntries to get menu updated. – WinEunuuchs2Unix Jul 14 '18 at 14:56
  • @PRATAP You no longer have to run sudo update-grub followed by sudo GrubTextEntries. You only have to run sudo GrubTextEntries which calls sudo update-grub automatically. – WinEunuuchs2Unix Jul 14 '18 at 15:04