Having upgraded my computer to Windows 10, I found myself unable to install updates to VirtualBox. After downloading the 4.3.40 (build 101610) release, clicking the installer immediately gave the error:
Failed to create extraction path 'C:\Users\jeremy\AppData\Local\Temp\VirtualBox': VERR_ALREADY_EXISTS
Googling this message gave two themes: First was "you cannot upgrade the VirtualBox Guest Extensions while you have a VM in the ‘saved' state" (a common theme on the VirtualBox forums) and then separately some source code which raised the error when it couldn't create a temporary directory. But it didn't give me pointers to any useful fixes.
Having tried various approaches including trying to install VirtualBox 5 instead, uninstalling VirtualBox 4 before running the 4 and 5 installers, and Windows Compatibility settings, I finally hit upon this solution:
Open a command prompt, and change directory to the location where you have downloaded the VirtualBox installer. Then run:
VirtualBox-4.3.40-101610-Win.exe --path .\tmp --extract
(Use the correct
file name for the version you have downloaded)
This will extract the
installer files to a directory called "tmp". Then run the MSI from this folder.
Having done that, the installer completes OK.
Updated to add: In the comments, Chaomai pointed out another solution to this problem:
Thanks for the solution!Having now had a chance to test it, I can confirm his approach works for me as well.
I got another way to fix it: Check C:\Users\jeremy\AppData\Local\Temp. There should be a text file, which name is exactly ‘VirtualBox'.
Delete it and the installer will perform installation correctly.
If you see the error below, his suggestion is to look in the current user's
folder. (which is accessible via the
environment variable on most machines) Here you will find a file called
with no extension:
Delete this file, and re-running the installer will succeed. Cheers Chaomai.