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

  • 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: 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
1

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

  • I have never run scripts, so i messed up with something, $ sudo GrubTextEntries [sudo] password for pratap: sudo: GrubTextEntries: command not found i.stack.imgur.com/Nlq7b.png – PRATAP Jul 14 '18 at 13:00
  • 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
  • Ok, i run this command immidiately when i open terminal. no errors, but it acted like sudo update-grub, and grub reset to normal entries. – PRATAP Jul 14 '18 at 14:38
  • i.stack.imgur.com/BhRoY.png – PRATAP Jul 14 '18 at 14:48
  • seems every time if i run or system gets sudo update-grub i have to run sudo GrubTextEntries. Thanks. after running sudo GrubTextEntries its working fine. – PRATAP Jul 14 '18 at 14:53
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 
}
  • 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 0:12
  • yes, i got one entry for windows in /boot/grub/grub.cfg....trying now.. – PRATAP Jul 14 '18 at 0: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 0: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: gnu.org/software/grub/manual/grub/… & ubuntuforums.org/… – oldfred Jul 14 '18 at 3:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.