You have set the variables
TEXMFLOCAL in your environment, which is not unrecommended.
The TeX programs in the TeX Live distribution are able to figure out the right value for these variables at runtime, by reading the
texmf.cnf files they find in the appropriate locations. Such locations are determined by asking the system where the running binary is located. In a typical (vanilla) TeX Live 2013, binaries are stored in
<arch> depends on the machine and running operating system). From asking the operating system, the running program knows the value of
SELFAUTOPARENT, in this case
/usr/local/texlive/2013 and tries to read a
texmf.cnf file there, if existent. Then it reads
and this is where your setting failed. The TeX programs never override the value of a variable that has already been set. So the second
texmf.cnf file doesn't set
TEXMF to the correct value for the 2013 distribution, which should be
while TeX Live 2012 set it to
/usr/local/texlive/2012/texmf. This is where the thing went wrong.
Moral of the story: never set the
TEX... variables in the environment, with the possible exception of
...INPUTS variables can also be set, check the documentation.