what doesapt list --installed | grep pve-kernel
output? you should be able to just remove the old kernel packages.
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]
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]
apt autoremove
done that, but some still not cleaned: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 byapt autoremove
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?
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.
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?
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?
pve-kernel-5.15.35-1-pve
kernel right now:pve-kernel-5.15.35-1-pve
kernel, than this kernel is the actual used and only one you really need.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
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 seriespve-kernel-5.15.30-2-pve
matches: two latest kernelspve-kernel-5.13.19-6-pve
matches: last kernel of each seriespve-kernel-5.13.19-2-pve
matches: ???pve-kernel-5.13.19-2-pve
?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
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.
Thanks this works just flawlessapt-get purge $( dpkg --list | grep -P -o "pve-kernel-\d\S+" | grep -v $(uname -r | grep -P -o ".+\d") )