59

I'm running Vagrant (1.8.1) + VirtualBox (5.0.12) on Windows 7 and trying to boot up a Windows 7 image (modernIE/w7-ie8). However, I get this error:

---------------------------
VirtualBox - Error In supR3HardenedWinReSpawn
---------------------------
<html><b>NtCreateFile(\Device\VBoxDrvStub) failed: 0xc0000034 STATUS_OBJECT_NAME_NOT_FOUND (0 retries) (rc=-101)</b><br/><br/>Make sure the kernel module has been loaded successfully.<br><br><!--EOM-->where: supR3HardenedWinReSpawn
what:  3
VERR_OPEN_FAILED (-101) - File/Device open failed.

Driver is probably stuck stopping/starting. Try 'sc.exe query vboxdrv' to get more information about its state. Rebooting may actually help.</html>
---------------------------
OK
---------------------------

I ran the query command, but the service "is not found".

> sc.exe query vboxdrv
[SC] EnumQueryServicesStatus:OpenService FAILED 1060:

The specified service does not exist as an installed service.

I tried rebooting, too. Nothing.

Anthony Mastrean
  • 21,850
  • 21
  • 110
  • 188

6 Answers6

195

I am on windows 10 and following steps works for me:

Steps:

  1. Navigate to "C:\Program Files\Oracle\VirtualBox\drivers\vboxdrv"
  2. Right click on "VBoxDrv.inf" file and select Install option
  3. Open the Console as a administrator and run the following command

    sc start vboxdrv
    
Praetorian
  • 106,671
  • 19
  • 240
  • 328
Ram Ch. Bachkheti
  • 2,609
  • 2
  • 17
  • 14
45

There's something wrong with the installation of VirtualBox (I've been seeing reports of this problem as far back as 4.x). The installer registers an incorrect location for the driver SYS file (the ImagePath in this example).

PS> Get-ItemProperty HKLM:\system\currentcontrolset\services\vboxdrv


Type         : 1
Start        : 3
ErrorControl : 1
ImagePath    : \??\C:\Program Files\Oracle\VirtualBox\VBoxDrv.sys
DisplayName  : VBox Support Driver
PSPath       : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\system\currentcontrolset\services\vboxdrv
PSParentPath : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\system\currentcontrolset\services
PSChildName  : vboxdrv
PSDrive      : HKLM
PSProvider   : Microsoft.PowerShell.Core\Registry

The file doesn't exist.

PS> Test-Path (Get-ItemProperty HKLM:\system\currentcontrolset\services\vboxdrv).ImagePath
False

The actual location requires an extra drivers\vboxdrv.

PS> Test-Path 'C:\Program Files\Oracle\VirtualBox\drivers\vboxdrv\VBoxDrv.sys'
True

You can update the registered location.

PS> Set-ItemProperty HKLM:\system\currentcontrolset\services\vboxdrv -Name ImagePath -Value '\??\C:\Program Files\Oracle\VirtualBox\drivers\vboxdrv\VBoxDrv.sys'

And now you can start the driver/service.

> sc.exe start vboxdrv
Anthony Mastrean
  • 21,850
  • 21
  • 110
  • 188
  • This happened to me when I upgraded to 5.0.20 today, and this answer was spot-on. Thanks! – DanM May 22 '16 at 18:09
  • The same issue occurred when updating to VirtualBox 5.1.18 today, from 5.1.14, I believe. The "tests" showed exactly the same results, and your solution made it work again! – Andreas Jansson Apr 18 '17 at 11:55
  • 3
    With classic command line: 1. run regedit and change "HKLM:\system\currentcontrolset\services\vboxdrv" property imagePath to "\??\C:\Program Files\Oracle\VirtualBox\drivers\vboxdrv\VBoxDrv.sys", 2. run cmd as admin: "sc start vboxdrv" (without admin says access denied), 3. virtualbox should now work – psycho brm Jun 01 '17 at 18:37
  • If you install Virtualbox in say `C:\Users\...\VirtualBox` then you should look for the `...\drivers\vboxdrv\VBoxDrv.sys` file under your custom installation location and set `Set-ItemProperty ...` accordingly as described above. – Yeow_Meng Jul 20 '17 at 16:30
  • This fix worked for me. Windows 10 Virtualbox 5.1.26 r117224 (Qt5.6.2) – jared Sep 08 '17 at 12:13
  • The same issue happened when I upgraded to 5.2.8. Followed the steps. And it worked. Thanks! – shokulei Apr 13 '18 at 13:26
  • For the ones that cannot fix this problem following the above instructions, they should consider uninstalling certain software that are conflicting with virtualbox. That's what I did after reading the above page. It was not the same software. I uninstalled three of the software I installed recently. Hope it helps, guys! https://www.virtualbox.org/ticket/17640 – valiD Nov 07 '18 at 08:51
  • If this doesn't work for you check the below answer with a more upvotes, that's sorted out the issue for me! Be nice to put a note in the answer as well Anthony, just in case that helps others – Pete Nov 01 '19 at 14:24
  • @Anthony Mastrean bruh you're a life saver thanks :D – SlimenTN Mar 14 '20 at 09:15
  • I tried everything that was said on most platforms but none of it worked. So the only solution that worked was to reinstall the VirtualBox-6.1.26-145957-Win version of VirtualBox (I just downgrade it. the installed version was VirtualBox-6.1.28-145957-Win) – OLIVIERS Nov 10 '21 at 13:39
8

Try the following code (as administrator):

 sc.exe start vboxdrv
moffeltje
  • 4,521
  • 4
  • 33
  • 57
  • 1
    This worked in my case because the kernel driver was installed but its state was "STOPPED", otherwise you have to install it following the other answers. – sox supports the mods Mar 02 '18 at 10:04
7

I did what Anthony Mastrean suggested but I was still getting some errors:

C:\Vagrant>sc query vboxdrv

SERVICE_NAME: vboxdrv
        TYPE               : 1  KERNEL_DRIVER
        STATE              : 1  STOPPED
        WIN32_EXIT_CODE    : 31  (0x1f)
        SERVICE_EXIT_CODE  : 0  (0x0)
        CHECKPOINT         : 0x0
        WAIT_HINT          : 0x0

C:\Vagrant>sc start vboxdrv
[SC] StartService FAILED 123:

The filename, directory name, or volume label syntax is incorrect.

This thread on superuser gave me the solution:

find C:\Program Files\Oracle\VirtualBox\drivers\vboxdrv\ VBoxDrv.inf right click and select Install

hestellezg
  • 3,309
  • 3
  • 33
  • 37
2

> vboxmanage --version
7.0.6r155176

Fix:
C:\Program Files\Oracle\VirtualBox\drivers\vboxsup\VBoxSup.inf # Right Click to install
> sc.exe query vboxsup
> sc.exe start vboxsup
hakkican
  • 406
  • 1
  • 3
  • 12
0

As already pointed out, there seems to be a file-path issue after upgrades, especially when the VBox was open. The question's keyword was not giving any working results for me here, as I could not even find the directory /xboxdrv/ and even the file VBoxDrv.inf so I changed to missing xboxdrv and I found quick windows_approach here https://stackoverflow.com/a/32077300/5922263. It simply says that head to the program list, right-click Oracle VM VirtualBox and click Repair and this time, ensure it is closed first:

ControlPanel > Programs > Programs and Features > Oracle VM VirtualBox

I hope this helps.

Ajowi
  • 449
  • 3
  • 12