clean old kernels

fabian

Proxmox Staff Member
Staff member
Jan 7, 2016
5,571
925
163
will get the same mechanism soon.
 

fabian

Proxmox Staff Member
Staff member
Jan 7, 2016
5,571
925
163
Is it possible to trigger this manually?

the config file that marks individual kernels as not-autoremovable gets regenerated on every kernel install/removal, but you can also trigger a manual refresh with "pve-efiboot-tool refresh" (which will in turn call /etc/kernel/postinst.d/pve-auto-removal to regenerate the config). note that you also need to mark any kernels that you manually installed at some point in the past as automatically installed (with "apt-mark") for those to be picked up for autoremoval.

apt should then inform you about autoremovable kernel packages:
Code:
# apt autoremove --dry-run                                                                                                                          ✔
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
  pve-kernel-4.15.18-8-pve pve-kernel-4.15.18-9-pve
0 upgraded, 0 newly installed, 2 to remove and 0 not upgraded.
Remv pve-kernel-4.15.18-8-pve [4.15.18-28]
Remv pve-kernel-4.15.18-9-pve [4.15.18-30]

without '--dry-run' this will actually remove them ;)
 
  • Like
Reactions: Afox
Sep 26, 2019
160
14
18
58
St Louis
katycomputer.com
When I run: apt autoremove --dry-run, I get:
Code:
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

If I want current kernel and two prior kernels should a few of these go? How do I accomplish this using PVE 6 standard autoremove tools?
Code:
root@stl-eno1:~# dpkg --list | grep kernel | grep amd64 | grep pve
rc  pve-kernel-5.3.13-1-pve              5.3.13-1                    amd64        The Proxmox PVE Kernel Image
rc  pve-kernel-5.3.13-2-pve              5.3.13-2                    amd64        The Proxmox PVE Kernel Image
rc  pve-kernel-5.3.13-3-pve              5.3.13-3                    amd64        The Proxmox PVE Kernel Image
rc  pve-kernel-5.3.18-1-pve              5.3.18-1                    amd64        The Proxmox PVE Kernel Image
ii  pve-kernel-5.3.18-2-pve              5.3.18-2                    amd64        The Proxmox PVE Kernel Image
ii  pve-kernel-5.3.18-3-pve              5.3.18-3                    amd64        The Proxmox PVE Kernel Image
root@stl-eno1:~#
 
  • Like
Reactions: patefoniq

Stoiko Ivanov

Proxmox Staff Member
Staff member
May 2, 2018
5,378
717
118
If I want current kernel and two prior kernels should a few of these go? How do I accomplish this using PVE 6 standard autoremove tools?
the output says that you have 2 kernels currently installed: pve-kernel-5.3.18-2-pve and pve-kernel-5.3.18-3-pve

the other lines start with 'rc' stating that the package is remove, but potential config files are still around - you need to `purge` the packages to remove everything from them:
Code:
apt purge pve-kernel-5.3.13-1-pve  pve-kernel-5.3.13-2-pve pve-kernel-5.3.13-3-pve ...

I hope this helps!
 
  • Like
Reactions: KatyComputer

pocok

New Member
Dec 6, 2019
29
9
3
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

Thank you, this response is the one I was looking for. It confirms why does one need to keep both 5.4 and 5.11 kernels at the moment.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE 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 your own in 60 seconds.

Buy now!