This is optional, but normally I first run # apt update && apt dist-upgrade and then reboot the server, so it’s running the latest updates/kernels. After updating and rebooting the server, verify all your VMs and Containers are running fine.
Next, I run # uname -r, to find the “current” active running kernel, and make a note of it, for example:
#root@proxmox:~# uname -r
4.15.10-1-pve
Next, I do # dpkg –list|grep pve-kernel to show the list of installed pve-kernels. In the output below, we focus only on “pve-kernel-x-x-x-pve”, We do not touch pve-firmware and pve-kernel-x.xx
root@proxmox:~# dpkg --list|grep pve-kernel
ii pve-firmware 2.0-4 all Binary firmware code for the pve-kernel [do not ever touch!]
ii pve-kernel-4.13 5.1-43 all Latest Proxmox VE Kernel Image [not valid, does not have “-pve” at end]
ii pve-kernel-4.13.16-1-pve 4.13.16-43 amd64 The Proxmox PVE Kernel Image [valid kernel to remove]
ii pve-kernel-4.15 5.1-2 all Latest Proxmox VE Kernel Image [not valid, does not have “-pve” at end]
ii pve-kernel-4.15.10-1-pve 4.15.10-2 amd64 The Proxmox PVE Kernel Image [do not remove since this is current kernel! ]
Now in the sample above, I want to remove “pve-kernel-4.13.16-1-pve”, and also the kernel entry in grub menu, so to do this I do:
# apt purge pve-kernel-4.13.16-1-pve
Note: if you only do # apt remove pve-kernel-x-x-x-pve, it will leave the old kernel grub entry in grub menu
It will now say:
root@proxmox:~# apt purge pve-kernel-4.13.16-1-pve Reading package lists... Done Building dependency tree Reading state information... Done The following packages will be REMOVED: proxmox-ve* pve-kernel-4.13* pve-kernel-4.13.16-1-pve* 0 upgraded, 0 newly installed, 3 to remove and 0 not upgraded. After this operation, 252 MB disk space will be freed. Do you want to continue? [Y/n]
Now at this point double and triple check to make very sure that’s the kernel you want to purge and say “Y”. It will then uninstall the kernel, purge and delete the kernel entry in grub menu, and update grub menus.
Credit: GadgetPig, https://forum.proxmox.com/threads/clean-old-kernels.42040/ – Apr 26, 2016
I don’t underastand that
Hi Novian, this web site contains some articles that are really for me so I don’t forget how to do something. Sometimes they might not be useful to other people. If you don’t use Proxmox, this probably won’t help you.
Thanks this helped me clean out old unused kernels from proxmox 😀