Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception on startup - Unable to create: Sequence contains more than one element #81

Closed
nickalbrecht opened this issue Sep 14, 2016 · 31 comments

Comments

@nickalbrecht
Copy link

nickalbrecht commented Sep 14, 2016

This has been an issue in the last three builds or so, I figured the next build each time would fix it. I haven't been using docker much, so nothing's loaded in it. But I wanted to report the problem to help get it resolved for the next person

Expected behavior

Docker to finish startup and reside in the system tray with indications that it's running normally

Actual behavior

The docker tray icon turns red indicating an error, and a feedback windows pops up with the following message

Unable to create: Sequence contains more than one element
at <ScriptBlock>, <No file>: line 340
at Docker.Core.Pipe.NamedPipeClient.TrySend(String action, Object[] parameters)
at Docker.Core.Pipe.NamedPipeClient.Send(String action, Object[] parameters)
at Docker.Core.Backend.BackendClient.Start(Settings settings)
at Docker.Actions.DoStart(Settings settings, Boolean showWelcomeWindow)
at Docker.Actions.<>c__DisplayClass13_0.b__0()
at Docker.Core.TaskQueue.<>c__DisplayClass18_0.<.ctor>b__1()

Information

DiagnosticID: 74DDB6C4-9FE4-4897-8642-1560202DDD37/2016-09-14_10-28-38
Relevant entries in the log file, omitting first and training lines:

