LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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


Reply
  Search this Thread
Old 06-06-2010, 01:57 PM   #1
seamuscristo
LQ Newbie
 
Registered: Jun 2010
Posts: 7

Rep: Reputation: 0
Question 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-
 
Old 06-06-2010, 02:10 PM   #2
brianL
LQ 5k Club
 
Registered: Jan 2006
Location: Oldham, Lancs, England
Distribution: Slackware64 15; Slackware64-current (VM); Debian 12 (VM)
Posts: 8,290
Blog Entries: 61

Rep: Reputation: Disabled
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.
 
Old 06-06-2010, 02:25 PM   #3
lugoteehalt
Senior Member
 
Registered: Sep 2003
Location: UK
Distribution: Debian
Posts: 1,215
Blog Entries: 2

Rep: Reputation: 49
Quote:
Originally Posted by seamuscristo View Post
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-
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 .
 
Old 06-06-2010, 02:27 PM   #4
Bratmon
Member
 
Registered: Jul 2009
Location: 75.126.162.205:80
Distribution: Arch / Mint 17
Posts: 297
Blog Entries: 3

Rep: Reputation: 50
Read this:
https://help.ubuntu.com/community/Grub2
 
Old 06-06-2010, 02:45 PM   #5
brianL
LQ 5k Club
 
Registered: Jan 2006
Location: Oldham, Lancs, England
Distribution: Slackware64 15; Slackware64-current (VM); Debian 12 (VM)
Posts: 8,290
Blog Entries: 61

Rep: Reputation: Disabled
Ah, sorry, I was thinking of the old /boot/grub/menu.lst. Ignore my advice.
 
Old 06-06-2010, 02:46 PM   #6
satwien
LQ Newbie
 
Registered: May 2010
Distribution: Ubuntu Lucid Desktop AMD64
Posts: 1

Rep: Reputation: 0
Quote:
Originally Posted by seamuscristo View Post
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-
That's not a good idea ... have a look here: http://www.dedoimedo.com/computers/grub-2.html
 
Old 06-06-2010, 05:20 PM   #7
seamuscristo
LQ Newbie
 
Registered: Jun 2010
Posts: 7

Original Poster
Rep: Reputation: 0
I'm glad I asked.

Thanks for the links Bratmon and Satwien- they have proven to be very useful.
 
Old 06-06-2010, 05:29 PM   #8
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 113Reputation: 113
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.
 
Old 06-06-2010, 06:37 PM   #9
Bratmon
Member
 
Registered: Jul 2009
Location: 75.126.162.205:80
Distribution: Arch / Mint 17
Posts: 297
Blog Entries: 3

Rep: Reputation: 50
Quote:
Originally Posted by saikee View Post
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?
 
Old 06-06-2010, 07:30 PM   #10
RockDoctor
Senior Member
 
Registered: Nov 2003
Location: Minnesota, US
Distribution: Fedora, Ubuntu, Manjaro
Posts: 1,791

Rep: Reputation: 427Reputation: 427Reputation: 427Reputation: 427Reputation: 427
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.
 
Old 06-07-2010, 01:50 AM   #11
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,348

Rep: Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749
FYI: in some distros eg RHEL derived, menu.lst is a symlink to grub.conf...
 
Old 06-07-2010, 01:13 PM   #12
brucehinrichs
Member
 
Registered: Mar 2008
Location: US
Distribution: Debian Sid; Sabayon, UbuntuStudio, Slackware-multilib 13.1, Peppermint Ice, CentOS
Posts: 575

Rep: Reputation: 69
Quote:
FYI: in some distros eg RHEL derived, menu.lst is a symlink to grub.conf...
This is true of sabayon as well.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to edit file and make read/write / on "repair filesystem" mode? tovohery Linux - General 5 02-18-2008 01:39 AM
Edit "read-only" /etc/fstab from "System Recovery#" (without boot cd?) charlweed Linux - General 1 12-31-2006 05:57 PM
"fc5" mount does not recognize "smbfs" file system? bdplays Linux - Networking 6 06-28-2006 11:21 AM
find, edit and save "startup" file chaoticanuck Linux - Newbie 2 12-19-2002 10:56 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:43 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration