LinuxQuestions.org
Help answer threads with 0 replies.
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-07-2008, 11:39 AM   #1
Sunfist
Member
 
Registered: Jun 2007
Location: Washington
Distribution: Ubuntu 12.04
Posts: 37

Rep: Reputation: 15
Grub Question


As the kernel keeps getting updated will grub just keep adding more and more entries to the boot menu? Can I edit the menu.lst and just delete the older ones without hurting anything?
 
Old 06-07-2008, 11:49 AM   #2
Larry Webb
LQ Veteran
 
Registered: Jul 2006
Location: Crystal Beach, Texas
Distribution: Suse for mail +
Posts: 5,100
Blog Entries: 7

Rep: Reputation: 229Reputation: 229Reputation: 229
Yes you can edit your menu.lst but why?
 
Old 06-07-2008, 11:52 AM   #3
John-in-France
Member
 
Registered: Jun 2006
Posts: 65

Rep: Reputation: 15
I'm more used to Fedora but I suspect Ubuntu uses much the same approach. Normally the automatic additions to Grub are limited to the new version and the version it is replacing. Older stanzas are automatically removed.

As to editing the file (\boot\grub\menu.lst or \boot\grub\grub.conf (depending on distro)), "root" can always do that but here, the caveat is "handle with care". If you really try you can end up with an un-bootable system and whilst recreating menu.lst or in a really bad case re-installing grub are both fairly straightforward, neither is really something you want to have to do on a weekly basis.

John
 
Old 06-07-2008, 04:05 PM   #4
Junior Hacker
Senior Member
 
Registered: Jan 2005
Location: North America
Distribution: Debian testing Mandriva Ubuntu
Posts: 2,687

Rep: Reputation: 61
Quote:
Originally Posted by Sunfist View Post
As the kernel keeps getting updated will grub just keep adding more and more entries to the boot menu? Can I edit the menu.lst and just delete the older ones without hurting anything?
In Debian, (same as Ubuntu), when I update a kernel with an extra-version like 2.6.23-1 to 2.6.23-2 (example), there will still only be one entry for that OS in the grub menu, because there's still only one kernel. But if I update to a newer version kernel like 2.6.23-2 to 2.6.24-1 (example again), then there will be an entry for both kernels as they are two different kernels.
If I decide I'll never boot with the older kernel again as is usually the case, I remove the older linux-kernel-image, headers, and linux-kbuild via the package manager like apt or synaptic, and the grub menu.lst will automatically be updated to reflect the changes.

There's no need to edit the grub menu.lst if you don't want to use the older kernel, just remove this kernel that you don't want, and keep your system lean to prevent eventual bloating. You can always re-install it later if you decide you want it back.
 
Old 06-07-2008, 04:28 PM   #5
alan_ri
Senior Member
 
Registered: Dec 2007
Location: Croatia
Distribution: Debian GNU/Linux
Posts: 1,733
Blog Entries: 5

Rep: Reputation: 127Reputation: 127
You can delete any entry that you want but usually it's a good idea to have at least two kernels on your system.So the best solution would be to limit the number of kernels that will be shown in the grub boot menu.To do so edit /boot/grub/menu.lst (gksu gedit /boot/grub/menu.lst), find "#howmany=all" and change it to "#howmany=2",save the file and then run "sudo update-grub".Then you will see only newest two kernels.You can then delete older kernels if you like.
 
Old 06-07-2008, 05:07 PM   #6
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,063

Rep: Reputation: 381Reputation: 381Reputation: 381Reputation: 381
Quote:
Originally Posted by John-in-France View Post
I'm more used to Fedora but I suspect Ubuntu uses much the same approach. Normally the automatic additions to Grub are limited to the new version and the version it is replacing. Older stanzas are automatically removed.

As to editing the file (\boot\grub\menu.lst or \boot\grub\grub.conf (depending on distro)), "root" can always do that but here, the caveat is "handle with care". If you really try you can end up with an un-bootable system and whilst recreating menu.lst or in a really bad case re-installing grub are both fairly straightforward, neither is really something you want to have to do on a weekly basis.

John
The synxtax of menu.lst/grub.conf is really simple and straightforward.

I can hardly imagine how anyone with a minimal common sense could render unbootable a system by just removing one old kernel from the list (unless the only remaining kernel is a self-compiled and untested kernel, of course).

Besides that, if you screw up your config, reinstalling grub to the mbr is not going to help at all. And, anyway, as long as grub is on the mbr and you have a kernel on your disk, the system is bootable, because grub, unlike lilo, permits manual operation at boot time, so you can edit your kernel lines and boot any kernel that you have on your hard drive, as long as it's into one of the filesystems that grub can read from. You even have a shell-like feeling and tab autocompletion, even an elephant could find a kernel to boot from that way.

Sample grub.conf:

Code:
title foo-2.5.22
  root (hd0,5)
  kernel /foo-2.5.22 root=/dev/hda1

title foo-2.5.23
  root (hd0,5)
  kernel /foo-2.5.23 root=/dev/hda1

title foo-2.5.24
  root (hd0,5)
  kernel /foo-2.5.24 root=/dev/hda1

title foo-2.5.25
  root (hd0,5)
  kernel /foo-2.5.25 root=/dev/hda1
I think that's evident enough what to do if we want to remove 2.5.22 from the boot menu. The sections might be a bit complexer, but that's completely besides the point.

Last edited by i92guboj; 06-07-2008 at 05:09 PM.
 
Old 06-08-2008, 11:44 AM   #7
Duck2006
Member
 
Registered: Sep 2006
Distribution: Ubuntu 8.04 Hardy Heron LST
Posts: 346

Rep: Reputation: 33
In ubuntu go to Synaptic Package Manager and load startup manager, you can clean up your menu.lat from there.
 
  


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
Two things: (Probably Simple) Grub question, and a gDesklets question Wilffo Linux - Software 3 05-20-2006 02:33 PM
Not your regular GRUB question - just a short question for a fried MBR!! ziphem Linux - General 3 01-31-2005 02:51 PM
GRUB Question LinuxGeek Linux - General 5 12-31-2004 06:39 PM
GRUB Question dave_starsky Linux - General 2 11-24-2003 08:07 AM
Grub question lynch Linux - General 1 10-27-2002 05:23 AM


All times are GMT -5. The time now is 06:31 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration