Can't delete old kernels :(

Ask questions about dedicated servers here and we and other users will do our best to answer them. Please also refer to the self-help section for tutorials and answers to the most commonly asked questions.
Post Reply
Inputnamehere
A regular
A regular
Posts: 33
https://www.youtube.com/channel/UC40BgXanDqOYoVCYFDSTfHA
Joined: Sat Jul 30, 2016 7:14 pm

Can't delete old kernels :(

Post by Inputnamehere »

So I'm having problems deleting old kernels, I've tried everything, listed below.

dpkg -l | tail -n +6 | grep -E 'linux-image-[0-9]+' | grep -Fv $(uname -r)




ii linux-image-4.4.0-21-generic 4.4.0-21.37 amd64 Li

I know ii means its eligible for removal

sudo dpkg --purge linux-image-4.4.0-21-generic 4.4.0-21.37






dpkg: warning: ignoring request to remove linux-image-4.4.0-21 which isn't installed


sudo apt-get autoremove




sudo apt -f install



Code: Select all

The following packages have unmet dependencies:
 linux-image-extra-4.4.0-47-generic : Depends: linux-image-4.4.0-47-generic but it is not installed
 linux-image-generic : Depends: linux-image-4.4.0-47-generic but it is not installed
                       Recommends: thermald but it is not installed
E: Unmet dependencies. Try using -f.


sudo sudo purge-old-kernels

Code: Select all

The following packages have unmet dependencies:
 linux-image-extra-4.4.0-34-generic : Depends: linux-image-4.4.0-34-generic but it is not going to be installed
 linux-image-extra-4.4.0-38-generic : Depends: linux-image-4.4.0-38-generic but it is not going to be installed
 linux-image-extra-4.4.0-47-generic : Depends: linux-image-4.4.0-47-generic but it is not going to be installed
 linux-image-generic : Depends: linux-image-4.4.0-47-generic but it is not going to be installed
                       Recommends: thermald but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
User avatar
Edge100x
Founder
Founder
Posts: 12951
Joined: Thu Apr 18, 2002 11:04 pm
Location: Seattle
Contact:

Re: Can't delete old kernels :(

Post by Edge100x »

If you have a full /boot partition and apt-get autoremove fails, I would recommend just deleting them manually. Do this by checking for what kernel you are currently running, and deleting other ones in /boot. We talk about this more in viewtopic.php?f=44&t=14245.

If you don't have a full /boot partition, it shouldn't hurt you to have old kernels on the system that are no longer being used.
Inputnamehere
A regular
A regular
Posts: 33
Joined: Sat Jul 30, 2016 7:14 pm

Re: Can't delete old kernels :(

Post by Inputnamehere »

Manually, meaning ftp? What do you mean by full /boot?

I need the space, and I can't delete them via command line.


I have
abi
config
init.d
system.map
vmlinuz

Do I delete every old kernel from the names listed?
$atanic $pirit
This is my homepage
This is my homepage
Posts: 251
Joined: Tue Jan 28, 2014 5:32 am

Re: Can't delete old kernels :(

Post by $atanic $pirit »

Inputnamehere wrote: sudo dpkg --purge linux-image-4.4.0-21-generic 4.4.0-21.37
Try
sudo dpkg --purge linux-image-extra-4.4.0-21-generic
Linux doesn't like spaces.
Image
Inputnamehere
A regular
A regular
Posts: 33
Joined: Sat Jul 30, 2016 7:14 pm

Re: Can't delete old kernels :(

Post by Inputnamehere »

Ok, I deleted one part of the kernel and the commands now work and deleted all the old stuff :D

Thanks for the tip on spaces :P
Post Reply