May I edit the file "grub.cfg" without causing harm to my system?
I am brand new- and sorry to say rather poor at searching the forums for an answer to my first question. Having come up short on a way to clean up my grub menu, I started digging until I found the file "grub.cfg" which appears to list the instances of Linux available for me to boot.
Before I delete lines in the file such as: } menuentry "blah blah Ubuntu number.number-22" { ... etc I want to know if it's ok. I have updated Ubuntu twice since starting it up, and was surprised to find more options in GRUB each time. Secondarily, I would like to know which program to use when editing this file (if it is the file I want to edit). Before switching to Linux I was in the process of learning UNIX for a web company, and Learning to use the VI for my own regex interests. I'm a little sad to find that VIM is not equipped with the same commands (thank god for :q!) and would seek the advice of seasoned users in the matter of editing files. In case you can't guess, I am extremely new and excited to be working with Linux and to be posting a thread on a forum. Advance thanks for your assistance- |
If you're referring to entries for old kernels, and if you're certain that the latest kernel is working OK, then yes, you can delete the old entries.
|
Quote:
It wants you to edit /etc/default/grub instead. It says at the top to then run grub-update or something. From the sound of it the grub menu is accurate. If you want to get rid of old kernels then uninstall them and then presumably run grub-update or whatever it is called and that will tidy up the Grub menu for you Vim has all the commands of Vi and then some. It is well worth while to do the tutorial, /usr/share/vim/vim71/tutor/README.txt . |
Read this:
https://help.ubuntu.com/community/Grub2 |
Ah, sorry, I was thinking of the old /boot/grub/menu.lst. Ignore my advice.
|
Quote:
|
I'm glad I asked.
Thanks for the links Bratmon and Satwien- they have proven to be very useful. |
I normally edit it anyway I want, be it grub.cfg or menu.lst.
If you are nervous just put a # in front of the line you want to disable. Grub2 doesn't need grub.cfg to function and it gives you a Grub prompt if the configuration file is missing or totally trashed. I haven't found an installed OS that cannot be booted by manually by a Grub prompt. grub.cfg contains just the manual commands one would otherwise use manually. |
Quote:
|
What I do instead of changing my grub.conf file is point it at /vmlinuz and /initrd in the root partition of my distro. I manually run a little script that resets /vmlinuz and /initrd to point to the appropriate files in my distro's /boot directory, and sets up links /vmlinuz.old and /initrd.old to point to the old kernel's files. If the new kernel fails to boot, I just manually edit the kernel and initrd lines in grub.conf during the boot process to point to /vmlinuz.old and /initrd.old. Somewhat cumbersome, but it works for me.
|
FYI: in some distros eg RHEL derived, menu.lst is a symlink to grub.conf...
|
Quote:
|
All times are GMT -5. The time now is 01:59 AM. |