[10:23:03.792][HyperV ][Info ] Using existing Switch: DockerNAT
[10:23:03.839][HyperV ][Info ] Using existing Switch IP address
[10:23:03.851][HyperV ][Info ] VHD C:\Users\Public\Documents\Hyper-V\Virtual Hard Disks\MobyLinuxVM.vhdx already exists
[10:23:03.890][HyperV ][Info ] Creating VM MobyLinuxVM...
[10:23:04.239][NamedPipeServer][Error ] Unable to execute Start: Unable to create: Sequence contains more than one element
at <ScriptBlock>, <No file>: line 340 at Docker.Backend.HyperV.RunScript(String action, Dictionary`2 parameters)
at Docker.Backend.ContainerEngine.Linux.Start(Settings settings)
at Docker.Core.Pipe.NamedPipeServer.<>c__DisplayClass8_0.<Register>b__0(Object[] parameters)
at Docker.Core.Pipe.NamedPipeServer.RunAction(String action, Object[] parameters)
[10:23:04.243][NamedPipeClient][Error ] Unable to send Start: Unable to create: Sequence contains more than one element
at <ScriptBlock>, <No file>: line 340
[10:23:04.244][Notifications ][Error ] Unable to create: Sequence contains more than one element
at <ScriptBlock>, <No file>: line 340
[10:23:04.252][NamedPipeClient][Info ] Sending GetDebugInfo()...

Currently running on Windows 10 64-bit with Docker 1.12.1-beta26 Build 7018

Steps to reproduce the behavior

Simply starting docker results in this behavior, regardless if it's manually started or autostarted with windows startup.

@krystan
Copy link

krystan commented Sep 15, 2016

I duplicated this but closed my issue I can confirm I also see this behaviour Just out of interest I removed the vhdx and it was recreated but again the log message said it already existed and bombed out. So even with no existing image this error occurs after creation of the new vhdx.

@krystan
Copy link

krystan commented Sep 15, 2016

Further investigation proved fruitful.

I went to the docker resources directory and ran

.\MobyLinux.ps1 -Destroy

I then opened up hyper-v manager went to my virtual switch and set it to internal
I then ran .\MobyLinux.ps1 -Create
I then opened up hyper-v manager and changed the switch back to private
I ran docker and it now worked as the vm had been created.

I was able to run hello-world-nginx.

I went back to look at my virtual switches and upon switching DockerNAT back to private a new switch is created as internal, I removed this and set my original back to internal and it was reused.

The root issue seems to be DockerNAT had been set to private and Docker doesn't like that.

I hope this helps.

@dgageot
Copy link
Member

dgageot commented Sep 16, 2016

@nickalbrecht Can you confirm that a "Reset to factory defaults" fixes the issue?

@krystan Please don't mess with the virtual switch!! ;-)

@dgageot
Copy link
Member

dgageot commented Sep 21, 2016

Hi @nickalbrecht Did you manage to fix your issue?

@edzam
Copy link

edzam commented Sep 23, 2016

I am having this exact same issue. I had done a windows update just today. It messed up my volume I had that was on a separate user account on my local machine. I decided to reset to factory defaults, thats when I started getting this exact issue.

@krystan
Copy link

krystan commented Sep 23, 2016

@dgageot yeah I understand that but I hadn't touched the switch something had set it to private and that is what caused this issue for me. Also resetting to factory defaults failed to work as it could not delete the switch (come to think of it I can't clean it up either even with the requisite ps commands), but the moment I set it to internal docker worked again.

@nickalbrecht
Copy link
Author

Oops, sorry for not getting back to you. No, Reset to Defaults does not resolve the issue, as soon as the Reset tries to restart docker after what I assume was the reset steps, it comes up with a very similar error.

Unable to create: Sequence contains more than one element
at <ScriptBlock>, <No file>: line 340
at Docker.Core.Pipe.NamedPipeClient.TrySend(String action, Object[] parameters)
at Docker.Core.Pipe.NamedPipeClient.Send(String action, Object[] parameters)
at Docker.Core.Backend.BackendClient.Start(Settings settings)
at Docker.Actions.DoStart(Settings settings, Boolean showWelcomeWindow)
at Docker.Actions.<ResetToDefault>b__15_0()
at Docker.Core.TaskQueue.<>c__DisplayClass18_0.<.ctor>b__1()

Crash/Diagnostic Id

74DDB6C4-9FE4-4897-8642-1560202DDD37/2016-09-26_12-22-43

@alvesman
Copy link

Solved the problem by manually creating the VM. Got the parameters by looking at C:\Program Files\Docker\Docker\resources\MobyLinux.ps1, from line 199.

@dgageot
Copy link
Member

dgageot commented Sep 29, 2016

@alvesman Thank you for trying to fix the issue this way. Unfortunately, it might cause even worse effects in the future.

It would be really helpful if you could try this:

  • Open an elevated powershell in C:\Program Files\Docker\Docker\resources
  • Replace line 340 of MobyLinux.ps1 (throw $_.Exception) with just throw
  • Run ./MobyLinux.ps1 -Destroy
  • Run ./MobyLinux.ps1 -Create

This should give us the actual line where the error occurs.

@alvesman
Copy link

@dgageot Thank you, this is the output I got:

`PS C:\Program Files\Docker\Docker\resources> ./MobyLinux.ps1 -Destroy
VM MobyLinuxVM is stopped
Destroying Switch DockerNAT...
Removing VM MobyLinuxVM...
Delete VHD E:\Hyper-V\Hyper-V Discs\MobyLinuxVM.vhdx
PS C:\Program Files\Docker\Docker\resources>
PS C:\Program Files\Docker\Docker\resources> ./MobyLinux.ps1 -Create
Creating Switch: DockerNAT...
Switch created.
Set IP address on switch
Creating dynamic VHD: E:\Hyper-V\Hyper-V Discs\MobyLinuxVM.vhdx
Creating VM MobyLinuxVM...
New-VM : A sequência contém mais do que um elemento
At C:\Program Files\Docker\Docker\resources\MobyLinux.ps1:210 char:11

  • $vm = New-VM -Name $VmName -Generation 2 -VHDPath $vhd.Path -Swit ...
    
  •       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (:) [New-VM], VirtualizationException
    • FullyQualifiedErrorId : InvalidOperation,Microsoft.HyperV.PowerShell.Commands.NewVM

PS C:\Program Files\Docker\Docker\resources>`

@dgageot
Copy link
Member

dgageot commented Sep 29, 2016

Thanks @alvesman, That's really helpful. Could you add those lines to the script, just before line 210?

Write-Output (Get-VMHost).VirtualHardDiskPath
Write-Output (Get-VHD -Path $VmVhdFile)
Write-Output "[$vhd]"
Write-Output "[$vhd.Path]"

@alvesman
Copy link

@dgageot
The new output:

`PS C:\Program Files\Docker\Docker\resources> ./MobyLinux.ps1 -Destroy
VM MobyLinuxVM does not exist
Destroying Switch DockerNAT...
Removing VM MobyLinuxVM...
Delete VHD E:\Hyper-V\Hyper-V Discs\MobyLinuxVM.vhdx
PS C:\Program Files\Docker\Docker\resources> ./MobyLinux.ps1 -Create
Creating Switch: DockerNAT...
Switch created.
Set IP address on switch
Creating dynamic VHD: E:\Hyper-V\Hyper-V Discs\MobyLinuxVM.vhdx
Creating VM MobyLinuxVM...
E:\Hyper-V\Hyper-V Discs\

ComputerName : ZX10
Path : e:\hyper-v\hyper-v discs\mobylinuxvm.vhdx
VhdFormat : VHDX
VhdType : Dynamic
FileSize : 4194304
Size : 64424509440
MinimumSize :
LogicalSectorSize : 512
PhysicalSectorSize : 4096
BlockSize : 33554432
ParentPath :
DiskIdentifier : 508A4535-8D31-44E7-9C19-BA44917F9A64
FragmentationPercentage : 0
Alignment : 1
Attached : False
DiskNumber :
Number :

[Microsoft.Vhd.PowerShell.VirtualHardDisk]
[Microsoft.Vhd.PowerShell.VirtualHardDisk.Path]
New-VM : A sequência contém mais do que um elemento
At C:\Program Files\Docker\Docker\resources\MobyLinux.ps1:214 char:11

  • $vm = New-VM -Name $VmName -Generation 2 -VHDPath $vhd.Path -Swit ...
    
  •       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (:) [New-VM], VirtualizationException
    • FullyQualifiedErrorId : InvalidOperation,Microsoft.HyperV.PowerShell.Commands.NewVM

PS C:\Program Files\Docker\Docker\resources>

`

@dgageot
Copy link
Member

dgageot commented Sep 29, 2016

Thanks @alvesman, that's still a mystery to me. The only difference I see is that you changed the path to HyperV virtual disks...

@dgageot
Copy link
Member

dgageot commented Sep 29, 2016

@alvesman Maybe you could try to hard-code $vhd.Path to a path on drive C

@alvesman
Copy link

@dgageot Changed Hyper-V defs to point to C drive but got same result (previous version was working fine with disk on E drive):
`PS C:\Program Files\Docker\Docker\resources> ./MobyLinux.ps1 -Create
Creating Switch: DockerNAT...
Switch created.
Set IP address on switch
Creating dynamic VHD: c:\Hyper-V\Hyper-V Discs\MobyLinuxVM.vhdx
Creating VM MobyLinuxVM...
c:\Hyper-V\Hyper-V Discs\

ComputerName : ZX10
Path : c:\hyper-v\hyper-v discs\mobylinuxvm.vhdx
VhdFormat : VHDX
VhdType : Dynamic
FileSize : 4194304
Size : 64424509440
MinimumSize :
LogicalSectorSize : 512
PhysicalSectorSize : 4096
BlockSize : 33554432
ParentPath :
DiskIdentifier : F4B29194-9C2E-43BF-B4ED-A4CC35A612FC
FragmentationPercentage : 0
Alignment : 1
Attached : False
DiskNumber :
Number :

[Microsoft.Vhd.PowerShell.VirtualHardDisk]
[Microsoft.Vhd.PowerShell.VirtualHardDisk.Path]
New-VM : A sequência contém mais do que um elemento
At C:\Program Files\Docker\Docker\resources\MobyLinux.ps1:214 char:11

  • $vm = New-VM -Name $VmName -Generation 2 -VHDPath $vhd.Path -Swit ...
    
  •       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (:) [New-VM], VirtualizationException
    • FullyQualifiedErrorId : InvalidOperation,Microsoft.HyperV.PowerShell.Commands.NewVM

PS C:\Program Files\Docker\Docker\resources>`

@dgageot
Copy link
Member

dgageot commented Sep 29, 2016

@alvesman I'm really puzzled... I guess it's either the -VHDPath $vhd.Path or the -SwitchName $SwitchName that's failing. Could you try modify the script without all those parameters, then add them one by one and do destroy/create cycles each time. This could, you could identify which parameter causes the error.

@alvesman
Copy link

alvesman commented Sep 29, 2016

@dgageot The offending parameter is SwitchName in:
$vm = New-VM -Name $VmName -Generation 2 -VHDPath $vhd.Path -SwitchName $SwitchName
Removing it:
$vm = New-VM -Name $VmName -Generation 2 -VHDPath $vhd.Path
And then, after running the script, manually (in Hyper-V manager) attaching the network adapter to “DockerNAT” solves the problem.
It's a mistery since Write-Output "[$ SwitchName]" outputs the correct string: DockerNAT

@dgageot
Copy link
Member

dgageot commented Sep 29, 2016

\0/ @alvesman Can you please print the output of Get-VMSwitch?

@alvesman
Copy link

@dgageot

PS C:\Program Files\Docker\Docker\resources> ./MobyLinux.ps1 -Destroy**
VM MobyLinuxVM is stopped
Destroying Switch DockerNAT...
Removing VM MobyLinuxVM...
Delete VHD E:\Hyper-V\Hyper-V Discs\MobyLinuxVM.vhdx

PS C:\Program Files\Docker\Docker\resources> Get-VMSwitch

Name SwitchType NetAdapterInterfaceDescription
---- ---------- ------------------------------
Windows Phone Emulator Internal Switch Internal
LAN02 Internal
DockerNAT Private
LAN01 External Intel(R) 82579LM Gigabit Network Connection

looks like there is a DockerNAT lingering from previous version...

@alvesman
Copy link

@dgageot
After changing existing switch DockerNAT from Private to internal, running the original script
($vm = New-VM -Name $VmName -Generation 2 -VHDPath $vhd.Path -SwitchName $SwitchName) went OK. No errors and docker started fine.

@dgageot
Copy link
Member

dgageot commented Sep 29, 2016

@alvesman
What is strange is that the Destroy script does a Remove-VMSwitch DockerNAT. It should remove the lingering switches.

Can you run Remove-VMSwitch DockerNAT and then Get-VMSwitch manually?

@dgageot
Copy link
Member

dgageot commented Sep 29, 2016

So to sum up, at least two users had the DockerNAT changed to private instead of internal. After that, the VM cannot be created anymore and the destroy script is not able to cleanup the bad switch

@alvesman
Copy link

alvesman commented Sep 29, 2016

@dgageot your last post summarizes the problem. Thank you. All is running now.

PS C:\Program Files\Docker\Docker\resources> Remove-VMSwitch DockerNAT
Confirm
Are you sure you want to remove the virtual switch "DockerNAT"?
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): Y
Remove-VMSwitch : Falha ao remover o comutador Ethernet virtual.
Falha na eliminação da miniporta interna, NIC interno = '{17602562-8AF4-42C3-A7DB-C805D48E6D45}': Invalid parameter
(0x80041008).
At line:1 char:1
+ Remove-VMSwitch DockerNAT
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Remove-VMSwitch], VirtualizationException
+ FullyQualifiedErrorId : InvalidParameter,Microsoft.HyperV.PowerShell.Commands.RemoveVMSwitch

PS C:\Program Files\Docker\Docker\resources> Get-VMSwitch
Name SwitchType NetAdapterInterfaceDescription
---- ---------- ------------------------------
Windows Phone Emulator Internal Switch Internal
LAN02 Internal
DockerNAT Internal
LAN01 External Intel(R) 82579LM Gigabit Network Connection

PS C:\Program Files\Docker\Docker\resources>

@dgageot
Copy link
Member

dgageot commented Sep 29, 2016

@alvesman can you check if any of your VMS is using that switch? The Windows Phone emulator maybe?

@dgageot
Copy link
Member

dgageot commented Sep 29, 2016

((get-vm).NetworkAdapters) | ? { $_.SwitchName -eq "DockerNAT" }

@alvesman
Copy link

alvesman commented Sep 29, 2016

No, only MobyLinuxVM
PS C:\> ((get-vm).NetworkAdapters) | ? { $_.SwitchName -eq "DockerNAT" }

Name IsManagementOs VMName SwitchName MacAddress Status IPAddresses
---- -------------- ------ ---------- ---------- ------ -----------
Network Adapter False MobyLinuxVM DockerNAT 00155D330C7A {}

with docker running:
Network Adapter False MobyLinuxVM DockerNAT 00155D330C7A {Degraded, ProtocolVersion} {10.0.75.2, fe80::215:5dff:fe33:c7a}

@dgageot
Copy link
Member

dgageot commented Sep 29, 2016

Thank you very much @alvesman! Thanks to your help, next version should contain both better diagnostic tools and a workaround to this issue.

@dgageot
Copy link
Member

dgageot commented Oct 18, 2016

@alvesman @nickalbrecht @krystan Can you confirm that this is fixed in latest Beta? (>=Beta28)

@rn
Copy link
Contributor

rn commented Oct 30, 2016

Closing this issue due to inactivity. Please re-open if the this is not fixed in recent Betas (>=Beta28)

@rn rn closed this as completed Oct 30, 2016
@nickalbrecht
Copy link
Author

I can't confirm if it's resolved or not unfortunately. I no longer have an environment where the problem still exists. Time will tell.

@docker-robott
Copy link
Collaborator

Closed issues are locked after 30 days of inactivity.
This helps our team focus on active issues.

If you have found a problem that seems similar to this, please open a new issue.

Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows.
/lifecycle locked

@docker docker locked and limited conversation to collaborators Jun 18, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants