machine icon indicating copy to clipboard operation
machine copied to clipboard

Hyperv/Windows10 - Error creating machine: Error in driver during machine creation: exit status 1

Open j4fm opened this issue 11 years ago • 22 comments

On Windows 10 with Hyper V driver, I receive "Error creating machine: Error in driver during machine creation: exit status 1" most of the time. Occasionally, it succeeds but I can find nothing reliable to make it succeed every time.

The new VM fails to start when instructed by the Docker Hyper V driver. I can always start it manually successfully but then the certificates are invalid in docker for the VM because it never completed the creation.

Windows Event Log for Hyper V Worker shows:

Microsoft Emulated IDE Controller (Instance ID 83F8638B-8DCA-4152-9EDA-2CA8B33039B4): Failed to Power on with Error 'The process cannot access the file because it is being used by another process.' (0x80070020). (Virtual machine ID 4F21E751-1C17-462E-B659-97BD9FBE2783)

and

Failed to open attachment 'C:\Users\user.docker\machine\machines\dockerhost1\boot2docker.iso'. Error: 'The process cannot access the file because it is being used by another process.' (7864368). (Virtual machine ID 4F21E751-1C17-462E-B659-97BD9FBE2783)

The ISO file is not mounted by the system or any other VM.

I have disabled antivirus and indexing for the entire docker folder and confirmed that neither are causing the lock by using Process Monitor.

This was installed using Docker Toolbox 1.9.0b. I never had this problem with the previous version of Docker.

Client: Version: 1.9.0 API version: 1.21 Go version: go1.4.3 Git commit: 76d6bc9 Built: Tue Nov 3 19:20:09 UTC 2015 OS/Arch: windows/amd64

Server: Version: 1.9.0 API version: 1.21 Go version: go1.4.3 Git commit: 76d6bc9 Built: Tue Nov 3 19:20:09 UTC 2015 OS/Arch: linux/amd64

Thanks

James

j4fm avatar Nov 12 '15 12:11 j4fm

Exactly the same here!

sebfia avatar Nov 13 '15 11:11 sebfia

I currently work around the problem by:

  1. After the failure, running "docker-machine start [machinename]"
  2. Wait for the machine to start fully
  3. Running "docker-machine regenerate-certs [machinename]"

James

j4fm avatar Nov 13 '15 13:11 j4fm

Confirmed, W10 & HyperV

JigSawFr avatar Nov 20 '15 10:11 JigSawFr

I'm seeing this on windows 8.1 with HyperV as well

dubrowgn avatar Nov 25 '15 19:11 dubrowgn

Same problem on a Windows 2012 R2 cluster

DraconPern avatar Jan 24 '16 11:01 DraconPern

I did some test with --debug. I think the problem is that Set-VMDvdDrive and Add-VMHardDiskDrive return before the operation is actually done since the commands just queues up the operation in the hyper-v service queue. What needs to be added is a loop that calls Get-VM and look for "Operating normally" in the status. Then when the status is 'normal', call Start-VM

DraconPern avatar Jan 24 '16 11:01 DraconPern

This was fixed from Docker Machine v0.5.5 onwards

j4fm avatar Jan 24 '16 12:01 j4fm

Can you reference the patch that fixed this? I had this issue running docker-machine and not with docker-compose.

DraconPern avatar Jan 24 '16 12:01 DraconPern

There is no reference to the issue number on the Machine 0.5.5 release notes. If you look on the release notes, it is mentioned.

"Close handle after copying boot2docker.iso into vm folder - will otherwise keep hyper-v from starting vm"

(Compose was a mistake which I corrected in previous comment. I meant Machine)

j4fm avatar Jan 24 '16 12:01 j4fm

This is fixed in 1cd6a37343d2bc23dcef8a409aaf347a562b974d

dgageot avatar Jan 24 '16 13:01 dgageot

I'm using docker-machine v0.7.0 and it still persists. :(

Here's the debug output of create command:

