/boot is full and updates fail
Old kernels have filled a small partition, and the package manager cannot install the new one — often leaving the system half-configured.
What you see
apt or dnf fails partway through a kernel update with a write error on /boot, and subsequent package operations refuse to run until it is resolved.
What is actually wrong
A /boot partition of 200–500MB from an older installation, and kernel packages that are never removed automatically.
Codes and articles
Fixes (2)
Clear old kernels safely on Debian and Ubuntu
apt. Removing the running kernel makes the machine unbootable, so identify it first.
Find out which kernel is running. Never remove this one.
uname -rdf -h /boot
Every accident with this fault is the same accident: a for-loop that removes every kernel matching a pattern, including the running one, on a machine that then does not come back from its next reboot.
List installed kernels with the running one marked.
dpkg -l 'linux-image-*' | awk '/^ii/{print $2}' | while read -r k; do case "$k" in *"$(uname -r)"*) echo "$k <== RUNNING";; *) echo "$k";; esacdone
Remove one specific old kernel to make room.
sudo apt purge linux-image-5.15.0-71-generic linux-modules-5.15.0-71-genericWith space free, complete the interrupted operation.
sudo dpkg --configure -asudo apt --fix-broken install
Then let autoremove clear the rest, which respects the running and most recent kernels.
sudo apt autoremove --purgeKeep it from recurring by limiting how many are retained.
printf 'Unattended-Upgrade::Remove-Unused-Kernel-Packages "true";\n' | sudo tee /etc/apt/apt.conf.d/99-kernel-cleanup
df -h /boot; dpkg -l 'linux-image-*' | grep -c '^ii'Clear old kernels on the RHEL family
dnf or yum.
Check what is installed and what is running.
uname -rrpm -q kerneldf -h /boot
Remove old kernels, keeping the configured number. dnf refuses to remove the running one, which makes this considerably safer than the apt equivalent.
sudo dnf remove --oldinstallonly --setopt installonly_limit=2 kernelThe installonly mechanism is aware of which kernel is booted and will not remove it. This is the supported path and it should be used in preference to removing packages by name.
Set the retention limit permanently.
sudo sed -i 's/^installonly_limit.*/installonly_limit=2/' /etc/dnf/dnf.confgrep installonly /etc/dnf/dnf.conf
Rebuild the boot configuration if entries are stale.
sudo grub2-mkconfig -o /boot/grub2/grub.cfgsudo grubby --info=ALL | grep ^kernel
Complete any interrupted transaction.
sudo dnf historysudo dnf distro-sync
df -h /boot; sudo grubby --default-kernelRelated faults
Where this stops. This write-up was written and checked by hand. It says what each step changes, how to confirm it worked and how to reverse it, and anything destructive is flagged before you reach it. If it does not match what your machine is doing, search the Support Centre for the exact code or message — and when something needs a person, get in touch.