2014-09-16 15:39:08 +02:00
|
|
|
|
<section xmlns="http://docbook.org/ns/docbook"
|
2014-08-27 18:41:09 +02:00
|
|
|
|
xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
|
|
|
xmlns:xi="http://www.w3.org/2001/XInclude"
|
|
|
|
|
version="5.0"
|
2014-09-16 15:39:08 +02:00
|
|
|
|
xml:id="sec-links-nix-store">
|
2014-08-27 18:41:09 +02:00
|
|
|
|
|
|
|
|
|
<title><quote>Too many links</quote> Error in the Nix store</title>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<para>Symptom: when building something, you get an error message such as
|
|
|
|
|
|
|
|
|
|
<screen>
|
|
|
|
|
...
|
|
|
|
|
<literal>mkdir: cannot create directory `/nix/store/<replaceable>name</replaceable>': Too many links</literal></screen>
|
|
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
|
|
<para>This is usually because you have more than 32,000 subdirectories
|
|
|
|
|
in <filename>/nix/store</filename>, as can be seen using <command>ls
|
|
|
|
|
-l</command>:
|
|
|
|
|
|
|
|
|
|
<screen>
|
2014-12-13 23:23:19 +01:00
|
|
|
|
$ ls -ld /nix/store
|
2014-08-27 18:41:09 +02:00
|
|
|
|
drwxrwxrwt 32000 nix nix 4620288 Sep 8 15:08 store</screen>
|
|
|
|
|
|
|
|
|
|
The <literal>ext2</literal> file system is limited to an inode link
|
|
|
|
|
count of 32,000 (each subdirectory increasing the count by one).
|
|
|
|
|
Furthermore, the <literal>st_nlink</literal> field of the
|
|
|
|
|
<function>stat</function> system call is a 16-bit value.</para>
|
|
|
|
|
|
|
|
|
|
<para>This only happens on very large Nix installations (such as build
|
|
|
|
|
machines).</para>
|
|
|
|
|
|
|
|
|
|
<para>Quick solution: run the garbage collector. You may want to use
|
|
|
|
|
the <option>--max-links</option> option.</para>
|
|
|
|
|
|
|
|
|
|
<para>Real solution: put the Nix store on a file system that supports
|
2014-12-13 23:23:19 +01:00
|
|
|
|
more than 32,000 subdirectories per directory, such as ext4. (This
|
|
|
|
|
doesn’t solve the <literal>st_nlink</literal> limit, but ext4 lies to
|
|
|
|
|
the kernel by reporting a link count of 1 if it exceeds the
|
|
|
|
|
limit.)</para>
|
2014-08-27 18:41:09 +02:00
|
|
|
|
|
2014-09-16 15:39:08 +02:00
|
|
|
|
</section>
|