Skip to main content
Community Scripts logo
Skip to Content
Tools & Add-onsPVE Tools

PVE Kernel Clean

Remove old proxmox-kernel packages from the host to free space in /boot.

Every kernel update leaves the previous kernel installed. kernel-clean.sh lists the installed kernels other than the running one and purges the ones you select.

Website entry: kernel-clean. Source: tools/pve/kernel-clean.sh.

Run

In the Proxmox VE host shell, as root:

bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/tools/pve/kernel-clean.sh)"

What is listed

Fully installed packages (ii in dpkg --list) whose name matches proxmox-kernel-<x>.<y>.<z>..., without the running kernel (uname -r). Meta-packages such as proxmox-kernel-6.8 and proxmox-kernel-helper are not listed. If nothing is left, the script prints "No old kernels detected" and exits.

Prompts

All prompts are plain text.

PromptInputEffect
Select kernels to remove (e.g. 1,3 or 1-5 or 1-3,7):Numbers from the list, separated by commas; ranges with -Invalid parts are ignored with a message. With no valid number the script exits ("No valid selection made").
Proceed with removal? (y/n):yRemoves the listed kernels. Any other input aborts.

What it does

For each selected kernel:

  1. apt-get purge -y <package>.
  2. If the meta-package of the same series (for example proxmox-kernel-6.8 for proxmox-kernel-6.8.12-4-pve-signed) is installed and no other kernel of that series remains, the meta-package is purged with it.

At the end it runs apt-get autoremove -y and update-grub.

Environment variables

VariableDefaultPurpose
COMMUNITY_SCRIPTS_CORE_URLhttps://raw.githubusercontent.com/community-scripts/core/mainBase URL the script loads api/api.func from.

Limits

  • No undo. A removed kernel must be reinstalled with apt.
  • Keep at least one older kernel as a fallback in case the running one fails to boot after a later change.
  • Do not remove a kernel that you pinned with PVE Kernel Pin.
  • Only packages whose name starts with proxmox-kernel- are found.