Wednesday, January 3, 2018

14.04 - apt-get reports no space left on device



My machine has got into a state where I cannot apt-get anything.



When I run apt-get upgrade I get



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-headers-generic-lts-xenial : Depends: linux-headers-4.4.0-124-generic but it is not installed
E: Unmet dependencies. Try using -f.


So I do apt-get -f install:



Reading package lists... Done
Building dependency tree
Reading state information... Done

Correcting dependencies... Done
The following extra packages will be installed:
linux-headers-4.4.0-124 linux-headers-4.4.0-124-generic
The following NEW packages will be installed
linux-headers-4.4.0-124 linux-headers-4.4.0-124-generic
0 to upgrade, 2 to newly install, 0 to remove and 67 not to upgrade.
8 not fully installed or removed.
Need to get 0 B/10.8 MB of archives.
After this operation, 87.6 MB of additional disk space will be used.
Do you want to continue? [Y/n] y

(Reading database ... 1218968 files and directories currently installed.)
Preparing to unpack .../linux-headers-4.4.0-124_4.4.0-124.148~14.04.1_all.deb ...
Unpacking linux-headers-4.4.0-124 (4.4.0-124.148~14.04.1) ...
dpkg: error processing archive /var/cache/apt/archives/linux-headers-4.4.0-124_4.4.0-124.148~14.04.1_all.deb (--unpack):
unable to create `/usr/src/linux-headers-4.4.0-124/include/net/irda/irqueue.h.dpkg-new' (while processing `./usr/src/linux-headers-4.4.0-124/include/net/irda/irqueue.h'): 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)
Preparing to unpack .../linux-headers-4.4.0-124-generic_4.4.0-124.148~14.04.1_amd64.deb ...
Unpacking linux-headers-4.4.0-124-generic (4.4.0-124.148~14.04.1) ...
dpkg: error processing archive /var/cache/apt/archives/linux-headers-4.4.0-124-generic_4.4.0-124.148~14.04.1_amd64.deb (--unpack):

error creating directory `./usr/src/linux-headers-4.4.0-124-generic/include/config/altera': 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)
Errors were encountered while processing:
/var/cache/apt/archives/linux-headers-4.4.0-124_4.4.0-124.148~14.04.1_all.deb
/var/cache/apt/archives/linux-headers-4.4.0-124-generic_4.4.0-124.148~14.04.1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)


Indicates the disk is full. It has about 3GB and 3.7k inodes free so I don't know if I believe that's really the problem:




root@laptop15:/tmp# df -h
Filesystem Size Used Avail Use% Mounted on
udev 3.9G 4.0K 3.9G 1% /dev
tmpfs 788M 2.3M 786M 1% /run
/dev/sda5 20G 17G 2.0G 90% /
none 4.0K 0 4.0K 0% /sys/fs/cgroup
none 5.0M 0 5.0M 0% /run/lock
none 3.9G 31M 3.9G 1% /run/shm
none 100M 40K 100M 1% /run/user

/dev/sda1 47M 3.2M 44M 7% /boot/efi
/dev/sda4 200G 119G 72G 63% /home
/dev/sda2 880M 12M 802M 2% /scratch
/dev/loop0 87M 87M 0 100% /snap/core/4571
/dev/loop1 87M 87M 0 100% /snap/core/4407
/dev/loop2 87M 87M 0 100% /snap/core/4486

root@laptop15:/tmp# df -i
Filesystem Inodes IUsed IFree IUse% Mounted on
udev 1005270 496 1004774 1% /dev

tmpfs 1008404 592 1007812 1% /run
/dev/sda5 1305600 1301852 3748 100% /
none 1008404 15 1008389 1% /sys/fs/cgroup
none 1008404 5 1008399 1% /run/lock
none 1008404 385 1008019 1% /run/shm
none 1008404 33 1008371 1% /run/user
/dev/sda1 0 0 0 - /boot/efi
/dev/sda4 13279232 321559 12957673 3% /home
/dev/sda2 65408 14 65394 1% /scratch
/dev/loop0 12831 12831 0 100% /snap/core/4571

/dev/loop1 12817 12817 0 100% /snap/core/4407
/dev/loop2 12819 12819 0 100% /snap/core/4486


I have freed up a load of space already, but it has not helped. A huge amount of the space and inodes are used by old linux-headers, linux-image and linux-image-extra packages which never get deleted. /usr/share contains 4.3GB / 960,871 files pertaining to linux-headers, for example.



apt-get autoremove and apt-get autoremove -f both fail in similar ways. I am stuck being told to free up space, but the thing using up the space doesn't work because (it says) there is no space, even though there is.



How can I get out of this cycle please?




In such cases I tend to just manually delete some old kernel headers in /usr/src/. In my experience this does not lead to errors when removing the header package later on.



On my machine headers of one kernel are more than 10k files, so 3.7k free inodes don't get you far when installing kernel headers. The low amount of free inodes is definitely a problem on your machine and can often be solved by apt-get autoremove to remove old kernels and their headers.


No comments:

Post a Comment

11.10 - Can't boot from USB after installing Ubuntu

I bought a Samsung series 5 notebook and a very strange thing happened: I installed Ubuntu 11.10 from a usb pen drive but when I restarted (...