PS C:\Windows\system32> docker-machine --debug create -d hyperv dev Docker Machine Version: 0.7.0, build a650a40 Found binary path at C:\ProgramData\chocolatey\lib\docker-machine\bin\docker-machine.exe Launching plugin server for driver hyperv Plugin server listening at address 127.0.0.1:52639 () Calling .GetVersion Using API Version 1 () Calling .SetConfigRaw () Calling .GetMachineName (flag-lookup) Calling .GetMachineName (flag-lookup) Calling .DriverName (flag-lookup) Calling .GetCreateFlags Found binary path at C:\ProgramData\chocolatey\lib\docker-machine\bin\docker-machine.exe Launching plugin server for driver hyperv Plugin server listening at address 127.0.0.1:52643 () Calling .GetVersion Using API Version 1 () Calling .SetConfigRaw () Calling .GetMachineName (dev) Calling .GetMachineName (dev) Calling .DriverName (dev) Calling .GetCreateFlags (dev) Calling .SetConfigFromFlags Running pre-create checks... (dev) Calling .PreCreateCheck (dev) DBG | [executing ==>] : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive @(Ge t-Command Get-VM).ModuleName (dev) DBG | [stdout =====>] : Hyper-V (dev) DBG | (dev) DBG | [stderr =====>] : (dev) DBG | [executing ==>] : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive @([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole("Hyper-V Administrators") (dev) DBG | [stdout =====>] : False (dev) DBG | (dev) DBG | [stderr =====>] : (dev) DBG | [executing ==>] : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive @([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator") (dev) DBG | [stdout =====>] : True (dev) DBG | (dev) DBG | [stderr =====>] : (dev) DBG | [executing ==>] : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive (Get-VMSwitch).Name (dev) DBG | [stdout =====>] : External (dev) DBG | (dev) DBG | [stderr =====>] : (dev) DBG | local Boot2Docker ISO version: v1.11.2 (dev) Calling .GetConfigRaw Creating machine... (dev) Calling .Create (dev) DBG | local Boot2Docker ISO version: v1.11.2 (dev) Copying C:\Users\mrc.docker\machine\cache\boot2docker.iso to C:\Users\mrc.docker\machine\machines\dev\boot2docker.iso... (dev) Creating SSH key... (dev) Creating VM... (dev) DBG | [executing ==>] : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive (Get -VMSwitch).Name (dev) DBG | [stdout =====>] : External (dev) Using switch "External" (dev) DBG | (dev) DBG | [stderr =====>] : (dev) DBG | [executing ==>] : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive @([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator") (dev) DBG | [stdout =====>] : True (dev) Creating VHD (dev) DBG | (dev) DBG | [stderr =====>] : (dev) DBG | [executing ==>] : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive New-VHD -Path 'C:\Users\mrc.docker\machine\machines\dev\fixed.vhd' -SizeBytes 10MB -Fixed (dev) DBG | [stdout =====>] : (dev) DBG | (dev) DBG | ComputerName : DESKTOP-HINMSEO (dev) DBG | Path : C:\Users\mrc.docker\machine\machines\dev\fixed.vhd (dev) DBG | VhdFormat : VHD (dev) DBG | VhdType : Fixed (dev) DBG | FileSize : 10486272 (dev) DBG | Size : 10485760 (dev) DBG | MinimumSize : (dev) DBG | LogicalSectorSize : 512 (dev) DBG | PhysicalSectorSize : 512 (dev) DBG | BlockSize : 0 (dev) DBG | ParentPath : (dev) DBG | DiskIdentifier : cfccf860-a8ee-48cd-bad9-045edf3fa4a0 (dev) DBG | FragmentationPercentage : 0 (dev) DBG | Alignment : 1 (dev) DBG | Attached : False (dev) DBG | DiskNumber : (dev) DBG | Number : (dev) DBG | (dev) DBG | (dev) DBG | (dev) DBG | (dev) DBG | [stderr =====>] : (dev) DBG | Writing magic tar header (dev) DBG | Writing SSH key tar header (dev) DBG | [executing ==>] : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive Convert-VHD -Path 'C:\Users\mrc.docker\machine\machines\dev\fixed.vhd' -DestinationPath 'C:\Users\mrc.docker\machine\machines\dev\disk.vhd' -VHDType Dynamic -DeleteSource (dev) DBG | [stdout =====>] : (dev) DBG | [stderr =====>] : (dev) DBG | [executing ==>] : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive Resize-VHD -Path 'C:\Users\mrc.docker\machine\machines\dev\disk.vhd' -SizeBytes 20000MB (dev) DBG | [stdout =====>] : (dev) DBG | [stderr =====>] : (dev) DBG | [executing ==>] : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive New-VM dev -Path 'C:\Users\mrc.docker\machine\machines\dev' -SwitchName 'External' -MemoryStartupBytes 1024MB (dev) DBG | [stdout =====>] : (dev) DBG | Name State CPUUsage(%) MemoryAssigned(M) Uptime Status Version (dev) DBG | ---- ----- ----------- ----------------- ------ ------ ------- (dev) DBG | dev Off 0 0 00:00:00 Operating normally 6.2 (dev) DBG | (dev) DBG | (dev) DBG | (dev) DBG | [stderr =====>] : (dev) DBG | [executing ==>] : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive Set-VMDvdDrive -VMName dev -Path 'C:\Users\mrc.docker\machine\machines\dev\boot2docker.iso' (dev) DBG | [stdout =====>] : (dev) DBG | [stderr =====>] : (dev) DBG | [executing ==>] : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive Add-VMHardDiskDrive -VMName dev -Path 'C:\Users\mrc.docker\machine\machines\dev\disk.vhd' (dev) DBG | [stdout =====>] : (dev) Starting VM... (dev) DBG | [stderr =====>] : (dev) DBG | [executing ==>] : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive Start-VM dev (dev) DBG | [stdout =====>] : (dev) DBG | [stderr =====>] : Start-VM : 'dev' failed to start. (dev) DBG | 'dev' could not initialize. (dev) DBG | Not enough memory in the system to start the virtual machine dev. (dev) DBG | 'dev' failed to start. (Virtual machine ID 45C83904-38D7-4147-BF52-3F0BDD887409) (dev) DBG | 'dev' could not initialize. (Virtual machine ID 45C83904-38D7-4147-BF52-3F0BDD887409) (dev) DBG | Not enough memory in the system to start the virtual machine dev with ram size 1024 megabytes. (Virtual machine ID (dev) DBG | 45C83904-38D7-4147-BF52-3F0BDD887409) (dev) DBG | At line:1 char:1 (dev) DBG | + Start-VM dev (dev) DBG | + ~~~~~~~~~~~~ (dev) DBG | + CategoryInfo : FromStdErr: (:) [Start-VM], VirtualizationException (dev) DBG | + FullyQualifiedErrorId : OutOfMemory,Microsoft.HyperV.PowerShell.Commands.StartVM (dev) DBG | (dev) DBG | Error creating machine: Error in driver during machine creation: exit status 1 open : The system cannot find the file specified. notifying bugsnag: [Error creating machine: Error in driver during machine creation: exit status 1]

mrcaron avatar Jun 02 '16 19:06 mrcaron

even after maxxing memory out, it doesn't work :( My machine has 4GB... is that a limitation?

mrcaron avatar Jun 02 '16 19:06 mrcaron

@mrcaron I have having the same issue on windows 10 Aniversary, my machine have 8gb ram, still not enought

(vm) DBG | [stderr =====>] : (vm) DBG | [executing ==>] : C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive Add-VMHardDiskDrive -VMName vm -Path 'C:\Users\admin.docker\machine\machines\vm\disk.vhd' (vm) Starting VM... (vm) DBG | [stdout =====>] : (vm) DBG | [stderr =====>] : (vm) DBG | [executing ==>] : C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive Start-VM vm (vm) DBG | [stdout =====>] : (vm) DBG | [stderr =====>] : Start-VM : 'vm' failed to start. (vm) DBG | Not enough memory in the system to start the virtual machine vm. (vm) DBG | Could not initialize memory: Ran out of memory (0x8007000E). (vm) DBG | 'vm' failed to start. (Virtual machine ID 9BE6C5CA-A7F4-4048-ACE3-7B8E42FF2674) (vm) DBG | Not enough memory in the system to start the virtual machine vm with ram size (vm) DBG | 1024 megabytes. (Virtual machine ID 9BE6C5CA-A7F4-4048-ACE3-7B8E42FF2674) (vm) DBG | 'vm' could not initialize memory: Ran out of memory (0x8007000E). (Virtual (vm) DBG | machine ID 9BE6C5CA-A7F4-4048-ACE3-7B8E42FF2674) (vm) DBG | At line:1 char:1 (vm) DBG | + Start-VM vm (vm) DBG | + ~~~~~~~~~~~ (vm) DBG | + CategoryInfo : FromStdErr: (:) [Start-VM], VirtualizationExcept (vm) DBG | ion (vm) DBG | + FullyQualifiedErrorId : OutOfMemory,Microsoft.HyperV.PowerShell.Commands (vm) DBG | .StartVM (vm) DBG | (vm) DBG | Error creating machine: Error in driver during machine creation: exit status 1 notifying bugsnag: [Error creating machine: Error in driver during machine creation: exit status 1]

javafun avatar Dec 06 '16 08:12 javafun

Same issue

TheOtherRealm avatar May 10 '17 19:05 TheOtherRealm

Does anyone found the solution ? I encounter the same issue on testing docker-machine create new VM with hyper-v.

ronycohen avatar May 19 '17 12:05 ronycohen

@ronyrun not yet... still in limbo 👎

mrcaron avatar May 19 '17 14:05 mrcaron

same here

blaylockbk avatar Jun 05 '17 20:06 blaylockbk

I found my problem is lacking of memory

stzyx14 avatar Jun 16 '17 07:06 stzyx14

Cycling the Windows Management Instrumentation service fixed the issue for me (Windows 10).

aaronmorgan avatar Jun 22 '17 04:06 aaronmorgan

Running docker-machine -D start vmname show you the error. Mine was lack of memory... Added RAM to host VM and everything ran fine after...

jeanphilippefortin avatar Jul 26 '17 14:07 jeanphilippefortin