I have just installed MiKTex 2.9 in Windows 7. I had this problem and fixed it by deleting the .fndb files.
The first time I try to compile a "hello world" .tex file , a window pops up titled Package Installation telling me that a file is missing and I need to install the package cmap.
I click Install and it shows, after downloading the package, Unfortunately, the package cmap could not be installed.Please check the log file: C:/Users/Matt/AppData/Local/MiKTeX/2.9/miktex/log/pdflatex.log.
The log file contains:
2015-09-08 23:55:22,798+1200 INFO pdflatex - installing package cmap triggered by tex\latex\cmap\cmap.sty
2015-09-08 23:55:25,488+1200 INFO pdflatex - mpm: starting package maintenance...
2015-09-08 23:55:25,488+1200 INFO pdflatex - mpm: installation directory: "F:\Prog\MiKTeX 2.9"
2015-09-08 23:55:25,488+1200 INFO pdflatex - mpm: package repository: http://mirror.aut.ac.nz/CTAN/systems/win32/miktex/tm/packages/
2015-09-08 23:55:25,728+1200 INFO pdflatex - mpm: lightweight database digest: fd7a40a42ed2f1e70be3b6bdb1baccf2
2015-09-08 23:55:25,738+1200 INFO pdflatex - mpm: going to download 7251 bytes
2015-09-08 23:55:25,738+1200 INFO pdflatex - mpm: going to install 14 file(s) (1 package(s))
2015-09-08 23:55:25,738+1200 INFO pdflatex - mpm: downloading http://mirror.aut.ac.nz/CTAN/systems/win32/miktex/tm/packages/cmap.tar.lzma...
2015-09-08 23:55:25,908+1200 INFO pdflatex - mpm: 7251 bytes, 41.65 KB/Sec
2015-09-08 23:55:25,918+1200 INFO pdflatex - mpm: extracting files from cmap.tar.lzma...
2015-09-08 23:55:25,938+1200 FATAL pdflatex - Windows API error 87: The parameter is incorrect.
I have found that if I close TeXworks and open the MiKTex Package Manager, I can enter cmap and install the package successfully. But then when I reopen TeXworks and build my file again, the exact same thing happens but with babel-english instead of cmap. I have no idea how many packages it is going to need and this could be very time-consuming...
Is there a way to fix the auto package download?
I tried installing package ms as suggested here but that did not fix the problem.
Update: I discovered that if I run the Package Manager while TexWorks is still open, then the package installation for babel-english fails with the same Windows API error 87: The parameter is incorrect. but it gives extra information:
Data: C:\ProgramData\MiKTeX\2.9\miktex/data/le\0830eb7b3437d95b9288750893206d6f.fndb
So I wonder if this problem is related to or in fact the exact same problem as the first one.
pdflatex myfile.texthen the package autoinstallation works correctly – M.M Sep 08 '15 at 12:09C:\ProgramData\MiKTeX\2.9\miktex/data/lefiles. You can only install packages when TeXworks is closed. The issue is being worked on (see bug report #2394). In the meantime compile from the command line if you need on-the-fly install or use another editor. – moewe Sep 08 '15 at 12:10