clean old kernels

will get the same mechanism soon.
 
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
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
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
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.
 
apt-get update && apt-get -y upgrade && apt-get -y dist-upgrade && apt-get -y autoremove && apt-get -y autoclean


root@server1:/var/log# apt-get update && apt-get -y upgrade && apt-get -y dist-upgrade && apt-get -y autoremove && apt-get -y autoclean Hit:1 http://ftp.debian.org/debian bullseye InRelease Hit:2 http://security.debian.org/debian-security bullseye-security InRelease Hit:3 http://download.proxmox.com/debian/pve bullseye InRelease Hit:4 http://ftp.debian.org/debian bullseye-updates InRelease Reading package lists... Done Reading package lists... Done Building dependency tree... Done Reading state information... Done Calculating upgrade... Done The following packages were automatically installed and are no longer required: bsdmainutils pve-kernel-5.4.119-1-pve Use 'apt autoremove' to remove them. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. Reading package lists... Done Building dependency tree... Done Reading state information... Done Calculating upgrade... Done The following packages were automatically installed and are no longer required: bsdmainutils pve-kernel-5.4.119-1-pve Use 'apt autoremove' to remove them. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. Reading package lists... Done Building dependency tree... Done Reading state information... Done The following packages will be REMOVED: bsdmainutils pve-kernel-5.4.119-1-pve 0 upgraded, 0 newly installed, 2 to remove and 0 not upgraded. After this operation, 289 MB disk space will be freed. (Reading database ... 64136 files and directories currently installed.) Removing bsdmainutils (12.1.7+nmu3) ... Removing pve-kernel-5.4.119-1-pve (5.4.119-1) ... Examining /etc/kernel/postrm.d. run-parts: executing /etc/kernel/postrm.d/initramfs-tools 5.4.119-1-pve /boot/vmlinuz-5.4.119-1-pve update-initramfs: Deleting /boot/initrd.img-5.4.119-1-pve run-parts: executing /etc/kernel/postrm.d/proxmox-auto-removal 5.4.119-1-pve /boot/vmlinuz-5.4.119-1-pve run-parts: executing /etc/kernel/postrm.d/zz-proxmox-boot 5.4.119-1-pve /boot/vmlinuz-5.4.119-1-pve Re-executing '/etc/kernel/postrm.d/zz-proxmox-boot' in new private mount namespace.. No /etc/kernel/proxmox-boot-uuids found, skipping ESP sync. run-parts: executing /etc/kernel/postrm.d/zz-update-grub 5.4.119-1-pve /boot/vmlinuz-5.4.119-1-pve Generating grub configuration file ... Found linux image: /boot/vmlinuz-5.11.22-2-pve Found initrd image: /boot/initrd.img-5.11.22-2-pve Found linux image: /boot/vmlinuz-5.4.124-1-pve Found initrd image: /boot/initrd.img-5.4.124-1-pve Found memtest86+ image: /boot/memtest86+.bin Found memtest86+ multiboot image: /boot/memtest86+_multiboot.bin done Reading package lists... Done Building dependency tree... Done Reading state information... Done Del libzstd1 1.3.8+dfsg-3+deb10u2 [237 kB] Del libssl1.1 1.1.1d-0+deb10u5 [1,539 kB] Del dnsutils 1:9.11.5.P4+dfsg-5.1+deb10u3 [365 kB] Del bind9-host 1:9.11.5.P4+dfsg-5.1+deb10u3 [271 kB] Del libbind9-161 1:9.11.5.P4+dfsg-5.1+deb10u3 [247 kB] Del libisccfg163 1:9.11.5.P4+dfsg-5.1+deb10u3 [267 kB] Del libisccc161 1:9.11.5.P4+dfsg-5.1+deb10u3 [236 kB] Del libirs161 1:9.11.5.P4+dfsg-5.1+deb10u3 [237 kB] Del libdns1104 1:9.11.5.P4+dfsg-5.1+deb10u3 [1,221 kB] Del libisc1100 1:9.11.5.P4+dfsg-5.1+deb10u3 [457 kB] Del liblwres161 1:9.11.5.P4+dfsg-5.1+deb10u3 [251 kB] Del libisc-export1100 1:9.11.5.P4+dfsg-5.1+deb10u3 [380 kB] Del libdns-export1104 1:9.11.5.P4+dfsg-5.1+deb10u3 [973 kB] Del openssl 1.1.1d-0+deb10u5 [844 kB] Del zstd 1.3.8+dfsg-3+deb10u2 [336 kB] Del libldap-common 2.4.47+dfsg-3+deb10u6 [90.0 kB] Del libldap-2.4-2 2.4.47+dfsg-3+deb10u6 [224 kB] Del zfs-initramfs 2.0.3-pve1 [30.6 kB] Del zfsutils-linux 2.0.3-pve1 [467 kB] Del zfs-zed 2.0.3-pve1 [66.8 kB] Del libnvpair2linux 2.0.3-pve1 [52.5 kB] Del libzfs3linux 2.0.3-pve1 [220 kB] Del libuutil2linux 2.0.3-pve1 [46.0 kB] Del libzpool3linux 2.0.3-pve1 [1,203 kB] Del pve-qemu-kvm 5.2.0-1 [22.3 MB] Del libpve-storage-perl 6.3-7 [112 kB] Del libpve-guest-common-perl 3.1-5 [24.6 kB] Del libpve-common-perl 6.3-4 [107 kB] Del pve-container 3.3-4 [123 kB] Del pve-firmware 3.2-2 [59.8 MB] Del pve-kernel-5.4.98-1-pve 5.4.98-1 [60.6 MB] Del pve-kernel-5.4 6.3-5 [3,612 B] Del pve-kernel-helper 6.3-5 [9,528 B] Del pve-manager 6.3-4 [2,033 kB] Del spl 2.0.3-pve1 [20.2 kB] Del zfs-initramfs 2.0.3-pve2 [30.7 kB] Del zfsutils-linux 2.0.3-pve2 [467 kB] Del zfs-zed 2.0.3-pve2 [66.8 kB] Del libnvpair3linux 2.0.3-pve2 [52.5 kB] Del libzfs4linux 2.0.3-pve2 [220 kB] Del libuutil3linux 2.0.3-pve2 [46.2 kB] Del libzpool4linux 2.0.3-pve2 [1,202 kB] Del pve-kernel-5.4.101-1-pve 5.4.101-1 [60.6 MB] Del pve-kernel-5.4 6.3-6 [3,624 B] Del pve-kernel-helper 6.3-6 [9,540 B] Del pve-qemu-kvm 5.2.0-2 [22.4 MB] Del spl 2.0.3-pve2 [20.2 kB] Del proxmox-widget-toolkit 2.4-9 [75.4 kB] Del base-files 10.3+deb10u9 [69.9 kB] Del libnss-systemd 241-7~deb10u7 [205 kB] Del libsystemd0 241-7~deb10u7 [332 kB] Del libpam-systemd 241-7~deb10u7 [209 kB] Del libssl1.1 1.1.1d-0+deb10u6 [1,539 kB] Del curl 7.64.0-4+deb10u2 [265 kB] Del libcurl4 7.64.0-4+deb10u2 [332 kB] Del libcurl3-gnutls 7.64.0-4+deb10u2 [330 kB] Del libjs-underscore 1.9.1~dfsg-1+deb10u1 [100.0 kB] Del libldb1 2:1.5.1+really1.4.6-3+deb10u1 [135 kB] Del systemd 241-7~deb10u7 [3,499 kB] Del openssl 1.1.1d-0+deb10u6 [844 kB] Del udev 241-7~deb10u7 [1,278 kB] Del libudev1 241-7~deb10u7 [151 kB] Del systemd-sysv 241-7~deb10u7 [100 kB] Del libpython3.7 3.7.3-2+deb10u3 [1,498 kB] Del python3.7 3.7.3-2+deb10u3 [330 kB] Del libpython3.7-stdlib 3.7.3-2+deb10u3 [1,734 kB] Del libproxmox-acme-perl 1.0.8 [111 kB] Del python3.7-minimal 3.7.3-2+deb10u3 [1,737 kB] Del libpython3.7-minimal 3.7.3-2+deb10u3 [589 kB] Del debian-archive-keyring 2019.1+deb10u1 [93.5 kB] Del iputils-ping 3:20180629-2+deb10u2 [43.4 kB] Del groff-base 1.22.4-3+deb10u1 [916 kB] Del libavahi-common-data 0.7-4+deb10u1 [122 kB] Del libavahi-common3 0.7-4+deb10u1 [54.4 kB] Del libavahi-client3 0.7-4+deb10u1 [58.2 kB] Del libbsd0 0.9.1-2+deb10u1 [99.5 kB] Del libjs-jquery 3.3.1~dfsg-3+deb10u1 [332 kB] Del libpve-common-perl 6.3-5 [107 kB] Del linux-libc-dev 4.19.181-1 [1,441 kB] Del proxmox-backup-client 1.0.12-1 [2,783 kB] Del pve-kernel-5.4.106-1-pve 5.4.106-1 [60.6 MB] Del pve-kernel-5.4 6.3-8 [3,660 B] Del pve-kernel-helper 6.3-8 [9,572 B] Del pve-qemu-kvm 5.2.0-5 [22.4 MB] Del qemu-server 6.3-10 [237 kB] Del pve-manager 6.3-6 [2,034 kB] Del smartmontools 7.2-pve2 [564 kB] Del proxmox-backup-client 1.0.13-1 [2,787 kB] Del libpve-storage-perl 6.3-8 [113 kB] Del liblz4-1 1.8.3-1+deb10u1 [53.3 kB] Del libcorosync-common4 3.1.2-pve1 [7,416 B] Del libcfg7 3.1.2-pve1 [10.6 kB] Del dnsutils 1:9.11.5.P4+dfsg-5.1+deb10u5 [365 kB] Del bind9-host 1:9.11.5.P4+dfsg-5.1+deb10u5 [271 kB] Del libcmap4 3.1.2-pve1 [12.1 kB] Del libcpg4 3.1.2-pve1 [14.1 kB] Del libquorum5 3.1.2-pve1 [9,116 B] Del libapt-pkg5.0 1.8.2.3 [967 kB] Del libvotequorum8 3.1.2-pve1 [9,988 B] Del libapt-inst2.0 1.8.2.3 [204 kB] Del libbind9-161 1:9.11.5.P4+dfsg-5.1+deb10u5 [247 kB] Del libisccfg163 1:9.11.5.P4+dfsg-5.1+deb10u5 [267 kB] Del libisccc161 1:9.11.5.P4+dfsg-5.1+deb10u5 [237 kB] Del libirs161 1:9.11.5.P4+dfsg-5.1+deb10u5 [238 kB] Del corosync 3.1.2-pve1 [237 kB] Del apt 1.8.2.3 [1,418 kB] Del apt-utils 1.8.2.3 [421 kB] Del libpve-common-perl 6.4-3 [109 kB] Del idn 1.33-2.2 [147 kB] Del libdns1104 1:9.11.5.P4+dfsg-5.1+deb10u5 [1,215 kB] Del libpve-cluster-api-perl 6.4-1 [43.7 kB] Del libpve-cluster-perl 6.4-1 [22.8 kB] Del pve-cluster 6.4-1 [113 kB] Del libpve-access-control 6.4-1 [53.8 kB] Del libpve-http-server-perl 3.2-3 [24.2 kB] Del libisc1100 1:9.11.5.P4+dfsg-5.1+deb10u5 [458 kB] Del liblwres161 1:9.11.5.P4+dfsg-5.1+deb10u5 [252 kB] Del libisc-export1100 1:9.11.5.P4+dfsg-5.1+deb10u5 [380 kB] Del libdns-export1104 1:9.11.5.P4+dfsg-5.1+deb10u5 [972 kB] Del proxmox-backup-client 1.1.8-1 [2,818 kB] Del libgstreamer-plugins-base1.0-0 1.14.4-2+deb10u1 [1,936 kB] Del libx11-data 2:1.6.7-1+deb10u2 [299 kB] Del libx11-6 2:1.6.7-1+deb10u2 [757 kB] Del libx11-xcb1 2:1.6.7-1+deb10u2 [191 kB] Del proxmox-backup-file-restore 1.1.8-1 [2,777 kB] Del libpve-storage-perl 6.4-1 [115 kB] Del pve-kernel-helper 6.4-2 [11.3 kB] Del pve-kernel-5.4.114-1-pve 5.4.114-1 [60.6 MB] Del pve-kernel-5.4 6.4-2 [3,924 B] Del pve-firewall 4.1-4 [71.3 kB] Del pve-qemu-kvm 5.2.0-6 [22.4 MB] Del qemu-server 6.4-2 [240 kB] Del proxmox-widget-toolkit 2.5-6 [79.6 kB] Del pve-container 3.3-5 [122 kB] Del pve-docs 6.4-2 [12.3 MB] Del pve-manager 6.4-8 [2,044 kB] Del proxmox-ve 6.4-1 [5,620 B] Del libpve-access-control 6.4-3 [54.2 kB] Del proxmox-backup-client 1.1.10-1 [2,798 kB] Del proxmox-backup-file-restore 1.1.10-1 [2,745 kB] Del proxmox-backup-restore-image 0.2.3 [12.0 MB] Del pve-kernel-5.4.119-1-pve 5.4.119-1 [60.6 MB] Del pve-kernel-5.4 6.4-3 [3,940 B] Del pve-kernel-helper 6.4-3 [11.3 kB] Del base-files 10.3+deb10u10 [69.9 kB] Del libnettle6 3.4.1-1+deb10u1 [215 kB] Del libhogweed4 3.4.1-1+deb10u1 [141 kB] Del libgcrypt20 1.8.4-5+deb10u1 [556 kB] Del libgnutlsxx28 3.6.7-4+deb10u7 [14.6 kB] Del libproxmox-backup-qemu0 1.1.0-1 [1,703 kB] Del proxmox-widget-toolkit 2.6-1 [79.8 kB] Del libgnutls30 3.6.7-4+deb10u7 [1,125 kB] Del isc-dhcp-client 4.4.1-2+deb10u1 [339 kB] Del isc-dhcp-common 4.4.1-2+deb10u1 [144 kB] Del klibc-utils 2.0.6-1+deb10u1 [95.1 kB] Del libklibc 2.0.6-1+deb10u1 [54.4 kB] Del libglib2.0-0 2.58.3-2+deb10u3 [1,259 kB] Del libxml2 2.9.4+dfsg1-7+deb10u2 [689 kB] Del linux-libc-dev 4.19.194-2 [1,459 kB] Del nmap 7.70+dfsg1-6+deb10u2 [1,894 kB] Del pve-kernel-5.4.124-1-pve 5.4.124-1 [60.7 MB] Del pve-kernel-5.4 6.4-4 [3,956 B] Del pve-kernel-helper 6.4-4 [11.3 kB] Del pve-manager 6.4-9 [2,046 kB] Del nmap-common 7.70+dfsg1-6+deb10u2 [3,932 kB] Del proxmox-backup-client 1.1.12-1 [2,799 kB] Del proxmox-backup-file-restore 1.1.12-1 [2,748 kB] Del pve-container 3.3-6 [123 kB] Del pve-manager 6.4-13 [2,048 kB]

