Rename a grub entry

update-grub
Is there a way to rename the /dev/sdb1 from Windows 10 to Windows XP
in the grub entry menu?

Hello there!
You can try this Linux Mint - Community , from the official community forum. [Kindof non GUI {CLI} method]
OR
You can install the GRUB Customizer App and rename it. [GUI method]
More about GRUB Customizer [article on ITSFOSS itself]: Customize Grub With Grub Customizer GUI Tool in Linux

Thanks for reading!

@TypeHrishi
Grub Customizer will not install. Will try gksudo. gksudo does not
work and neither does nano, can grub2 os-prober even detect
Windows XP.


Finally got the boot order I can live with. Why cannot Linux be this simple?

1 Like

Does this rename tool work on wine
After the grub change does windows still boot normally
Why the need to change

Interesting subject

Welcome @Paul_Illingworth !!! I was trying to set a boot drive using Linux Mint, it
worked, kind of, so now I I am using a Windows boot drive.

Hi @4dandl4 (Daniel)
Yes , you can do it by editing the grub configuration files in the OS which controls grub (I think that is Mint in your case).

Method 1:
Go to /boot/grub and edit the file grub.cfg. Make a backup copy before you edit it.
Look for a line like this

### BEGIN /etc/grub.d/10_linux ###

only in your case it needs to be windows … I do not have a windows entry so I cant show you that

Then look just below it for a line like

menuentry 'Debian GNU/Linux' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-7f1fdad2-e5f1-491c-818e-d375a5a40e49'

only yours should say ‘Windows 10’
Then change the ‘10’ to ‘XP’
That is all … save and boot

But… make sure you get the BEGIN section that is on /dev/sdb1… There will be a section for each of sdb1 and sdc1. It looks like sdb1 will be first.

Only drawback with this method is it is not permanent. When you do an update-grub the grub.cfg file will be overwritten, and you will have to edit it again.

Method 2
Go to /etc/grub.d
You should see these files

nevj@trinity:/etc/grub.d$ ls
00_header        10_linux      30_os-prober      40_custom  README
05_debian_theme  20_linux_xen  30_uefi-firmware  41_custom

Have a look at 30_os-prober
There is a section about 1/3 way down as follows

