On an old server that still runs Ubuntu 16.04 the /boot partition is full, not with old kernels but with kernels that are all newer than the one that is running.

I'm running 4.4.0-176-generic, and the listing is like this (same with initrd.img* files):

-rw------- 1 root root 7220256 Dec  1 19:58 vmlinuz-4.4.0-198-generic
-rw------- 1 root root 7217792 Nov 27 14:03 vmlinuz-4.4.0-197-generic
-rw------- 1 root root 7220608 Nov 10 19:34 vmlinuz-4.4.0-194-generic
-rw------- 1 root root 7221056 Oct 14  2020 vmlinuz-4.4.0-193-generic
-rw------- 1 root root 7220448 Aug 31  2020 vmlinuz-4.4.0-190-generic
-rw------- 1 root root 7217792 Aug 14  2020 vmlinuz-4.4.0-189-generic
-rw------- 1 root root 7219360 Jul 22  2020 vmlinuz-4.4.0-187-generic
-rw------- 1 root root 7209656 Mar 16  2020 vmlinuz-4.4.0-177-generic
-rw------- 1 root root 7209560 Feb 28  2020 vmlinuz-4.4.0-176-generic

How can I safely clean things up?

I currently cannot install anything with apt-get, I get errors such as:

root@dev-server1:/boot# apt-get  install  postfix
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 linux-image-generic : Depends: linux-image-4.4.0-200-generic but it is not going to be installed or
                                linux-image-unsigned-4.4.0-200-generic but it is not going to be installed
                       Recommends: thermald but it is not going to be installed
 linux-modules-extra-4.4.0-200-generic : Depends: linux-image-4.4.0-200-generic but it is not going to be installed or
                                                  linux-image-unsigned-4.4.0-200-generic but it is not going to be installed
 postfix : Depends: ssl-cert but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

...which looks strange as it is referring to a kernel that is not even there.




First, Ubuntu 16.04 LTS has reached its end-of-life in last month, so you need to update to latest Ubuntu ASAP, otherwise you are running outdated software and exposing your system to all kinds of compromises.

You can try to remove the old kernel packages as follows:

Get a list of all kernel installed kernel packages:

dpkg -l | grep linux-image

Purge each package from the system:

apt purge linux-image-4.4.0-176-generic

where you run the command for each but two latest kernel packages you have installed.

After purging old packages, you can try running apt-get -f install to complete installation of missing dependencies.

  • +1 but you may also want to avoid deleting the kernel package that matches the exact version that you are currently running (check with uname -a). – Bob May 11 at 15:37
  • Let me reiterate that /boot contains no old kernels, only kernels that are NEWER than the one I'm running. Which ones should I delete? A couple that are in-between what I'm running and the newest one? – GID May 11 at 15:43
  • Yes, you can start from the in-between. You should make sure that you use the most recent kernel though. – Tero Kilkanen May 11 at 15:54
  • I just tried purging an in-between kernel and ran into the same problem as before (unmet dependencies with kernel version 200). It seems using apt to purge is futile, how about brute-force "rm" command and then let "apt-get -f install" clean things up? – GID May 11 at 16:23
  • What does apt install linux-image-4.4.0-200-generic say? – Tero Kilkanen May 12 at 6:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.