LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu
User Name
Password
Ubuntu This forum is for the discussion of Ubuntu Linux.

Notices

Reply
 
Search this Thread
Old 11-30-2010, 04:24 PM   #16
sparker1
LQ Newbie
 
Registered: Nov 2010
Posts: 2

Rep: Reputation: 0

Thank you Totn. This was a very annoying problem for me as my grub list went over two pages. ubuntu tweak could not find these kernels nor did they show up in the package manager. Your solution worked.
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 12-28-2010, 11:11 AM   #17
tedy58
LQ Newbie
 
Registered: Sep 2007
Posts: 3

Rep: Reputation: 1
Thanks to all for this helpful topic, but especially @totn,

I did it his way, but before that I do the
$ sudo su
Enter the apssword
cd /boot
update-grub
where it gave me all previously installed kernels and so on, so I easily use firstly
remove all the unwanted staff and then rebuild the grub again and Ohhh miracle all now is clean and ordered.

Thank U m8s.
 
1 members found this post helpful.
Old 09-07-2011, 04:38 PM   #18
itismike
Member
 
Registered: Aug 2002
Location: East Coast, USA
Distribution: Ubuntu
Posts: 75

Rep: Reputation: 15
Thanks for the tips guys. I had six unneeded kernels sitting around and cleaned them up with:
Code:
$ sudo update-grub
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-2.6.32-33-server
Found initrd image: /boot/initrd.img-2.6.32-33-server
Found linux image: /boot/vmlinuz-2.6.32-32-server
Found initrd image: /boot/initrd.img-2.6.32-32-server
Found linux image: /boot/vmlinuz-2.6.32-31-server
Found initrd image: /boot/initrd.img-2.6.32-31-server
Found linux image: /boot/vmlinuz-2.6.32-30-server
Found initrd image: /boot/initrd.img-2.6.32-30-server
Found linux image: /boot/vmlinuz-2.6.32-29-server
Found initrd image: /boot/initrd.img-2.6.32-29-server
Found linux image: /boot/vmlinuz-2.6.32-28-server
Found initrd image: /boot/initrd.img-2.6.32-28-server
Found linux image: /boot/vmlinuz-2.6.32-24-server
Found initrd image: /boot/initrd.img-2.6.32-24-server
Found memtest86+ image: /boot/memtest86+.bin
done
Although this step was unnecessary, it was good to see what was currently installed.

Then identify the current version:
Code:
$ uname -a
Linux ubuntu-fog2 2.6.32-33-server #72-Ubuntu SMP Fri Jul 29 21:21:55 UTC 2011 x86_64 GNU/Linux
Note the current version: 2.6.32-33

Code:
ls -aFl
-rw-r--r--  1 root root 8507004 2011-01-31 11:38 initrd.img-2.6.32-24-server
-rw-r--r--  1 root root 8509929 2011-03-01 06:47 initrd.img-2.6.32-28-server
-rw-r--r--  1 root root 8510166 2011-03-02 06:32 initrd.img-2.6.32-29-server
-rw-r--r--  1 root root 8509649 2011-03-18 06:56 initrd.img-2.6.32-30-server
-rw-r--r--  1 root root 8507911 2011-04-29 16:52 initrd.img-2.6.32-31-server
-rw-r--r--  1 root root 8506423 2011-05-30 06:44 initrd.img-2.6.32-32-server
-rw-r--r--  1 root root 8540373 2011-08-22 16:12 initrd.img-2.6.32-33-server
...
Note versions range between 32-24 and 32-32

plus there was an entry for each for:
abi
config
initrd.img
System.map
vmcoreinfo
and vmlinuz


To delete all kernels and associated code I issued the following commands (type carefully!):
Code:
$ sudo rm *2.6.32-2*
$ sudo rm *2.6.32-3[0,1,2]*
Then cleaned up grub:
Code:
$ sudo update-grub
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-2.6.32-33-server
Found initrd image: /boot/initrd.img-2.6.32-33-server
Found memtest86+ image: /boot/memtest86+.bin
done
$
 
Old 09-10-2011, 11:47 AM   #19
oneillkza
LQ Newbie
 
Registered: Sep 2011
Distribution: Ubuntu (yes I got lazy)
Posts: 1

Rep: Reputation: Disabled
@itismike I would not choose to do it that way myself. The problem is that, while you may (or may not) have gotten everything deleted for each kernel, apt will not know that you have done so. So your system will have packages which apt thinks are installed (the old kernels) but which are actually in a broken state.

It may not matter too much, since they're old kernels which may not get touched in the future anyway, but it may cause problems, say, when you upgrade the distribution, and it tries to clean them up itself.

It would be much better to use apt to remove each kernel's package (as per the first few posts), so apt and the state of the system are in agreement. I would trust the scripts Canonical or the Debian team have written to clean the kernels up more thoroughly than if you did it by hand. It's also less work and less dangerous.
 
Old 02-16-2012, 01:24 PM   #20
linuso
LQ Newbie
 
Registered: Feb 2012
Posts: 1

Rep: Reputation: Disabled
removing old versions of Ubuntu kernels{solved}2012

see method here
Google tuxtweaks.com/2010/10/remove-old-kernels-in-ubuntu-with-one-command/

and the line of code is

dpkg -l linux-* | awk '/^ii/{ print $2}' | grep -v -e `uname -r | cut -f1,2 -d"-"` | grep -e [0-9] | xargs sudo apt-get -y purge

tested on 64bit and working
 
Old 01-20-2013, 01:57 AM   #21
AOINEKO
LQ Newbie
 
Registered: Oct 2012
Posts: 1

Rep: Reputation: Disabled
Quote:
Originally Posted by linuso View Post
see method here
Google tuxtweaks.com/2010/10/remove-old-kernels-in-ubuntu-with-one-command/

and the line of code is

dpkg -l linux-* | awk '/^ii/{ print $2}' | grep -v -e `uname -r | cut -f1,2 -d"-"` | grep -e [0-9] | xargs sudo apt-get -y purge

tested on 64bit and working
careful, this command will uninstall "linux-libc-dev" if you have it installed, this modified version solves that:

dpkg -l linux-* | awk '/^ii/{ print $2}' | grep -v -e `uname -r | cut -f1,2 -d"-"` | grep -e [0-9] | grep -v lib | xargs sudo apt-get -y purge
 
  


Reply

Tags
grub, grub2, hardy, kernels, old, remove, ubuntu


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
GLIB - two versions. how to remove oldest? zivs Linux - Newbie 4 06-18-2006 01:09 PM
gcc versions compatibility with kernel versions.. mahesh_manthapuri Suse/Novell 1 03-22-2006 12:28 AM
LXer: Updating Ubuntu 5.10 for Current Versions of OpenOffice and FireFox LXer Syndicated Linux News 0 02-06-2006 01:46 PM
2 versions installed, can't remove either JimBass Fedora 7 01-28-2005 06:08 PM
Help to remove Ubuntu philip41 Linux - Hardware 3 01-13-2005 05:08 PM


All times are GMT -5. The time now is 02:08 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration