Windows XP OpenVPN TAP installation, "devcon.exe failed"
Although this article mainly targets OpenVPN TAP driver installation issue, The problem is likely not limited to that specific driver.
You may want to continue reading and give the very easy solution at the end of the article a try.
Recently I had to install OpenVPN on a system running Windows XP (Don’t ask). The installation went smoothly up until TAP driver installation and then suddenly things went haywire:
The yellow marked status with the code of 28 in the device manager was not promising either:
In Windows XP, to install its inf file, TAP driver installation uses the built-in Windows Device Console (Devcon.exe). Pretty simple stuff, you just use devcon.exe
with the install argument, supply the inf file and then provide the device’s Hardware ID.
This is the command being used to install each TAP NIC:
"C:\Program Files\TAP-Windows\bin\devcon.exe" install "C:\Program Files\TAP-Windows\driver\OemWin2k.inf" tap0901
Which gave a mundane error:
devcon.exe failed.
Devcon however, leaves a log file of its operation behind in %windir%\setupapi.log
which included these lines:
#E122 Device install failed. Error 2: The system cannot find the file specified.
#E154 Class installer failed. Error 2: The system cannot find the file specified.
#I060 Set selected driver.
#I125 Installing NULL driver for "ROOT\NET\0000".
#E122 Device install failed. Error 2: The system cannot find the file specified.
Now that’s our first clue. There seems to be a file missing somewhere. So after ensuring it’s not an obvious one (like a .sys file required by the inf), I was getting prepared to go deeper to debug the issue.
Luckily, turned out DaveBurnett had already done that and has shared his findings. I thank him for this as he’s possibly saved me couple of hours of struggle.
As it’s been mentioned in that post, if RunOnce
key is missing in the registry (Which could easily happen by a program with a not a very well tested uninstall system), for some unknown reason devcon.exe
dislikes it. So much in fact that it decides to leave the installation in half-state and complain about a missing “specified” “file”.
Just for the fun of it, lets fire up the amazing Process Monitor:
Almost right before failing, you can see the failed accesses to the RunOnce
key.
The fix is utterly simple, just open cmd.exe
as an administrator and use this command to create the missing key again:
reg ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce
Before reinstalling TAP driver however, first remove all the half-installed ones from the Device Manager. For each failed driver installation attempts, you will likely find different entries, some of which labeled as “Unknown device”
To see if either of the Unknown devices are really a malfunctioning TAP driver, check their Hardware ID first:
Then just right-click on each and uninstall them.
“Failed to uninstall the device. The device may be required to boot up the computer.”
error, don’t worry. It should sort itself out after installing the TAP driver.
And then you can just install TAP virtual NICs again by simply using the batch script provided in the TAP driver’s installation folder which defaults to:
C:\Program Files\TAP-Windows\bin\addtap.bat
Oh, You might also want to consider upgrading your OS. It’s for heaven’s sake!