clean old kernels

what does apt list --installed | grep pve-kernel output? you should be able to just remove the old kernel packages.
 
what does apt list --installed | grep pve-kernel output? you should be able to just remove the old kernel packages.
Code:
root@pve:~# apt list --installed | grep pve-kernel

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

pve-kernel-5.13.19-2-pve/stable,now 5.13.19-4 amd64 [installed,automatic]
pve-kernel-5.13.19-6-pve/stable,now 5.13.19-15 amd64 [installed,automatic]
pve-kernel-5.13/stable,now 7.1-9 all [installed,automatic]
pve-kernel-5.15.30-2-pve/stable,now 5.15.30-3 amd64 [installed,automatic]
pve-kernel-5.15.35-1-pve/stable,now 5.15.35-2 amd64 [installed,automatic]
pve-kernel-5.15/stable,now 7.2-3 all [installed,automatic]
pve-kernel-5.4.124-1-pve/now 5.4.124-1 amd64 [installed,local]
pve-kernel-5.4.34-1-pve/now 5.4.34-2 amd64 [installed,local]
pve-kernel-helper/stable,now 7.2-3 all [installed]
 
Code:
pve-kernel-5.4.124-1-pve/now 5.4.124-1 amd64 [installed,local]
pve-kernel-5.4.34-1-pve/now 5.4.34-2 amd64 [installed,local]

these are not marked as automatically installed, so probably need to be removed manually. the rest should be cleaned up by apt autoremove
 
Code:
pve-kernel-5.4.124-1-pve/now 5.4.124-1 amd64 [installed,local]
pve-kernel-5.4.34-1-pve/now 5.4.34-2 amd64 [installed,local]

these are not marked as automatically installed, so probably need to be removed manually. the rest should be cleaned up by apt autoremove
done that, but some still not cleaned:

Code:
root@pve:~# apt list --installed | grep pve-kernel

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

pve-kernel-5.13.19-2-pve/stable,now 5.13.19-4 amd64 [installed,automatic]
pve-kernel-5.13.19-6-pve/stable,now 5.13.19-15 amd64 [installed,automatic]
pve-kernel-5.13/stable,now 7.1-9 all [installed,automatic]
pve-kernel-5.15.30-2-pve/stable,now 5.15.30-3 amd64 [installed,automatic]
pve-kernel-5.15.35-1-pve/stable,now 5.15.35-2 amd64 [installed,automatic]
pve-kernel-5.15/stable,now 7.2-3 all [installed,automatic]
pve-kernel-helper/stable,now 7.2-3 all [installed]
root@pve:~# apt autoremove
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

What kernels need to stay?
 
Last edited:
What kernels need to stay?

pve-5.13 is PVE 7.1's default
pve-5.15 is PVE 7.2's default (and was opt-in before)

So if you are sure all is running well with PVE 7.2 and it's pve-5.15 kernel, then you could also remove pve-5.13 completely.
 
pve-5.13 is PVE 7.1's default
pve-5.15 is PVE 7.2's default (and was opt-in before)

So if you are sure all is running well with PVE 7.2 and it's pve-5.15 kernel, then you could also remove pve-5.13 completely.


Code:
That means:

5.13.19-6-pve
5.15.35-1-pve

that is:

pve-kernel-5.15.35-1-pve/stable,now 5.15.35-2 amd64 [installed,automatic]
pve-kernel-5.13.19-6-pve/stable,now 5.13.19-15 amd64 [installed,automatic]

I assume?
 
Last edited:
Code:
That means:

5.13.19-6-pve
5.15.35-1-pve

that is:

pve-kernel-5.15.35-1-pve/stable,now 5.15.35-2 amd64 [installed,automatic]
pve-kernel-5.13.19-6-pve/stable,now 5.13.19-15 amd64 [installed,automatic]

I assume?

What do you exactly mean? Or better, what is your goal overall?

The following assumes, that your host is running/booted with the pve-kernel-5.15.35-1-pve kernel right now:

To more clearly answer your initial question: If you fully updated your host to PVE version 7.2 and rebooted it after the update and installation of the pve-kernel-5.15.35-1-pve kernel, than this kernel is the actual used and only one you really need.

But as already stated in this thread, apt autoremove should take care of the cleanup:
PVE 6.x will now allow easy autoremoval of kernels. Only the following will be marked as not eligible for autoremoval:
- currently running kernel
- last installed kernel
- two latest kernels
- last kernel of each series

The only thing that does not match (in my understanding) regarding your output and the autoremove-pattern is your pve-kernel-5.13.19-2-pve kernel. Afaiu this one should be catched by the autoremove, but it isn't.

pve-kernel-5.15.35-1-pve matches: currently running kernel + (most likely) last installed kernel + two latest kernels + last kernel of each series
pve-kernel-5.15.30-2-pve matches: two latest kernels
pve-kernel-5.13.19-6-pve matches: last kernel of each series
pve-kernel-5.13.19-2-pve matches: ???

Didn't you reboot the host yet and it is still running on pve-kernel-5.13.19-2-pve?

Maybe the Proxmox team can give a hint here.
 
  • Like
Reactions: chudak
On PMG, I constantly have a lot of old kernels:

Code:
pve-kernel-4.15.18-16-pve
pve-kernel-4.15.18-18-pve
pve-kernel-4.15.18-20-pve
pve-kernel-4.15.18-7-pve
pve-kernel-5.0.21-1-pve
pve-kernel-5.0.21-2-pve
pve-kernel-5.0.21-3-pve
pve-kernel-5.0.21-5-pve
pve-kernel-5.3.10-1-pve
pve-kernel-5.3.13-1-pve
pve-kernel-5.3.13-2-pve
pve-kernel-5.3.18-1-pve
pve-kernel-5.3.18-3-pve
pve-kernel-5.4.106-1-pve
pve-kernel-5.4.114-1-pve
pve-kernel-5.4.124-1-pve
pve-kernel-5.4.128-1-pve
pve-kernel-5.4.140-1-pve
pve-kernel-5.4.143-1-pve
pve-kernel-5.4.151-1-pve
pve-kernel-5.4.157-1-pve
pve-kernel-5.4.162-1-pve
pve-kernel-5.4.189-2-pve
pve-kernel-5.4.30-1-pve
pve-kernel-5.4.41-1-pve
pve-kernel-5.4.44-2-pve
pve-kernel-5.4.60-1-pve
pve-kernel-5.4.65-1-pve
pve-kernel-5.4.73-1-pve
pve-kernel-5.4.78-2-pve
I know I can get rid of them manually, but honestly, I'd see it resolved purer, preferably automatically or via a script placed in shell.
 
And you already tried a apt autoremove? You can also run that with a "-y" in scripts/cron.
 
Last edited:
Code:
 apt autoremove --dry-run
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!