How to Remove Old Kernels on Linux
Free up disk space by cleaning old kernel-related leftovers on Linux with help from Kudu.
By Kudu Team
Fix this automatically with Kudu
Run a free system scan to detect and resolve this issue automatically — no manual steps required.
Download Kudu Free →What Causes This?
Old Linux kernels build up over time as your distribution installs newer versions but keeps previous ones for rollback and compatibility. If you use WSL, dual-boot Linux, or Linux tools inside Windows, these leftover kernel packages, headers, and boot files can take up unnecessary disk space. The problem usually happens when automatic cleanup doesn’t run or older packages are marked to stay installed.
Common Symptoms
- Your Linux partition or WSL virtual disk keeps growing
- You see multiple old kernel versions listed in your package manager
- System updates fail because there isn’t enough free space
/bootor the Linux system drive is nearly full- You notice old kernel headers and modules still installed after updates
How to Fix It Manually
-
Check which kernel you’re currently using
- Open your Linux terminal.
- Run:
uname -r - Make a note of the version shown. Do not remove the kernel currently in use.
-
List installed kernels
- On Ubuntu or Debian-based systems, run:
dpkg --list | grep linux-image - You may also want to check related packages:
dpkg --list | grep linux-headers - Look for older versions that don’t match the output from
uname -r.
- On Ubuntu or Debian-based systems, run:
-
Remove old kernels on Ubuntu or Debian
- For each old kernel version, remove its image and headers. Example:
sudo apt remove linux-image-5.15.0-60-generic linux-headers-5.15.0-60-generic - If you want APT to clean unused kernel packages automatically, run:
sudo apt autoremove --purge - Read the package list carefully before confirming. Make sure the current kernel is not included.
- For each old kernel version, remove its image and headers. Example:
-
Remove old kernels on Fedora, RHEL, or CentOS
- List installed kernels:
rpm -q kernel - Remove an older one with:
sudo dnf remove kernel-<version> - On some systems, this also works to remove unused packages:
sudo dnf autoremove
- List installed kernels:
-
Update the bootloader if needed
- On Ubuntu or Debian, run:
sudo update-grub - On some Fedora-based systems, GRUB updates automatically, but if needed you can rebuild the config using your distro’s GRUB command.
- On Ubuntu or Debian, run:
-
Reboot and verify
- Restart the Linux system.
- After reboot, check the active kernel again:
uname -r - Confirm the system starts normally and that disk space has improved:
df -h
-
If you use WSL on Windows, compact the virtual disk afterward
- Close all WSL instances in Windows Terminal or Command Prompt:
wsl --shutdown - If you’re using WSL2, the Linux cleanup may not immediately shrink the
.vhdxfile until you compact it separately from Windows.
- Close all WSL instances in Windows Terminal or Command Prompt:
Fix It Automatically with Kudu
If you’re using Linux tools through WSL or dealing with storage bloat on a Windows PC, Kudu can help find large leftover system files, reclaim wasted space, and simplify cleanup without digging through package lists manually. It’s a faster way to spot what’s safe to remove and keep your PC from filling up again.
Fix this automatically with Kudu
Run a free system scan to detect and resolve this issue automatically — no manual steps required.
Download Kudu Free →Related guides
How to Remove Old Snap Revisions on Linux
Delete old Snap revisions on Linux and recover storage space safely with Kudu.
How to Remove App Cache on Linux
Clean application cache on Linux to recover space and reduce clutter using Kudu.
How to Remove APT Cache on Linux
Free up storage by cleaning APT cache files on Linux with Kudu’s cleanup tools.
How to Remove Browser Cache on Linux
Delete browser cache on Linux to free up storage and improve browsing performance with Kudu.