# Problem with LuaTeX : can't write on the .aux file at second pass [closed]

I use MiKTeX 2.9 for Windows, format Plain eTeX. I have my own macro package which I've used for years, and I tried recently to use it with LuaTeX (included MiKTeX version) in order to use UTF-8 encoding (say). All things worked fine at the first pass and LuaTeX correctly created the `.aux` file and wrote suitable commands. But at the second pass, LuaTeX failed and output the message:

I can't write on file luatest.aux.

My macro package uses only eTteX commands like openin/write etc. and all things work fine when compiled with pdfTeX. I believe this is only a matter of parameter setting when calling LuaTex from the command line, but what can it be ?

-

## closed as too localized by Stephan Lehmke, egreg, Guido, Kurt, lockstepDec 2 '12 at 6:36

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. If this question can be reworded to fit the rules in the help center, please edit the question.

LuaTeX should behave exactly like PDFTeX or other TeX engines, so this looks like a bug somewhere. Or perhaps the file `luatest.aux` is opened by some process? –  topskip Oct 28 '12 at 6:56
What directory is luatex trying to write `luatest.aux`? What if you have `luatest.tex` in your home directory? –  egreg Oct 28 '12 at 8:33
I set the directory to be the current directory (cd foodirectory) and all things are done there. Notice that at the first pass, Luatex has no problem to create the .aux file and to write it. So, I don't think that this is a problem of directory. –  MikeTeX Oct 28 '12 at 8:40
@MikeTeX This error indicates that the .aux-file is open. Go to the directory where the -aux-file is, and try to deleted the it. I have often this problem with sync-files, that remains open after a failed compilation. Maybe you computer is to fast, and start the new compilation before Luatex is able to close the .aux-file. Do you use Texify or Luatex directly? In case of Texify, try compiling directly with Luatex, and with a second or two pause between the to run. –  Sveinung Oct 28 '12 at 9:56
Thank you Sveinung, but I am using Luatex directly, and I compile the two passes manually (one after one), so, there cannot be a problem of computer speed. –  MikeTeX Oct 28 '12 at 12:11