How do I free up space on /boot?

so I read through some similar posts however I wasn't able to fix my problem because I'm getting a lot of errors when trying to follow the solutions.

My problem is that whenever I start my system it says the boot drive is full therefore I basically can't install anything right now. I have 37 GB free space on my disk ( it's a small USB drive).

So here's what I did so far.

uname - r

4.10.0-42-generic

awk '/^ii/{ print $2}' | grep -v -e uname -r | cut -f1,2 -d"-" | grep -e '[0-9]'

 linux-headers-4.10.0-28 linux-headers-4.10.0-28-generic linux-headers-4.10.0-37 linux-headers-4.10.0-37-generic linux-headers-4.10.0-38 linux-headers-4.10.0-38-generic linux-headers-4.10.0-40 linux-headers-4.10.0-40-generic linux-headers-4.4.0-103 linux-headers-4.4.0-103-generic linux-headers-4.4.0-104 linux-headers-4.4.0-104-generic linux-headers-4.4.0-98 linux-headers-4.4.0-98-generic linux-image-4.10.0-28-generic linux-image-4.10.0-37-generic linux-image-4.10.0-38-generic linux-image-4.10.0-40-generic linux-image-4.4.0-103-generic linux-image-4.4.0-104-generic linux-image-4.4.0-98-generic

sudo apt-get -y purge

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-extra-4.4.0-109-generic : Depends: linux-image-4.4.0-109-generic but it is not installed linux-image-extra-4.4.0-116-generic : Depends: linux-image-4.4.0-116-generic but it is not installed linux-image-generic : Depends: linux-image-4.4.0-116-generic but it is not installed
E: Unmet dependencies. Try using -f.

This is one thing I tried and it's basically always showing unmet dependencies no matter what type of solution I'm trying to go for. I really don't know what I'm doing anyway, just want to free space on /boot.


sudo apt-get install aptitude
[sudo] password for someone:
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: aptitude : Depends: aptitude-common (= 0.7.4-2ubuntu2) but it is not going to be installed Depends: libcwidget3v5 but it is not going to be installed linux-image-extra-4.4.0-109-generic : Depends: linux-image-4.4.0-109-generic but it is not going to be installed linux-image-extra-4.4.0-116-generic : Depends: linux-image-4.4.0-116-generic but it is not going to be installed linux-image-generic : Depends: linux-image-4.4.0-116-generic but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
3

3 Answers

Assuming the two kernels you will want to keep are:

linux-headers-4.10.0-38 linux-headers-4.10.0-38-generic
linux-headers-4.10.0-40 linux-headers-4.10.0-40-generic

So delete the others out of /boot to free space:

sudo rm /boot/*4.10.0-28*
sudo rm /boot/*4.10.0-37*
sudo rm /boot/*4.4.0-103*
sudo rm /boot/*4.4.0-104*
sudo rm /boot/*4.4.0-98*
sudo rm /boot/*4.10.0-28*
sudo rm /boot/*4.10.0-38*
sudo rm /boot/*4.4.0-103*
sudo rm /boot/*4.4.0-98*

This will save you about 500 MB in /boot but doesn't remove the kernel packages fully. To do that use:

sudo apt autoremove

You can remove unused kernel packages by simply typing:

sudo apt autoremove
1

This is a community wiki. Feel free to edit.

Insufficient Disk Space

First, I suspect you do not have a separate /boot partition because a full /boot partition should not affect the installation of non-kernel packages. You can check by examining the output of the df command.

To free up disk space, look in $HOME/.cache/ and /var/cache/ for files to delete. You may also run apt-get autoclean or apt-get clean. The difference between the two commands is autoclean removes only obsolete deb files, while clean removes all deb files.

Try using aptitude if you have it installed because it will attempt to resolve dependencies, whereas apt and apt-get do not.

If aptitude is not available to you, try to remove each individual package one at a time with apt-get remove [package]. I would start with the linux-headers-* packages because accidentally removing a wrong one of those is less likely to result in an unbootable system.

You can also look for *-dev packages to remove if you do not normally do much coding.

In the future, debfoster and deborphan may be helpful for keeping extraneous packages to a minimum.

Insufficient space on /boot Partition

Warning: Messing with the /boot partition may result in an unbootable system.

Go to /boot and delete img files not associated with the kernel currently being used.

3

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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

You Might Also Like