WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: need to change menu title on grub2  (Read 1054 times)

Offline ejames82

  • Full Member
  • ***
  • Posts: 183
need to change menu title on grub2
« on: October 19, 2015, 03:51:01 AM »
hello,


to be fair, I am letting it be known beforehand that I am posting this on other quality forums as well.  I hope I don't offend anyone and I will share all helpful info.


the problem:

need to change menu title on grub2.  to change this, I am supposed to edit the /etc/grub.d/30_os-prober file.  I can edit the /etc/grub.d/30_os-prober file, but as soon as I update grub and reboot, grub2 still shows Microsoft Windows XP Professional (on /dev/sda1)    my edit to the /etc/grub.d/30_os-prober file does not change, (it appears to be permanently saved, even after rebooting and updating grub2), yet it doesn't show on grub2 menu at boot.  anyone with suggestions or advice would be most appreciated.  could I have a permissions issue, how would I check/verify?

from the beginning:
when the computer boots up, first I get the bios splash screen, then I get the first grub screen.  listed among the entries is this:
Microsoft Windows XP Professional (on /dev/sda1)

I would rather have it say this:
choose between XP Professional and tinycore
below are highly regarded tutorials that show how to do it:
http://ubuntuforums.org/showthread.php?t=1287602
http://ubuntu-install.blogspot.com/2009/11/grub2-title-tweaks.html

both of these tutorials say the same thing.
1. Run this command to get the current Grub 2 menu entries:
sudo cat /boot/grub/grub.cfg | grep "menuentry" | cut -d '"' -f 2
2. This section appears around line 150 of the file.
3. Copy the exact title you wish to change (Example: Microsoft Windows XP Home Edition ) and place it between the quotes in the first line below. Note the title does not include the portion "(on /dev/sdXX)"
Enter the desired title between the quotes in the second line below - in this example, "Windows XP" would replace "Enter Desired New Title Here".
--------------------------------------------------------------------------------------------------------------------------
# if [ -z "${LONGNAME}" ] ; then
#    LONGNAME="${LABEL}"
# fi

  if [ "${LONGNAME}" = "Enter Exact Title You Just Copied" ] ; then
    LONGNAME="Enter Desired New Title Here"
  elif [ -z "${LONGNAME}" ] ; then
    LONGNAME="${LABEL}"
  fi

-----------------------------------------------------------------------------------------------------------------


here is what I did.  it is the exact edit in the 30_os-prober file:

-----------------------------------------------------------------------------------------------------------------

#  if [ -z "${LONGNAME}" ] ; then
#    LONGNAME="${LABEL}"
#  fi


if [ "${LONGNAME}" = "Microsoft Windows XP Professional (on /dev/sda1)" ] ; then
  LONGNAME="choose between xp pro and tinycore"
elif [ -z "${LONGNAME}" ] ; then
  LONGNAME="${LABEL}"
fi


-----------------------------------------------------------------------------------------------------------------------

I have looked it over a dozen times.  I can't see where I have done anything wrong.  it appears to be correct.

there is more to the story, but I didn't think it was relevant and I didn't want to clutter the thread.  here is a link:
http://reboot.pro/topic/20752-noobie-need-to-change-title-on-grub2-also-using-grub4dos-hd/

thank you

backup...backup...backup

Online Rich

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 6726
Re: need to change menu title on grub2
« Reply #1 on: October 19, 2015, 06:10:30 AM »
Hi ejames82
I don't know anything about grub2, but this doesn't look right:
Code: [Select]
if [ "${LONGNAME}" = "Microsoft Windows XP Professional (on /dev/sda1)" ] ; thenI would expect another equal sign in there like this:
Code: [Select]
if [ "${LONGNAME}" == "Microsoft Windows XP Professional (on /dev/sda1)" ] ; thenThe first one sets  LONGNAME  equal to a string, the second compares  LONGNAME  to a string.

Offline nitram

  • Hero Member
  • *****
  • Posts: 1052
Re: need to change menu title on grub2
« Reply #2 on: October 19, 2015, 01:38:19 PM »
The linked guides are ~5 years old, maybe something changed. Grub2 re-writes after update-grub are infuriating. This issue was non-existent in old Grub.

Grub2 boot screen is an obvious *choice list*, why do you require it to say 'choose between XP Professional and tinycore'?

Personally i wouldn't bother and would just look at one of these hacks:

- Revert to original Grub, works well, more customizable

-  Increase or disable the timeout period to give a new user time to review the Grub2 boot screen before selection

- /boot/grub/grub.cfg can be edited directly from 'Microsoft Windows XP Professional (on /dev/sda1)' to 'Choose this for WindowsXP' or similar, as long as you make a quick backup of grub.cfg so you can restore this entry again after an update-grub has been run

- etc > grub.d > 40_custom entries aren't over-written with update-grub, just copy your customized WindowsXP entry here