Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I need to delete older kernels from a server to make room for updating to a new one. I can't really use GUI-based methods like synaptic, and apt-get remove --purge didn't work.

What to do?

share|improve this question
3  
What do you mean by “apt-get remove --purge didn't work”? What command did you run, what happened? Be sure to copy-paste the command and any error message. –  Gilles May 16 '12 at 20:08
    
Can i know if your GUI is not at all working??(meaning you cant use my solution of an alternate gui tool) or is it that you are not able to use GUI tools like synaptic?? –  Nirmik May 17 '12 at 6:27

5 Answers 5

This Article details for remove old kernel linux http://www.ibotme.com/knowledgebase/linux-existe-alguna-manera-de-ocultar-o-eliminar-las-versiones-anteriores-de-kernel/

share|improve this answer
    
Welcome to Ask Ubuntu! Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference. –  fossfreedom May 16 '12 at 20:16

It's very strange. The command "apt-get --purge remove" is incorrect. I find this guide:

http://www.liberiangeek.net/2011/11/remove-old-kernels-in-ubuntu-11-10-oneiric-ocelot/

Follow this guide. I try it on my laptop.

I find this guide also:

http://tuxtweaks.com/2009/12/remove-old-kernels-in-ubuntu/

Bye.

share|improve this answer
2  
apt-get --purge remove isn't incorrect (it's more or less deprecated in favor of apt-get purge, but still accepted in 12.04). Apart from this, please post actual information in your answer, not just a link. See How to answer. –  Gilles May 16 '12 at 20:03
    
Also, in instances where you're running apt-get autoremove, the only way to make it purge instead of remove packages is apt-get --purge autoremove. There is no autopurge. –  Eliah Kagan May 17 '12 at 22:08

Create a shell script with this content:

#!/bin/sh
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

This script will remove old kernels, headers and sources.

share|improve this answer

Download and install either of these from software center:

  • Janitor

  • Ubuntu Tweak(it has the janitor built in it)

Open Janitor(direct janitor or tweak), you will find "Old Kernel Packages" under "System". Tick mark on it and click 'Clean'

Enter the password and the old ones will be removed

share|improve this answer

Did you try to run

apt-get --purge autoremove

? That does the trick for me.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.