4

So spent the afternoon simply trying to upgrade from Ubuntu 18.04 to 20.04

using the following command

sudo update-manager -c -d

But repeatedly get the following error popup when the installation is half complete

Not enough free disk space

The upgrade has aborted. The upgrade needs a total of 4,520 M free space on disk '/'. Please free at least an additional 3,510 M of disk space on '/'. Empty your trash and remove temporary packages of former installations using 'sudo apt-get clean'.

I've gone thru all the usual steps to free up space including removing ALL but necessary linux kernels et. Search and found a similar 3 year old question here Can't update ubuntu - not enough free disk space

This is the result of a $df command

Filesystem     1K-blocks      Used Available Use% Mounted on
udev            32870524         0  32870524   0% /dev
tmpfs            6588324      2076   6586248   1% /run
/dev/sda2       41153856  38030268   1010052  98% /
tmpfs           32941612         0  32941612   0% /dev/shm
tmpfs               5120         4      5116   1% /run/lock
tmpfs           32941612         0  32941612   0% /sys/fs/cgroup
/dev/loop0         56320     56320         0 100% /snap/core18/1705
/dev/nvme1n1p1 491209736     71596 466116444   1% /mnt/xxxxxxxxxxxx
/dev/loop1        114432    114432         0 100% /snap/cmake/340
/dev/loop2        116992    116992         0 100% /snap/cmake/283
/dev/loop3         56320     56320         0 100% /snap/core18/1754
/dev/loop4         56064     56064         0 100% /snap/core18/1668
/dev/sda1         562084      7324    554760   2% /boot/efi
/dev/loop5        114432    114432         0 100% /snap/cmake/323
/dev/sda3      660427896 538425036  88432044  86% /home
tmpfs            6588320        52   6588268   1% /run/user/1000

Can any experienced linux users suggest what steps i should take next? Thanks and regards

1
  • 2
    the error message is clear - not enough space on the root partition - your 40GB root partition has only 1GB free. so you probably have a lot of non-system files there. check the files YOU put there and clean up. don't touch the linux system folders...
    – Zina
    Commented May 25, 2020 at 9:32

2 Answers 2

1

You can try some things to free a bit (or a lot) of space from the / partition. Let's see in order of potential benefit:

1. (Re)move the swapfile

It seems your installation doesn't include a swap partition and is probably using a swapfile for memory swap. The default location for it is /swapfile, occupying many gigabytes of space in your small system partition. You could:

  • disable the swap and remove the swapfile temporarily during the upgrade;
  • move the swapfile to another partition (ex.: /home) with more free space;
  • shrink the /home partition and create a swap partition to substitute the swapfile.

Search the internet for how to do this.

2. Uninstall large unused packages

You could search for packages that you installed manually but doesn't need anymore, or even just uninstall some large packages temporarily and reinstall after the upgrade.

Here is a command to list the 20 installed packages in Debian-based systems that use most disk space:

$ dpkg-query -Wf '${Installed-Size}\t${db:Status-Abbrev} ${Package}\n' | grep 'ii ' | sort -n | tail -n 20

If you don't recognize a particular package, which is probably a dependence for other important package, you can investigate with:

apt rdepends --installed <package-name>

Be careful to only remove manually installed packages/dependencies!

3. Clean up packages

As a last resource, run these two commands:

$ sudo apt autoremove --purge
$ sudo apt autoclean
0

Had the same problem and found the most effective thing is running sudo apt-get clean which deletes the contents of /var/cache/apt/archives/ and moving large folders to another partition to then create symlinks at their original location like so for a file moved out of /var/lib/clamav/ as an example: sudo ln -s "/home/username/Software/daily.cld" "/var/lib/clamav/daily.cld".

I don't think it's a good idea to remove the swapfile if doing so can be avoided.
The two ways are just those I found most useful upgrading Debian; more ways as well as alternatives to deleting lots of data when you have too little disk space for an upgrade are listed at How to clean up a Linux system to free up disk space? (without deleting personal files)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .