[SOLVED] May I edit the file "grub.cfg" without causing harm to my system?
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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-
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-
Not used to Grub 2 a lot but it says in big letters at the top of the file you mention DO NOT EDIT. Best possibly to take it at its word if you are new.
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 .
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.
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-
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.
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.
So you change it manually every time you update your kernel?
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.