File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Editing the grub.cfg file

 
Joe Harry
Ranch Hand
Posts: 10045
3
Eclipse IDE Mac PPC Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • 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 Harry
Ranch Hand
Posts: 10045
3
Eclipse IDE Mac PPC Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
Tim Holloway
Saloon Keeper
Pie
Posts: 17622
39
Android Eclipse IDE Linux
  • 0
  • Mark post as helpful
  • send pies
  • 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 Harry
Ranch Hand
Posts: 10045
3
Eclipse IDE Mac PPC Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Will have to try changing the file permissions. I remember doing that but let me confirm this today again.
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • 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 Harry
Ranch Hand
Posts: 10045
3
Eclipse IDE Mac PPC Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • 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 Harry
Ranch Hand
Posts: 10045
3
Eclipse IDE Mac PPC Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • 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
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • 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 Harry
Ranch Hand
Posts: 10045
3
Eclipse IDE Mac PPC Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic