4

Somehow my system is in a pickle.

$ sudo apt-get install -f
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
  linux-headers-3.2.0-29 linux-headers-3.2.0-29-generic
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
  linux-headers-3.2.0-80
The following NEW packages will be installed
  linux-headers-3.2.0-80
0 to upgrade, 1 to newly install, 0 to remove and 251 not to upgrade.
3 not fully installed or removed.
Need to get 0 B/11.7 MB of archives.
After this operation, 56.4 MB of additional disk space will be used.
Do you want to continue [Y/n]? 
(Reading database ... 1255202 files and directories currently installed.)
Unpacking linux-headers-3.2.0-80 (from .../linux-headers-3.2.0-80_3.2.0-80.116_all.deb) ...
dpkg: error processing /var/cache/apt/archives/linux-headers-3.2.0-80_3.2.0-80.116_all.deb (--unpack):
 unable to create `/usr/src/linux-headers-3.2.0-80/include/linux/sunrpc/gss_err.h.dpkg-new' (while processing `./usr/src/linux-headers-3.2.0-80/include/linux/sunrpc/gss_err.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)
Errors were encountered while processing:
 /var/cache/apt/archives/linux-headers-3.2.0-80_3.2.0-80.116_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

But:

us@desktop:/var/log$ df
Filesystem     1K-blocks     Used Available Use% Mounted on
/dev/sda1       20158332 16166516   2967816  85% /
udev             4026512        4   4026508   1% /dev
tmpfs             807064      996    806068   1% /run
none                5120        0      5120   0% /run/lock
none             4035308      128   4035180   1% /run/shm
/dev/sda4      904990760 51533960 807485908   6% /home

Stumped!

us@desktop:~$ df -i
Filesystem       Inodes   IUsed    IFree IUse% Mounted on
/dev/sda1       1281120 1278499     2621  100% /
udev            1006628     507  1006121    1% /dev
tmpfs           1008827     445  1008382    1% /run
none            1008827       3  1008824    1% /run/lock
none            1008827       6  1008821    1% /run/shm
/dev/sda4      57466880  110192 57356688    1% /home

Oh so the inode table is full. Never had that before, what causes that then?

3
  • 1
    Whats the output of df -i ?
    – heemayl
    Dec 27, 2015 at 10:57
  • 1
    This could be caused by many smaller files created somewhere..run sudo find / -type f -size -1k -ls to check the files of size less than 1 KB and remove if not needed..
    – heemayl
    Dec 27, 2015 at 11:30
  • Ha! It appears to be kernel header files - zillions of them. I've had this before, ubuntu not removing old kernels so you end up with 2 dozen on an LTS box. Thanks, think I'm on my way now. Dec 27, 2015 at 12:03

2 Answers 2

11

As shown in the output of df -i, you are running very low on number of free inodes on / and hence the dpkg fails to complete the operation.

Most of the time, this is caused by numerous small files created somewhere (unintentionally) in the filesystem.

You can check the files of size less than 1 KB and start removing them if not needed:

sudo find / -type f -size -1k -ls

Similarly you can check with increasing file sizes until you get to the root of the problem.

4

All credit to @heemayl for the pointers that resulted in this answer. I've accepted that answer, but here's the details of how I fixed it, in case it's useful to others.

The issue was caused by a full inode table. As I understand, there are two parts to a filesystem, inodes and space. inodes are related to the number of files, where as space is just how big they are. My system was chock-full of millions of tiny files caused by Ubuntu not removing old kernels. As the system has run for a long time I had over 40 kernels, incl. header files, installed which is too much for a 20Gb system partition's file system to take.

This meant dpkg could not complete an installation - it needed more space to complete its work - but unfortunately that meant neither could I create space by using apt to uninstall things!

The solution I found was to move all the /usr/src/ files to my other partition, leaving just a symlink to the files on the full fs:

sudo mv /usr/src /home/usr-src
sudo ln -s /home/usr-src /usr/src

After doing this I was able to let apt complete:

sudo apt install -f

And after that I was able to uninstall all the older kernels that I did not need, freeing up space, and then I could move the src folder back.

1
  • 1
    Think of the filesystem like this: You have a list of names and corresponding numbers. The names are called "directory entries" or "filenames" and the numbers are called "inode numbers." The whole list is called the "root directory" or /. The inode numbers uniquely identify "inodes." The root directory is an inode (number 2 on ext4), as is any other file or directory. Inodes are indexed in a lookup table, which can become full. When it does fill up, you run out of inodes.
    – Kevin
    Dec 27, 2015 at 22:01

You must log in to answer this question.

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