3

I am wondering if there is a way of delete non-used package without using Ubuntu tweaks.
And if there is a way of deleting old kernels.

4
  • @TrailRider Thanks Trail, I can't find a way of accepting your answer. I read the Help center sections but it doesn't appear the chekmark. Weird.
    – user242647
    Feb 2, 2014 at 2:27
  • @TrailRider I bet it is going to be better to ask the other half in other post.
    – user242647
    Feb 2, 2014 at 2:30
  • And I would like to get some points to support the community. They say they will give you points for accepting an answer.
    – user242647
    Feb 2, 2014 at 2:36
  • Normally sudo apt-get autoremove will propose to remove kernels (at least on 13.04 and newer) and unused packages. Also, sudo apt-get autoclean will remove the .deb still in cache, installed or not.
    – MrVaykadji
    Feb 2, 2014 at 2:38

1 Answer 1

2
sudo apt-get autoremove 

will search for and then prompt "y or n" if you wish to remove unneeded packages; the same thing as Ubuntu Tweak's remove unused packages does

As far as the second half of your question:

If there is a similar way to remove older kernels, I'm unaware of it, the only way I know of is to remove them(and their headers, if present) for each old kernel with either the Software Center or Synaptic...

I personally find Synaptic easier to use if needing to remove something as the "Mark for complete removal" will also remove the configuration files as well and it gives more detailed info about the package, making it easier to check that it is the correct file if you are unsure of the exact name. Conversely, I find the Software Center more useful for browsing programs and in general for installing.

Synaptic is not installed by default any longer (since 11.10) but can still be installed via the Software Center or by the terminal with

sudo apt-get install synaptic 

....of course you can remove them with sudo apt-get -purge linux-image-generic-XXX but that will get tedious very quickly if you have many to remove.

No matter how you remove kernels I would sudo update-grub after...(this should not be needed if you use Ubuntu Tweak, I believe that it does this as part of the cleaning, but I always do it manually anyways after Ubuntu tweak is done)


Edit:

according to a comment by MrVaykadji in 13.04 and newer, sudo apt-get autoremove will prompt for removal of older kernels. I don't believe that this is true in 12.04, however, I use Ubuntu Tweak's "janitor" feature often enough that 12.04 may do it but I have never waited long enough for it to trigger....at on time I had a decent number of older kernels after a long pause between Ubuntu Tweak runs and with 4(or so) older kernels, autoremove did not trigger.

7
  • etc/kernel (in 13.10) has some useful stuff related to autoremove.
    – user25656
    Feb 2, 2014 at 4:48
  • /etc/kernel/postinst.d/apt-auto-removal is worth a look.
    – user25656
    Feb 2, 2014 at 4:59
  • @vasa1 in 12.04 -ect/kernel does not have anything but the folders postrm.d and postinst.d but the "auto-removal" file you referenced does exist in 12.04, I assume you just call it with sudo /etc/kernel/postinst.d/apt-auto-removal or is there some easier way to run this script? Reading the script, it looks like it removes all but the booted kernel, the second newest and the newest kernel...please correct me if I'm wrong....it doesn't look like it calls update-grub after so I assume you still need to do that manually?
    – TrailRider
    Feb 2, 2014 at 15:38
  • Actually, I haven't gone into the mechanics of it. I've just seen that autoremove deals with older kernels. I don't even remember when that started. I've never run (or had to run) that script or update-grub either. At some point or the other, I get reminded that autoremove can remove kernels. I should mention that I use apt-get (CLI) and not the software manager or Synaptic.
    – user25656
    Feb 2, 2014 at 15:44
  • ok, then I will not add that to my answer as neither of us is sure how it works, but our comments will point anyone who wants to in the right direction....I usually use apt-get autoremove to remove unneeded packages but don't ever recall seeing it mention older kernels, I use Ubuntu Tweak or Synaptic to remove old kernels(usually UT). Thanks for your help/response....
    – TrailRider
    Feb 2, 2014 at 15:48

You must log in to answer this question.