Easily remove old/unused PVE kernels on your Proxmox VE system (PVE Kernel Cleaner)

Jordan_

Active Member
Oct 23, 2018
3
9
43
Hello everyone,

This is my public release of a tool I have developed to resolve an ongoing issue with old PVE kernels on Proxmox VE.

"Easily remove old/unused PVE kernels on your Proxmox VE system"

What is PVE Kernel Cleaner?
PVE Kernel Cleaner is a program to compliment Proxmox Virtual Environment which is an open-source server virtualization environment. PVE Kernel Cleaner allows you to purge old/unused kernels filling the /boot directory. As new kernels are released the older ones have to be manually removed frequently to make room for newer ones. This can become quite tedious and require extensive time spent monitoring the system when new kernels are released and when older ones need to be cleared out to make room. With this issue existing, PVE Kernel Cleaner was created to solve it.


Features
  • Removes old PVE kernels from your system
  • Ability to schedule PVE kernels to automatically be removed on a daily/weekly/monthly basis
  • Run a simple pvekclean command for ease of access
  • Support for the latest Proxmox versions and PVE kernels

Installing

To install PVE Kernel Cleaner head on over to the GitHub page at: https://github.com/jordanhillis/pvekclean

Please let me know what you think and if you run into any issues.
 
Last edited by a moderator:
Did not work on one of the boxes. Keeps looping around and not removing anything. Worked on my other nodes.

Bash:
[*] Boot disk space used is critically full at 84% capacity (729M free)
[-] Searching for old PVE kernels on your system...
[*] "pve-kernel-5.3.18-3-pve" has been added to the kernel remove list
[-] PVE kernel search complete!
[!] Would you like to remove the 1 selected PVE kernels listed above? [y/N]:

Bash:
root@electro:~# dpkg -l | grep pve-kernel
ii  pve-firmware                         3.1-3                           all          Binary firmware code for the pve-kernel
rc  pve-kernel-4.15                      5.4-17                          all          Latest Proxmox VE Kernel Image
ii  pve-kernel-5.3                       6.1-6                           all          Latest Proxmox VE Kernel Image
ii  pve-kernel-5.3.18-3-pve              5.3.18-3                        amd64        The Proxmox PVE Kernel Image
ii  pve-kernel-5.4                       6.2-7                           all          Latest Proxmox VE Kernel Image
ii  pve-kernel-5.4.65-1-pve              5.4.65-1                        amd64        The Proxmox PVE Kernel Image
ii  pve-kernel-helper                    6.2-7                           all          Function for various kernel maintenance tasks.

EDIT: it turned out problem with yum , but maybe it would be good idea to catch errors back from yum if problem occur instead of silently going forward.
 
Last edited:

Release Notes for Version 2.0.2​

I am thrilled to announce the release of PVE Kernel Cleaner 2.0! It's been over 5 years since the last update, and I greatly appreciate your patience, feature requests, and bug reports. Your feedback has been vital in enhancing the tool's capabilities. Here's what's new in this update:

  • Enhanced Package Detection: Resolved issues with proxmox-kernel and pve-kernel package detection.
  • Legacy Package Handling: Fixed a bug where legacy pve-kernel meta-packages were not being removed.
  • Kernel Sorting Improvement: Corrected sorting issues to list kernels accurately from oldest to newest.
  • Scheduler Functionality: Added an option to set the minimum number of kernels to keep in the scheduler function.
  • New --keep/-k Option: Introduced the --keep (or -k) option to specify the minimum number of kernels you wish to keep on your system.
  • New --remove-newer/-rn Option:Implemented the --remove-newer (or -rn) option to enable the removal of kernels that are newer than the current one, enhancing kernel management.
  • New --dry-run/-d Mode: Added a --dry-run (or -d) mode for non-destructive testing, allowing safe program execution without affecting system kernels or making changes.
  • Boot Directory Size Bug Fix: Addressed a bug with the detection of the /bootdirectory size, especially in LVM setups.
  • Update Function: Added a new feature to update the program to the latest version directly from the command line. This can be disabled by setting the check_for_updates variable to false.
  • Other Improvements: Various other bug fixes and enhancements have been made to improve performance and reliability.
Your continued support and feedback are what drive the improvement of PVE Kernel Cleaner.

https://github.com/jordanhillis/pvekclean/releases/tag/v2.0

Enjoy!

Jordan
 
  • Like
Reactions: effgee

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!