I ran a server with proxmox 7.0 installed, the machine opened without problems

thanks
 
  • Like
Reactions: lDemoNl
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
Hi, I resume this post to kindly have a safe guide of the commands to give x clean up old kernels! I'm on PVE 7.x
Salve, riprendo questo post x avere gentilmente una guida sicura dei comandi da osare x ripulire i vecchi kernel! sono su PVE 7.x

dpkg --list|grep pve-kernel
ii pve-firmware 3.4-1 all Binary firmware code for the pve-kernel
ii pve-kernel-5.13 7.1-9 all Latest Proxmox VE Kernel Image
rc pve-kernel-5.13.19-1-pve 5.13.19-3 amd64 The Proxmox PVE Kernel Image
ii pve-kernel-5.13.19-2-pve 5.13.19-4 amd64 The Proxmox PVE Kernel Image
rc pve-kernel-5.13.19-3-pve 5.13.19-7 amd64 The Proxmox PVE Kernel Image
rc pve-kernel-5.13.19-4-pve 5.13.19-9 amd64 The Proxmox PVE Kernel Image
ii pve-kernel-5.13.19-5-pve 5.13.19-13 amd64 The Proxmox PVE Kernel Image
ii pve-kernel-5.13.19-6-pve 5.13.19-15 amd64 The Proxmox PVE Kernel Image
ii pve-kernel-5.4 6.4-7 all Latest Proxmox VE Kernel Image
ii pve-kernel-5.4.106-1-pve 5.4.106-1 amd64 The Proxmox PVE Kernel Image
rc pve-kernel-5.4.114-1-pve 5.4.114-1 amd64 The Proxmox PVE Kernel Image
rc pve-kernel-5.4.119-1-pve 5.4.119-1 amd64 The Proxmox PVE Kernel Image
rc pve-kernel-5.4.124-1-pve 5.4.124-2 amd64 The Proxmox PVE Kernel Image
rc pve-kernel-5.4.128-1-pve 5.4.128-2 amd64 The Proxmox PVE Kernel Image
rc pve-kernel-5.4.140-1-pve 5.4.140-1 amd64 The Proxmox PVE Kernel Image
ii pve-kernel-5.4.143-1-pve 5.4.143-1 amd64 The Proxmox PVE Kernel Image
ii pve-kernel-helper 7.2-2 all Function for various kernel maintenance tasks.
 
