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?
SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
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.
Sometimes the only way things ever got fixed is because people became uncomfortable.
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.
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.