Search code examples
windowsservicekernelvirtualbox

Cannot boot Windows guest in VirtualBox without kernel module error


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.


Solution

  • 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