Problem: /boot Partition Runs Out of Space Due to Old Kernels

Problem

Some customers report that the /boot partition gradually fills up over time. This typically happens because multiple old Linux kernel versions remain installed on the system. If /boot runs out of space, kernel updates or system upgrades may fail and, in worst cases, the system might become unbootable.


Root Cause

Old kernel packages are not automatically removed after system updates. Over time, each kernel installation adds additional files (kernel images and initramfs files) to the /boot partition. Without regular cleanup, these accumulated kernels consume all available disk space.


Solution

Unnecessary and outdated kernel versions can be safely removed using the built-in command:

univention-prune-kernels

This command automatically detects and removes old kernels that are no longer required, while keeping the currently active and necessary fallback kernels.

Example Output

Below is an example output to illustrate what happens during execution:

root@primary:~# univention-prune-kernels
(Reading database ... 170378 files and directories currently installed.)
Removing linux-image-6.1.0-39-amd64 (6.1.148-1) ...
update-initramfs: Deleting /boot/initrd.img-6.1.0-39-amd64
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-6.1.0-41-amd64
Found linux image: /boot/vmlinuz-6.1.0-40-amd64
Found linux image: /boot/vmlinuz-6.1.0-38-amd64
done
Removing linux-image-6.1.0-40-amd64 (6.1.153-1) ...
...

After execution, the /boot partition is freed from unused kernel files and GRUB is automatically updated.

Best Practices

  • Running univention-prune-kernels regularly is recommended to prevent /boot from filling up.
  • Executing the command via a cron job is a proven and commonly used approach.
  • Please be aware that using a cron job will remove old kernels automatically without manual review.
  • As an alternative or additional measure, consider increasing the size of the /boot partition and running the script manually every few months.
1 Like

This topic was automatically closed after 24 hours. New replies are no longer allowed.