?
Solved

Remove lines from GRUB2 menu

Posted on 2011-10-28
8
Medium Priority
?
585 Views
Last Modified: 2013-12-15
Hello experts.

There are "windows" lines on multiboot menu. See attachment.
Some my users can accidentally click on "windows restore" options, and kill the system.
(Perhaps, I myself, did hard drive reformatting once by an accident...)

I cannot hide some menu lines from display.
I cannot find grub option or config file to do this task.
How to do this?

Thank you.
question.JPG
0
Comment
Question by:Bitlab
  • 5
  • 3
8 Comments
 
LVL 31

Accepted Solution

by:
farzanj earned 2000 total points
ID: 37045633
You should simply get rid of that option.

To do so, edit file

/etc/grub.conf

or
/etc/grub/grub.conf

or
/boot/grub/grub.conf

Whichever file you find.
Then you have to look for related paragraph, that begins with the keyword title.  Just comment out or delete till the next title
0
 
LVL 31

Expert Comment

by:farzanj
ID: 37045659
Here is a sample grub file

 
itle linux
root (hd0,4)
kernel /boot/vmlinuz root=/dev/sda7 vga=791 resume=/dev/sda9
initrd /boot/initrd

title windows
rootnoverify (hd0,4)
chainloader(hd0,0)+1

Open in new window


Now suppose that you want to get rid of option 'windows'

All you need to do is to comment out or delete the following three lines

title windows
rootnoverify (hd0,4)
chainloader(hd0,0)+1
0
 
LVL 2

Author Comment

by:Bitlab
ID: 37047824
Thank you experts.

Apparently your info is outdated.

Details:

naladchik@Acerfrog:~$ less /etc/grub.conf
/etc/grub.conf: No such file or directory


naladchik@Acerfrog:~$ less /boot/grub/grub.conf
/boot/grub/grub.conf: No such file or directory


#one must not edit this:
naladchik@Acerfrog:~$ less /boot/grub/grub.cfg

#one must edit this: /etc/default/grub
#but there are the entries to delete? ....

#apparently a right way is to edit this file
#but is is meant to add not to delete entries ...
#so ... still ... how to delete?:
#!/bin/sh
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.
/etc/grub.d/40_custom (END)

#the help is here: https://help.ubuntu.com/community/Grub2



0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 31

Expert Comment

by:farzanj
ID: 37048136
Well, it was a distro issue.  The latest CentOS still has the same old way.

Did you check 40_custom?
0
 
LVL 31

Expert Comment

by:farzanj
ID: 37048159
Here is important information from you guide
Configuration changes are normally made to /etc/default/grub and to the custom files located in /etc/grub.d. Any changes made directly to the /boot/grub/grub.cfg are overwritten whenever update-grub is executed either by the user or when called automatically by various system functions.

After editing /etc/default/grub or the scripts in the /etc/grub.d folder the user should run sudo update-grub to incorporate the changes into the GRUB 2 menu.

Also do

grep -R "title" /etc/grub.d
grep -R "title" /etc/default
0
 
LVL 31

Expert Comment

by:farzanj
ID: 37048169
HERE IS WHAT YOU ARE LOOKING FOR

This is a video guide
http://www.youtube.com/watch?v=TDf_fRAophc
0
 
LVL 2

Author Comment

by:Bitlab
ID: 37091186
Thank you farzanj.

This even not close. There is nothing about removing "menu".
The closest solution is here: http://landkey.net/d/grub_os_menuitem_removal/grub/index.htm
but is still risky.

If no one knows a solution: I have to admit that Unbuntu menu is not safe and revert to
manual editing of /boot/grub/grub.cfg
0
 
LVL 2

Author Closing Comment

by:Bitlab
ID: 37240090
Thank you.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Are you looking to clear some space on your phone for the latest iOS 8 update? Did you switch to Spotify so you no longer need to keep music native on your phone? Run out of space for taking photos while in the middle of vacation? Sometimes the quic…
I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses
Course of the Month15 days, 22 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question