for OS in ${OSPROBED} ; do
  DEVICE="`echo ${OS} | cut -d ':' -f 1`"
  LONGNAME="`echo ${OS} | cut -d ':' -f 2 | tr '^' ' '`"
  LABEL="`echo ${OS} | cut -d ':' -f 3 | tr '^' ' '`"
  BOOT="`echo ${OS} | cut -d ':' -f 4`"
  if UUID="`${grub_probe} --target=fs_uuid --device ${DEVICE%@*}`"; then
    EXPUUID="$UUID"

    if [ x"${DEVICE#*@}" != x ] ; then
      EXPUUID="${EXPUUID}@${DEVICE#*@}"
    fi

    if [ "x${GRUB_OS_PROBER_SKIP_LIST}" != "x" ] && [ "x`echo ${GRUB_OS_PROBER_S
KIP_LIST} | grep -i -e '\b'${EXPUUID}'\b'`" != "x" ] ; then
      echo "Skipped ${LONGNAME} on ${DEVICE} by user request." >&2
      continue
    fi
  fi

You need to write a test in there to say
if DEVICE == /dev/sdb1
and LONGNAME == Windows 10
then change LONGNAME to Windows XP.
I am not a Bash shellscript expert. I will not attempt to write it as I might get it wrong. If you have trouble ask @Akito … he is an expert at Bash scripts. Again make a backup copy of the file before you change anything.

The merit of method 2 is that it will be permanent. The basic problem is that os-prober is getting the name wrong, so if you get to the info that os-prober returns and correct it before it gets to grub, it will be a permanent fix.

Sorry , that is messy, I am assuming you have grub2.

Regards
Neville

@nevj
I have tried some of that and when I do an update-grub, the os-prober still only finds
W10, W8.1 is also being named W10, they will both boot, but one has to guess, which
one is which, just really do not care to run a bash script.
I think, for now, and since this old machine is having issues with W10, I will use W8.1
as my boot drive and use EasyBCD to write my other boot entries. I have taken Linux
Mint from a hard install to a VirtualBox install. I know W8.1 becomes unsupported in January of 2023, maybe then I can find a Linux that still supports Grub Customizer.

Yes I cant see how to stop os-prober making the mistake.
Only way is to intercept its output with a script

Do you really need this edit?
Does the grub menu not list Win10 on sdb and Win10 on sdc ?
Cant you tell from that?

Neville

@nevj

Never said XP or W8.1 would not boot, just had to chose the right grub entry. I am sure if I installed Linux on the same drive as XP, that grub and or os-prober would detect XP. Just wonder if W8.1 would be detcted as W10, when it gets plugged in? I think I will try PCLinuxOS, other Debian, what would suggest.

I dont think the distro that controls grub will make much difference… unless it has a different version of os-prober. It is os-prober that is making the mistake.

Does os-prober have a config file? I will look.

Good news. Recovered my disk contents. Clonezilla worked well.

I would just live with it. I have 3 copies of void in one computer at moment, and I can tell them apart in the grub menu.

Neville

@4dandl4 ,
Have you looked at Super Grub2 CD ?
It might allow you to edit menu… not sure

Neville

Use GRUB CUSTOMIZER…

This issue inspired me to look into configuring GRUB2 on Linux, preferably over a C API.

My results so far are, that there is no C API or at least none that can be used without issues. I couldn’t find one that is as available as what else Linux offers as a C API to non-kernel developers.

It seems to me like the configuration of GRUB2 must be a huge pain in the ass, where you have to manually deal with old-fashioned configuration files only.

However, even when giving up on looking for a C API, I cannot find much information on how all the GRUB2 configuration files work. All the information just talks about how to change boot order manually. That’s it.

Can anyone point me to official documentation or at least a complete guide, covering all the GRUB2 configuration files? This would help me understand how to configure it.

It’s also not understandable to me, how everyone on the internet (many here, as well), just throws out the Grub Customizer buzzword, every time GRUB/2 is mentioned.

I mean we are used to Linux offering several solutions to one problem. That’s part of the FOSS philosophy. Suddenly, when it comes to GRUB/2, people always only recommend this one tool. Why?

Finally, I had to use this tool pretty often in my life and the results are mediocre. When it worked, it worked fine. Not great, but good enough.

However, too often I couldn’t even get this damn thing to install. And I wasn’t trying on some fringe rare distribution, I was trying it on Debian. Still, did not work at the time.
Seems like on Ubuntu, you are “lucky” to have it work pretty much always, but if you dare to customise your GRUB2 on another distribution, you may already be locked out of the easy Grub Customizer based solution.

All that said, there is hope. NixOS has huge configuration capabilities. I can imagine that it’s possible to natively configure GRUB2 within the Nix space.

Some Hints:
https://nixos.wiki/wiki/GNU_GRUB
https://nixos.wiki/wiki/Bootloader#FAQ

The official grub2 doc is here

It is not very helpful with configuration. That is because grub2 is considered to be self-configuring. Most of the time it self configures happily.

When it fails you have to deal with the files in /etc/grub.d. I have only had to do this once … Solus put its vmlinuz in a place that grub did not look at, so grub put a Solus entry in the grub menu but would not boot from it. I had to write a custom config file. It was quite easy to do, but there were no guiding documents … you just had to work it out by looking at the standard config files. They are just scripts

The big change that threw everyone was from legacy grub to grub 2. Legacy grub just had a single config file that the user could easily edit. Grub2 works entirely differently … it writes the config file ( which is in /boot/grub) itself every time you do an update-grub. To change the way it writes the config file you have to deal with the various scripts in /etc/grub.d, you dont edit the config file directly… or if you do it will be overwritten next time you do update-grub.

That is about all I know that might help. The documentation IS poor. The internet is full of a confusion of recipes for particular cases, but is very short on any explanations that might help us understand how it works. Hence your question.

Cheers
Neville

1 Like

@TypeHrishi
As I have stated it will not install on Linux Mint UNA 20.03!!!

Just proves on how screwed-up-convoluted Linux can be, distros galore, and none are in sync!!!
All I wanted was to use a Linux boot drive, and have it detect, my two Windows drives, XP and W8.1. Yes, it did that, but only after, I played The Price Is Right, and opened door #1 or #2. So, if Grub Customizer doesn’t work with Linux Mint, is there a distro it will. I believe it worked with Gentoo, but Gentoo has way more baggage than I care to deal with.

1 Like

Well, grub isnt Linux, it is GNU. I know what you meant… all FOSS software comes with no warranty.

Before you use grub-customizer, read this

It screws up your grub config files… permanently. You cant even remove the screwup by uninstalling grub-customiser… it is a one way ticket to disaster.

Learn how to do it by hand, then you are in control

Neville

That is not recommended.
Grub customiser messes up your grub config files, permanently. You cant even remove the mess by uninstalling grub-customiser.
It is very poorly designed software. Do not use it.
Neville

1 Like

Interesting. When I searched for the documentation, the GNU page told me, there is only 3rd party voluntary documentation for it. Or I’m just confusing one with the other, not sure.

Could you point to witness reports or other additional sources regarding that issue?