LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-19-2015, 05:05 AM   #1
ejames82
Member
 
Registered: Jun 2009
Posts: 100

Rep: Reputation: 15
need to change menu title on grub2


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/2...le-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...g-grub4dos-hd/

thank you
 
Old 10-19-2015, 06:13 AM   #2
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,438

Rep: Reputation: 2842Reputation: 2842Reputation: 2842Reputation: 2842Reputation: 2842Reputation: 2842Reputation: 2842Reputation: 2842Reputation: 2842Reputation: 2842Reputation: 2842
So i guess this seems obvious, but did you run grub-mkconfig after these changes?
 
Old 10-19-2015, 06:39 AM   #3
ejames82
Member
 
Registered: Jun 2009
Posts: 100

Original Poster
Rep: Reputation: 15
hello grail,

I have never heard of such a thing, so the answer is no.
thanks for the reply, and I will let you know if it works.
 
Old 10-19-2015, 10:44 AM   #4
Tonus
Member
 
Registered: Jan 2007
Location: Paris, France
Distribution: Slackware-current with grub2
Posts: 387
Blog Entries: 3

Rep: Reputation: 100Reputation: 100
need to change menu title on grub2

Usually it would need to specify the target with -o :

grub-mkconfig -o /boot/grub/grub.cfg
 
Old 10-19-2015, 07:10 PM   #5
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,020

Rep: Reputation: 2455Reputation: 2455Reputation: 2455Reputation: 2455Reputation: 2455Reputation: 2455Reputation: 2455Reputation: 2455Reputation: 2455Reputation: 2455Reputation: 2455
all "/etc/grub.d/30_os-prober" dose is tell " grub-mkconfig " HOW to make the " /boot/grub/grub.cfg " file

after you edit 30_os-prober you still have to make a NEW grub.cfg that reflects the changes you made


yes you mixed the "Browne" mix and put it in a baking dish BUT you did not put it in a hot oven to cook
 
Old 10-20-2015, 06:12 PM   #6
tomwest
Member
 
Registered: Aug 2013
Posts: 57

Rep: Reputation: Disabled
Quote:
Usually it would need to specify the target with -o :

grub-mkconfig -o /boot/grub/grub.cfg
Yes, but the grub needs to be grub2, thus:
Code:
grub2-mkconfig -o /boot/grub2/grub.cfg
And this is for an MBR BIOS, not EFI.
 
Old 10-20-2015, 06:45 PM   #7
berndbausch
Senior Member
 
Registered: Nov 2013
Location: Tokyo
Distribution: Redhat/Centos, Ubuntu, Raspbian, Fedora
Posts: 1,689

Rep: Reputation: 353Reputation: 353Reputation: 353Reputation: 353
Quote:
Originally Posted by tomwest View Post
Yes, but the grub needs to be grub2
Depends on the distro. I have seen Centos with grub2, Ubuntu with grub.
 
Old 10-20-2015, 09:00 PM   #8
colorpurple21859
Senior Member
 
Registered: Jan 2008
Location: florida
Distribution: slackware64-current, puppy, ubuntu
Posts: 1,967

Rep: Reputation: 274Reputation: 274Reputation: 274
Change this
Code:
if [ "${LONGNAME}" = "Microsoft Windows XP Professional (on /dev/sda1)" ] ; then
to
Code:
if [ "${LONGNAME}" = "Microsoft Windows XP Professional" ] ; then
to get rid of (on /dev/sda1), in the section that looks like this
Code:
found_other_os=1
	  onstr="$(gettext_printf "(on s)" "${DEVICE}")"
      cat << EOF
