Purging excessive kernels

Melatto

New Member
Joined
Mar 4, 2024
Messages
9
Reaction score
6
Credits
100
I was trying to update my software in Ubuntu, and kept getting a "dpkg interrupted" error. After going down the rabbit hole here and elsewhere, I think I have an excess of kernels, and I am trying to purge the unnecessary kernels so that I can successfully update my software. Can someone help me build the proper line of code in the command terminal?

This is the list of my kernels

rc linux-image-5.15.0-25-generic 5.15.0-25.25 amd64 Signed kernel image generic
rc linux-image-5.15.0-46-generic 5.15.0-46.49 amd64 Signed kernel image generic
rc linux-image-5.15.0-47-generic 5.15.0-47.51 amd64 Signed kernel image generic
rc linux-image-5.15.0-48-generic 5.15.0-48.54 amd64 Signed kernel image generic
rc linux-image-5.15.0-50-generic 5.15.0-50.56 amd64 Signed kernel image generic
rc linux-image-5.15.0-52-generic 5.15.0-52.58 amd64 Signed kernel image generic
rc linux-image-5.15.0-53-generic 5.15.0-53.59 amd64 Signed kernel image generic
rc linux-image-5.15.0-56-generic 5.15.0-56.62 amd64 Signed kernel image generic
ii linux-image-5.15.0-58-generic 5.15.0-58.64 amd64 Signed kernel image generic
rc linux-image-5.19.0-32-generic 5.19.0-32.33~22.04.1 amd64 Signed kernel image generic
rc linux-image-5.19.0-38-generic 5.19.0-38.39~22.04.1 amd64 Signed kernel image generic
rc linux-image-5.19.0-41-generic 5.19.0-41.42~22.04.1 amd64 Signed kernel image generic
rc linux-image-5.19.0-42-generic 5.19.0-42.43~22.04.1 amd64 Signed kernel image generic
ii linux-image-5.19.0-43-generic 5.19.0-43.44~22.04.1 amd64 Signed kernel image generic
rc linux-image-6.2.0-32-generic 6.2.0-32.32~22.04.1 amd64 Signed kernel image generic
rc linux-image-6.2.0-33-generic 6.2.0-33.33~22.04.1 amd64 Signed kernel image generic
rc linux-image-6.2.0-34-generic 6.2.0-34.34~22.04.1 amd64 Signed kernel image generic
rc linux-image-6.2.0-35-generic 6.2.0-35.35~22.04.1 amd64 Signed kernel image generic
ii linux-image-6.2.0-36-generic 6.2.0-36.37~22.04.1 amd64 Signed kernel image generic
ii linux-image-6.2.0-37-generic 6.2.0-37.38~22.04.1 amd64 Signed kernel image generic
ii linux-image-6.2.0-39-generic 6.2.0-39.40~22.04.1 amd64 Signed kernel image generic
ii linux-image-generic-hwe-22.04 6.2.0.39.40~22.04.16 amd64 Generic Linux kernel image
 


I ran this line

I got this message

You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
linux-generic-hwe-22.04 : Depends: linux-headers-generic-hwe-22.04 (= 6.2.0.39.40~22.04.16) but 6.2.0.37.38~22.04.15 is installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
 
Welcome to the Forum.
m0135.gif


Kernels take up a lot of space therefor I only keep the latest two...Mint Cinnamon shows you how many are installed and is easy to remove excess Kernels as shown below.
1709775034437.png

Of cause I can run this command...
Code:
   sudo apt-get autoremove
To get rid of packages that are no longer required and old Kernels.
m0117.gif

 
sorry for the delayed response all, I was working

I just ran the fix install command
it seemed to run properly

gonna reboot and try to autoremove recommendation

thank you for your help so far
 
In the future you may want to run Ubuntu Cleaner which will safely remove old kernels.
you can install it from it PPA found here.
 
In the future you may want to run Ubuntu Cleaner which will safely remove old kernels.
you can install it from it PPA found here.
is this very different than Stacer?

I know Stacer no longer gets updates
 
is this very different than Stacer?

I know Stacer no longer gets updates
There is an overlap between stacer and ubuntu-cleaner but ubuntu-cleaner will remove older kernels that are not in use, stacer will not do that. I use them both on ubuntu and it's flavors, Also they both work in Mint.
 
I really want to do a Stacer article but they stopped development...
 
In mint, all that is necessary is to open preferences in Update Manager/Automation and turn the below option ON

1710035569977.png

Works like a dream. Reliable as can be.
 
do you know if such a command exists in Ubuntu?
I have never run Ubuntu.......so I have no idea.....but seeing Linux Mint is based on Ubuntu,there is a good chance that it can be done there as well.
Other contributors here running Ubuntu will know
 
I used to use Lubuntu and all I ever needed to run to remove old kernels was

Code:
sudo apt autoremove


These commands remove any existing leftovers.
Code:
sudo apt clean

Code:
sudo apt autoclean
this is frickin awesome
like mc paul barman

thank you for these command lines
 
I used to use Lubuntu and all I ever needed to run to remove old kernels was

Code:
sudo apt autoremove


These commands remove any existing leftovers.
Code:
sudo apt clean

Code:
sudo apt autoclean
this is frickin awesome
like mc paul barman

thank you for these command lines
You are welcome. :)

Welcome to the Linux .org forum lots of knowledgeable folks here from all around the planet.
 
Last edited:
Top