How to update Ubuntu with disk full error?

The following commands below are for updating Ubuntu

sudo apt-get update        # Fetches the list of available updates
sudo apt-get upgrade       # Strictly upgrades the current packages
sudo apt-get dist-upgrade  # Installs updates (new ones)
sudo apt-get autoremove
sudo reboot

If we receive this error that means the server has not enough space anymore. We have to clean it up

Unpacking linux-image-4.4.0-119-generic (4.4.0-119.143) ...
dpkg: error processing archive /var/cache/apt/archives/linux-image-4.4.0-119-generic_4.4.0-119.143_amd64.deb (--unpack):
 cannot copy extracted data for './boot/vmlinuz-4.4.0-119-generic' to '/boot/vmlinuz-4.4.0-119-generic.dpkg-new': failed to write (No space left on device)
No apport report written because the error message indicates a disk full error
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)

Run this command to list all linux-image- which are available on your computer

dpkg -l | grep linux-image-

Then run this one to purge remove the oldest image

sudo apt-get --purge remove linux-image-4.4.0-91-generic

Maybe it doesn’t work.

The following packages have unmet dependencies:
 linux-image-extra-4.4.0-119-generic : Depends: linux-image-4.4.0-119-generic but it is not going to be installed
 linux-image-extra-4.4.0-91-generic : Depends: linux-image-4.4.0-91-generic but it is not going to be installed
 linux-image-generic : Depends: linux-image-4.4.0-119-generic but it is not going to be installed
                       Recommends: thermald but it is not going to be installed

So you have to delete it manually. Go to /boot and remove file manually

cd /boot

sudo rm abi-4.4.0-91-generic
sudo rm config-4.4.0-91-generic
sudo rm initrd.img-4.4.0-91-generic
sudo rm System.map-4.4.0-91-generic
sudo rm vmlinuz-4.4.0-91-generic

sudo rm abi-4.4.0-92-generic
sudo rm config-4.4.0-92-generic
sudo rm initrd.img-4.4.0-92-generic
sudo rm System.map-4.4.0-92-generic
sudo rm vmlinuz-4.4.0-92-generic

Keep removing files until this command returns no error anymore

apt-get -f autoremove

And in the end, we can update Ubuntu now

sudo apt-get update        # Fetches the list of available updates
sudo apt-get upgrade       # Strictly upgrades the current packages
sudo apt-get dist-upgrade  # Installs updates (new ones)
apt-get autoremove
sudo reboot

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.