4

Problems with ubuntu apt-get install -f

W: Some index files failed to download. They have been ignored, or old ones used instead.
E: Problem executing scripts APT::Update::Post-Invoke-Success 'test -x /usr/bin/apt-show-versions || exit 0 ; apt-show-versions -i'
E: Sub-process returned an error code
E: Write error - write (28: No space left on device)
E: IO Error saving source cache
E: The package lists or status file could not be parsed or opened.

I tried mount back the tmp but it doesnts works Someone know How to fix it?

root@pipoca:/var/tmp# mount /tmp
mount: can't find /tmp in /etc/fstab

root@pipoca:/var/tmp# free -m
              total        used        free      shared  buff/cache   available
Mem:           3008         868        1327          13         812        1964
Swap:           263           0         263

root@pipoca:/tmp# df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            1.5G     0  1.5G   0% /dev
tmpfs           301M  4.5M  297M   2% /run
/dev/vda1        25G   25G     0 100% /
tmpfs           1.5G  8.0K  1.5G   1% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           1.5G     0  1.5G   0% /sys/fs/cgroup
/dev/vda15      105M  3.6M  101M   4% /boot/efi
tmpfs           301M     0  301M   0% /run/user/0



    root@pipoca:/# dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | xargs sudo apt-get -y purge
dpkg-query: no packages found matching linux-*
Reading package lists... Error!
E: Write error - write (28: No space left on device)
E: IO Error saving source cache
E: The package lists or status file could not be parsed or opened.

using

sudo apt autoremove
sudo apt autoclean

I got

E: Write error - write (28: No space left on device)
E: Write error - write (28: No space left on device)

using

root@pipoca:/# sudo journalctl --vacuum-time=2d
Vacuuming done, freed 0B of archived journals on disk.
root@pipoca:/# journalctl --vacuum-size=500M
Vacuuming done, freed 0B of archived journals on disk.

root@pipoca:/# apt-get update
Hit:1 http://mirrors.digitalocean.com/ubuntu xenial InRelease
Hit:2 http://mirrors.digitalocean.com/ubuntu xenial-updates InRelease
Hit:3 http://mirrors.digitalocean.com/ubuntu xenial-backports InRelease
Hit:4 http://software.virtualmin.com/vm/6/gpl/apt virtualmin-xenial InRelease
Hit:5 http://software.virtualmin.com/vm/6/gpl/apt virtualmin-universal InRelease
Hit:6 http://security.ubuntu.com/ubuntu xenial-security InRelease
Hit:7 https://packages.microsoft.com/ubuntu/16.04/prod xenial InRelease
Hit:8 http://archive.ubuntu.com/ubuntu xenial InRelease
not a reference at /usr/bin/apt-show-versions line 222.
Reading package lists... Done
E: Problem executing scripts APT::Update::Post-Invoke-Success 'test -x /usr/bin/apt-show-versions || exit 0 ; apt-show-versions -i'
E: Sub-process returned an error code
2
  • 2
    As apt needs some space to run, first delete some files, then run apt
    – pLumo
    Apr 13, 2019 at 16:31
  • Use uname -r to get the release # of the current kernel. Delete NO file/dir with this string as part of its name. Look for (with ls -l) old files in /var/log/, /boot/, /home/$USER and delete them manually. Then sudo apt autoremove. This is why many people have separate partitions for /, /home', /boot`.
    – waltinator
    Apr 17, 2019 at 16:19

2 Answers 2

4

Your hard drive is full.

As df does not show any other empty space, you will need to delete something.

First remove not needed data from your /home, e.g. you could move Pictures, Videos and Music to an external drive or remove them you don't need anymore. Remove files in ~/.thumbnails folder. You might use bleachbit to gain more space (it tries to delete cached files, etc.).

After that, try:

sudo apt autoremove
sudo apt autoclean

But all this is just a temporary solution, 25G is just very little space for OS and data.

I see two possibilities:

  • Install less programs and keep less data on your drive.

or

  • Install a second hard drive for /home.
2

Looks like you need to delete some files anywhere under /. Your df -h output shows that is full.

You might find du (disk usage) helpful in seeing what specific directories have a lot of data, maybe more than expected.

Often /var/log and ~/Downloads accumulate a lot of unnecessary data.

Sometimes journalctl - the systemd log facility, uses a lot of memory unexpectedly. The amount it uses can be controlled:

Retain only the past two days:

sudo journalctl --vacuum-time=2d

Retain only the past 500 MB:

journalctl --vacuum-size=500M

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