• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

Editing the grub.cfg file

 
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Guys,

I have installed Ubuntu 9.10 alongside Windows 7 and I would like to know how to remove some of the menu entries that appear when I boot up the system. I tried changing the grub.cfg but it says that it is not editable even under sudo access. Please suggest me how to get this done?
 
Joe San
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is there really a way to do this?? I have around 7 entries during boot up and I need only two of them and I'm now trying to remove every other ones other than Ubuntu and Windows 7 loaders.
 
Saloon Keeper
Posts: 25646
183
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes there is. Actually, grub.cfg is one of several aliases for /boot/grub/grub.conf. Unlike LILO, you don't have to "compile" that file to make it work. Changes are seen the next time it's read (meaning when you boot up).

It's possible that you have selinux denying access for your editing. Ubuntu/Debian isn't as good about breaking out logs by product, but if there's an selinux violation, it's probably being reported in either /var/log/audit or /var/log/messages.

And, of course, you do need something like "774" for access rights to the file.
 
Joe San
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Will have to try changing the file permissions. I remember doing that but let me confirm this today again.
 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you look at the comment at the start of menu.cfg you will see that is refers to:

a) templates in directory /etc/grub.d
b) setting in file /etc/default/grub

Looking at the templates in /etc/grub.d, it appears that they are scripts which dynamically construct the Grub 2 menu based on what the scripts find. For example, the 10_linux script will find all kernel versions installed. Thus I assume that one way to remove a kernel version form the grub menu is to delete the /boot/initrd.img-* file for each entry you do not want.

I applaud the Grub developers for automating what used to be an error-prone task. I am, on the other hand, appalled by how difficult it is now to tweak the boot menu.
 
Joe San
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Peter,

Thanks for the reply. But now is there a way to edit this file to get rid of the unwanted OS menu entries during startup?
 
Joe San
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you sure by deleting "/boot/initrd.img-*", I can get rid of the unwanted OS lists that appear during boot up time?
 
Peter Johnson
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, as far as I know. If the script is looking for those files, and they are absent, then it can't very well add them to the menu, can it?

And why did you even have to ask? You could have simply renamed or moved the file and tried it out. Then the total time to get an answer to your question would have been 5 minutes instead of 5 hours. And you would have learned something that you can then impart to others. Don't be so afraid to experiment and try things - that is how you learn.
 
Joe San
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would try that today. It has been a while since I even turned my machine on. Will do that today.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic