On a freshly installed basic-miktex-2.9.6361-x64.exe with all current updates, processing a document fails after every installation of a missing package. Repeating the command over and over again eventually succeeds.
The XeLaTeX log ends with:
2017-08-26 05:31:24,052+0200 INFO xelatex - mpm: downloading ftp://ftp.tu-chemnitz.de/pub/tex/systems/win32/miktex/tm/packages/l3kernel.tar.lzma...
2017-08-26 05:31:26,602+0200 INFO xelatex - mpm: 5991361 bytes, 2317.20 KB/Sec
2017-08-26 05:31:26,616+0200 INFO xelatex - mpm: extracting files from l3kernel.tar.lzma...
2017-08-26 05:31:29,941+0200 FATAL xelatex - The executed process did not succeed.
2017-08-26 05:31:29,941+0200 FATAL xelatex - Info: fileName="C:\Program Files\MiKTeX 2.9\miktex\bin\x64\initexmf.exe", exitCode="1"
2017-08-26 05:31:29,941+0200 FATAL xelatex - Source: Libraries\MiKTeX\Core\Process\Process.cpp
2017-08-26 05:31:29,941+0200 FATAL xelatex - Line: 156
2017-08-26 05:31:32,713+0200 INFO xelatex - finishing with exit code 0
The initexmf log ends with:
2017-08-26 05:31:29,596+0200 WARN initexmf - The link target C:\Users\chris\AppData\Roaming\MiKTeX\2.9\miktex/bin/x64\miktex-pdftotext.exe does not exist.
2017-08-26 05:31:29,596+0200 WARN initexmf - The link target C:\Users\chris\AppData\Roaming\MiKTeX\2.9\miktex/bin/x64\miktex-pdfunite.exe does not exist.
2017-08-26 05:31:29,628+0200 FATAL initexmf - Windows API error 5: Access is denied.
2017-08-26 05:31:29,628+0200 FATAL initexmf - Info: newName="C:\Users\chris\AppData\Roaming\MiKTeX\2.9\miktex/bin/x64\amstex.exe", oldName="C:\Program Files\MiKTeX 2.9\miktex\bin\x64\miktex-pdftex.EXE"
2017-08-26 05:31:29,628+0200 FATAL initexmf - Source: Libraries\MiKTeX\Core\File\win\winFile.cpp
2017-08-26 05:31:29,628+0200 FATAL initexmf - Line: 360
From the code around that line, it looks like initexmf wants to create a hard link in the user profile. The current user lacks the appropriate privilege to create hard links. The directory of "newName" above exists and is empty after the error.
A procmon log shows that at the same time, "initexmf --mklinks --mkmaps" fails to open miktex-pdftex.exe (path as above) with result "access denied", as is expected in this situation.
This behavior is not new; I have seen it repeatedly for at least a year.
I was not able to reproduce this and I have not enough info to help fixing the issue.
Last edit: Christian Schenk 2017-08-26
If it happened on your system, I do believe you would have found and fixed it already.
I will be happy to provide whatever information you need; it would have been more efficient, not to mention polite, to tell me what you need without making me ask.
Thank you. Then please do the following:
C:\Users\chris\AppData\Roaming\MiKTeX\2.9\miktex\bin\x64)mklink /H hardlinktest.exe miktex-pdftex.exeAccording to procmon, which shows a failed operation named "SetLinkInformation", write access to the target file is required to create a hard link. This makes some sense given the weird implementation of hardlinks in Windows, where you can get a list of links without scanning the whole volume (the "fsutil hardlink list" command). For this to work, the information must be stored somewhere, and that somewhere is best controlled by the file's own ACL.
I can hardlink my own files:
I think the problem here is not whether or not I can create a hard link to an executable in %PROGRAMFILES% within my user profile, but why installing a package even attempts to do that by running initexmf --mklinks. Where is the point in having local "copies"?
I have disabled the creation of links if a TeX engine installs missing packages.