menuentry '$(echo "${LONGNAME} $onstr" | grub_quote)' --class windows --class os \$menuentry_id_option 'osprober-chain-$(grub_get_device_id "${DEVICE}")' {
EOF
change
Code:
onstr="$(gettext_printf "(on %s)" "${DEVICE}")"
to
Code:
onstr="$(gettext_printf "")"

Last edited by colorpurple21859; 10-20-2015 at 10:02 PM.
 
Old 10-21-2015, 12:38 AM   #9
ondoho
Senior Member
 
Registered: Dec 2013
Posts: 4,905

Rep: Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077
...in addition to what all others said,
Code:
# 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
the logic is wrong. you're checking LONGNAME for the "microsoft windows..." string before it has been assigned to LONGNAME.
really it should look like this:
Code:
if [ -z "${LONGNAME}" ] ; then
LONGNAME="${LABEL}"
fi

if [ "${LONGNAME}" =~ *"Microsoft Windows XP Professional"* ] ; then
LONGNAME="choose between xp pro and tinycore"
fi
(i haven't tested the bit after '=~'. source)
 
Old 10-22-2015, 07:07 AM   #10
Tonus
Member
 
Registered: Jan 2007
Location: Paris, France
Distribution: Slackware-current with grub2
Posts: 387
Blog Entries: 3

Rep: Reputation: 100Reputation: 100
Quote:
Originally Posted by tomwest View Post
And this is for an MBR BIOS, not EFI.
Why not? Got EFI boot here and everything works fine...
 
Old 04-25-2016, 05:57 AM   #11
ejames82
Member
 
Registered: Jun 2009
Posts: 100

Original Poster
Rep: Reputation: 15
hello,

below I have listed all of the feedback I received. two lines accross indicates a different website, and one line represents a different reply on the same website.

a special thanks to old fred for his in-depth and well-organized reply.

I have decided that my time would be better spent learning more about grub4dos than grub2. just my opinion.

I hope some person benefits from what is written here, and thanks to everybody.

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

If you don't update Grub a lot, just manually enter the title you want in grub.cfg. Yes, if you run update-grub it will revert but...

As far as the code, the if test is obviously failing - perhaps there are trailing spaces in LONGNAME? I used to write a lot of code in XBase and the "$" operator was priceless. Rather than matching a string exactly, the $ operator looked to see if the text fragment was contained within the target...

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

Best not to edit scripts, over the years the locations in different versions of grub2 change.

I prefer to copy boot stanza to 40_custom and then you can edit at will. Once you confirm it works ok, you then can turn off os-prober. If later you want to use os-prober to find a boot stanza for a new install just turn it back on.

How to: Create a Customized GRUB2 Screen that is Maintenance Free.- Cavsfan
https://help.ubuntu.com/community/Ma...tomGrub2Screen
https://help.ubuntu.com/community/Grub2/CustomMenus

One way to fix the descriptions is to move the windows entries to 40_custom and edit at will.
http://askubuntu.com/questions/65952.../659910#659910

Copy the entries from this:
sudo cp -a /boot/grub/grub.cfg /boot/grub/grub.cfg.backup
gedit /boot/grub/grub.cfg
Copy them to and edit to have only entries or descriptions you want:
gksudo gedit /etc/grub.d/40_custom
Then do:
sudo update-grub

If you want it first in grub menu make it 06_custom (do not add entries to both)

or a new file that will be first in the menu
sudo cp -a /etc/grub.d/40_custom /etc/grub.d/06_custom
sudo chmod 755 /etc/grub.d/06_custom
sudo cp -a /boot/grub/grub.cfg /boot/grub/grub.cfg.backup


In /etc/default/grub I added this line for os-prober:
sudo cp -a /boot/grub/grub.cfg /boot/grub/grub.cfg.backup
gksudo gedit /etc/default/grub
GRUB_DISABLE_OS_PROBER=true
or
sudo sed -i '$a GRUB_DISABLE_OS_PROBER=true' /etc/default/grub
or
turn off executable bit
sudo chmod a-x /etc/grub.d/30_os-prober
sudo update-grub

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

So i guess this seems obvious, but did you run grub-mkconfig after these changes?

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

hello grail,

I have never heard of such a thing, so the answer is no.
thanks for the reply, and I will let you know if it works.

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

Usually it would need to specify the target with -o :

grub-mkconfig -o /boot/grub/grub.cfg

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

all "/etc/grub.d/30_os-prober" dose is tell " grub-mkconfig " HOW to make the " /boot/grub/grub.cfg " file

after you edit 30_os-prober you still have to make a NEW grub.cfg that reflects the changes you made

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

Quote:
Usually it would need to specify the target with -o :

grub-mkconfig -o /boot/grub/grub.cfg
Yes, but the grub needs to be grub2, thus:
Code:

grub2-mkconfig -o /boot/grub2/grub.cfg

And this is for an MBR BIOS, not EFI.

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


Quote:
Originally Posted by tomwest View Post
Yes, but the grub needs to be grub2
Depends on the distro. I have seen Centos with grub2, Ubuntu with grub.

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

Change this
Code:

if [ "${LONGNAME}" = "Microsoft Windows XP Professional (on /dev/sda1)" ] ; then

to
Code:

if [ "${LONGNAME}" = "Microsoft Windows XP Professional" ] ; then

to get rid of (on /dev/sda1), in the section that looks like this
Code:

found_other_os=1
onstr="$(gettext_printf "(on s)" "${DEVICE}")"
cat << EOF
menuentry '$(echo "${LONGNAME} $onstr" | grub_quote)' --class windows --class os \$menuentry_id_option 'osprober-chain-$(grub_get_device_id "${DEVICE}")' {
EOF

change
Code:

onstr="$(gettext_printf "(on %s)" "${DEVICE}")"

to
Code:

onstr="$(gettext_printf "")"

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

...in addition to what all others said,
Code:

# 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

the logic is wrong. you're checking LONGNAME for the "microsoft windows..." string before it has been assigned to LONGNAME.
really it should look like this:
Code:

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

if [ "${LONGNAME}" =~ *"Microsoft Windows XP Professional"* ] ; then
LONGNAME="choose between xp pro and tinycore"
fi

(i haven't tested the bit after '=~'. source)

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

...in addition to what all others said,
Code:

# 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

the logic is wrong. you're checking LONGNAME for the "microsoft windows..." string before it has been assigned to LONGNAME.
really it should look like this:
Code:

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

if [ "${LONGNAME}" =~ *"Microsoft Windows XP Professional"* ] ; then
LONGNAME="choose between xp pro and tinycore"
fi

(i haven't tested the bit after '=~'. source)

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


Quote:
Originally Posted by tomwest View Post
And this is for an MBR BIOS, not EFI.
Why not? Got EFI boot here and everything works fine...

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

Quote Originally Posted by ejames82 View Post
I have looked it over a dozen times. I can't see where I have done anything wrong. it appears to be correct.
No, it is not.
You should leave out the " (on /dev/sda1)" part.

From your own quote:
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)"

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



NB we have moved to BunsenLabs forums. (The Crunchbang forums will become read-only soon). You can register there and post your questions.

In this case I think you want to edit the title at the top of the grub screen? What you are trying to do is edit the titles of the menu entries (I'm not sure exactly)

To edit the grub theme, then have a read of Grub theme elements, and look for

title-text Specifies the text to display at the top center of the screen as a title.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Terminal xterm Title is too dynamic (title doesn't change manually) ZeroDaHero Slackware 4 11-04-2012 12:16 PM
Grub2 and my old menu.lst Pedroski Linux - Software 13 10-13-2011 06:35 PM
[SOLVED] GRUB2 menu nasa_pete Linux - Newbie 3 06-12-2011 10:44 PM
GRUB2 - FreeBSD-8.0 does not show up in triple boot menu, dual boot menu it does.. wiliweld *BSD 7 05-03-2010 01:05 PM
Grub2 not reading the menu AlP36 Linux - Desktop 11 03-11-2010 06:41 PM


All times are GMT -5. The time now is 03:16 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration