3

I'm a Windows guy but our Linux guy is out, so please excuse my ignorance here.

I have a server running 20.04 and it states that I have a lot of updates to apply. When I run the command sudo apt-get updates, it rolls through the updates and then errors out "Error writing to the output file - write (28: No Space left on device)

When I run df -H I see this:

administrator@ntpjjc1:~$ sudo df -H
Filesystem      Size  Used Avail Use% Mounted on
udev            2.1G     0  2.1G   0% /dev
tmpfs           413M  1.3M  412M   1% /run
/dev/sda2        42G  8.3G   32G  21% /
tmpfs           2.1G     0  2.1G   0% /dev/shm
tmpfs           5.3M     0  5.3M   0% /run/lock
tmpfs           2.1G     0  2.1G   0% /sys/fs/cgroup
/dev/sda8       8.9G  3.0M  8.5G   1% /home
/dev/sda4       2.1G  1.9G   37M  99% /var
/dev/sda3       512M   70k  474M   1% /tmp
/dev/loop0       59M   59M     0 100% /snap/core18/2538
/dev/loop1       59M   59M     0 100% /snap/core18/2785
/dev/loop2       67M   67M     0 100% /snap/core20/1695
/dev/loop6       56M   56M     0 100% /snap/snapd/19361
/dev/loop5       97M   97M     0 100% /snap/lxd/24061
/dev/loop3       97M   97M     0 100% /snap/lxd/23991
/dev/loop4       67M   67M     0 100% /snap/core20/1891
/dev/sda6       5.3G   74M  4.9G   2% /var/log
/dev/sda5       2.1G   33k  2.0G   1% /var/tmp
/dev/sda7       2.1G  529k  2.0G   1% /var/log/audit
tmpfs           413M     0  413M   0% /run/user/1000

Ok, it looks as though /var is the issue...

When I run sudo du /var -h dl I see that /var/lib/snapd is 1.4G in size and that /var/lib/snapd/snaps is taking up 712M.

When I try to run sudo apt upgrade I receive the following error message: "You might want to run apt --fix-broken install to correct these. The following packages have unmet dependencies:"

When I run sudo apt --fix broken install I receive the following error: You don't have enough free space in /var/cache/apt/archives

administrator@ntpjjc1:~$ sudo apt --fix-broken install
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following additional packages will be installed:
  linux-generic linux-headers-5.4.0-150 linux-headers-5.4.0-150-generic linux-headers-generic linux-image-5.4.0-150-generic linux-image-generic
  linux-modules-5.4.0-150-generic linux-modules-extra-5.4.0-150-generic open-vm-tools
Suggested packages:
  fdutils linux-doc | linux-source-5.4.0 linux-tools open-vm-tools-desktop
The following NEW packages will be installed:
  linux-headers-5.4.0-150 linux-headers-5.4.0-150-generic linux-image-5.4.0-150-generic linux-modules-5.4.0-150-generic
  linux-modules-extra-5.4.0-150-generic
The following packages will be upgraded:
  linux-generic linux-headers-generic linux-image-generic open-vm-tools
4 upgraded, 5 newly installed, 0 to remove and 197 not upgraded.
5 not fully installed or removed.
Need to get 77.9 MB of archives.
After this operation, 380 MB of additional disk space will be used.
E: You don't have enough free space in /var/cache/apt/archives/.

And finally, when I run sudo du /var/cache/apt/archives/ -h

dministrator@ntpjjc1:~$ sudo du /var/cache/apt/archives/ -h
4.0K    /var/cache/apt/archives/partial
20K     /var/cache/apt/archives/

So, my question is, how do I free up space so that I can install updates?

I have run the following commands:

sudo apt clean
sudo apt autoclean
sudo apt autoremove

When I run sudo apt autoremove I go back to the broken dependencies error mentioned above.

I seem to be in a circle but not sure what commands will work to break this cycle.

Thanks! -Mike

Archisman Panigrahi
  • 28,338
  • 18
  • 105
  • 212

1 Answers1

2

You have some old revisions of snaps that could be removed and would free up some space.

sudo snap remove core18 --revision=2538
sudo snap remove core20 --revision=1695
sudo snap remove lxd --revision=23991

These are the previous versions of those packages, which aren't needed. They're only kept around in case you needed to revert a broken package back to a working one.

popey
  • 23,667