Last edited:
Code:
apt autoremove
should do the right thing - unless you have manually installed specific kernel versions, then you need to manually remove them as well IIRC.
 
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
Does this look right to you?
Thx

Code:
pve-kernel-5.15: 7.2-1
pve-kernel-5.13: 7.1-9
pve-kernel-5.4: 6.4-4
pve-kernel-5.15.30-2-pve: 5.15.30-3
pve-kernel-5.13.19-6-pve: 5.13.19-15
pve-kernel-5.13.19-2-pve: 5.13.19-4
pve-kernel-5.4.124-1-pve: 5.4.124-1
pve-kernel-5.4.34-1-pve: 5.4.34-2
 
@chudak: those are more than you need probably - likely they were installed manually at some point which prevents their automatic removal (as a safeguard).
 
@chudak: those are more than you need probably - likely they were installed manually at some point which prevents their automatic removal (as a safeguard).

Code:
root@pve:~# proxmox-boot-tool kernel list
Manually selected kernels:
None.

Automatically selected kernels:
5.13.19-6-pve
5.15.30-2-pve

Can I manually remove all but those ^ two?

These:

Code:
pve-kernel-5.4: 6.4-4
pve-kernel-5.15.30-2-pve: 5.15.30-3
pve-kernel-5.13.19-6-pve: 5.13.19-15
pve-kernel-5.13.19-2-pve: 5.13.19-4
pve-kernel-5.4.124-1-pve: 5.4.124-1
pve-kernel-5.4.34-1-pve: 5.4.34-2

Thx
 
Last edited:
yes, if you don't experience any specific issues hardware wise that would warrant being able to boot and older one, you can remove the rest.
 
yes, if you don't experience any specific issues hardware wise that would warrant being able to boot and older one, you can remove the rest.

I cleaned it up and see now:

Code:
Last login: Tue May 10 10:38:59 2022 from 192.168.90.68
root@pve:~# proxmox-boot-tool kernel list
Manually selected kernels:
None.

Automatically selected kernels:
5.13.19-6-pve
5.15.30-2-pve
5.15.35-1-pve

But via GUI 'Packadge versions":


Code:
pve-kernel-5.13: 7.1-9
pve-kernel-5.4: 6.4-4
pve-kernel-5.15.35-1-pve: 5.15.35-2
pve-kernel-5.15.30-2-pve: 5.15.30-3
pve-kernel-5.13.19-6-pve: 5.13.19-15
pve-kernel-5.13.19-2-pve: 5.13.19-4
pve-kernel-5.4.124-1-pve: 5.4.124-1
pve-kernel-5.4.34-1-pve: 5.4.34-2

Can that be cleaned up too? How if yes?

Thx
 

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!