I'm starting pdflatex from a shell-script invoked as cgi-bin application on Ubuntu (running under default www-data user) and from time to time I have the following kind of error preventing compiling:

kpathsea: Running mktextfm larm0700
mktextfm: mktexdir ./.texmf-var/fonts/tfm/lh/lh-t2a failed.
kpathsea: Appending font creation commands to missfont.log.

./thebook.tex:330: Font T2A/cmr/m/n/7=larm0700 at 7.0pt not loadable: Metric (T
FM) file not found.
<to be read again> 
l.330 10 м/с\textsuperscript{2}

./thebook.tex:330:  ==> Fatal error occurred, no output PDF file produced!
Transcript written on thebook.log.

Inspection shows that an empty directory .texmf-var/fonts/tfm/lh/lh-t2a created in a working dir (in contrast with mktexdir message).

Running the same script with sudo -u www-data fixes the problem temporary: fonts are generated and then this particular document can be compiled from the cgi-bin script. But it does not provide stable result: as new fonts are needed, cgi-bin script stops working again.

The similar problems are discussed also here, here, here, here, here (in Russian), here and maybe somewhere else, but no clear solutions provided.


The problem was solved by adding

export HOME='/var/www'

to the shell-script just before the pdflatex command.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.