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

hyperv: no External vswitch nor Default Switch found (Get-VMSwitch fails) #5691

Closed
asloan7 opened this issue Oct 22, 2019 · 23 comments
Closed
Labels
co/hyperv HyperV related issues kind/support Categorizes issue or PR as a support question.

Comments

@asloan7
Copy link

asloan7 commented Oct 22, 2019

PS C:\Windows\system32> choco upgra
Chocolatey v0.10.11
Upgrading the following packages:
minikube
You have minikube v0.30.0 installed. Version 1.4.0 is available based on your source(s).
Progress: Downloading Minikube 1.4.0... 100%

Minikube v1.4.0 [Approved]
minikube package files upgrade completed. Performing other installation steps.
ShimGen has successfully created a shim for minikube.exe
The upgrade of minikube was successful.
Software install location not explicitly set, could be in package or
default install location if installer.

Chocolatey upgraded 1/1 packages.
See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).
PS C:\Windows\system32> Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All

Path :
Online : True
RestartNeeded : False

PS C:\Windows\system32> minikube start --vm-driver=hyperv

  • minikube v1.4.0 on Microsoft Windows 10 Enterprise 10.0.14393 Build 14393
  • Downloading VM boot image ...

    minikube-v1.4.0.iso.sha256: 65 B / 65 B [--------------] 100.00% ? p/s 0s
    minikube-v1.4.0.iso: 135.73 MiB / 135.73 MiB [ 100.00% 1.91 MiB p/s 1m12s

  • Creating hyperv VM (CPUs=2, Memory=2000MB, Disk=20000MB) ...
  • Retriable failure: create: precreate: no External vswitch nor Default Switch found. A valid vswitch must be available
    for this command to run. Check https://docs.docker.com/machine/drivers/hyper-v/
  • Creating hyperv VM (CPUs=2, Memory=2000MB, Disk=20000MB) ...
  • Retriable failure: create: precreate: no External vswitch nor Default Switch found. A valid vswitch must be available
    for this command to run. Check https://docs.docker.com/machine/drivers/hyper-v/
  • Creating hyperv VM (CPUs=2, Memory=2000MB, Disk=20000MB) ...
  • Retriable failure: create: precreate: no External vswitch nor Default Switch found. A valid vswitch must be available
    for this command to run. Check https://docs.docker.com/machine/drivers/hyper-v/
  • Creating hyperv VM (CPUs=2, Memory=2000MB, Disk=20000MB) ...
  • Retriable failure: create: precreate: no External vswitch nor Default Switch found. A valid vswitch must be available
    for this command to run. Check https://docs.docker.com/machine/drivers/hyper-v/

X Unable to start VM: create: precreate: no External vswitch nor Default Switch found. A valid vswitch must be available
for this command to run. Check https://docs.docker.com/machine/drivers/hyper-v/


.\notepad.exe C:\ProgramData\chocolatey\logs\chocolatey.log
(really long, here is the end)
2019-10-22 14:30:19,697 25672 [DEBUG] - Attempting to create directory "C:\ProgramData\chocolatey.chocolatey\Minikube.1.4.0".
2019-10-22 14:30:19,702 25672 [DEBUG] - There was no original file at 'C:\ProgramData\chocolatey.chocolatey\Minikube.1.4.0.files'
2019-10-22 14:30:19,706 25672 [DEBUG] - Attempting to delete file "C:\ProgramData\chocolatey.chocolatey\Minikube.1.4.0.extra".
2019-10-22 14:30:19,707 25672 [DEBUG] - Attempting to delete file "C:\ProgramData\chocolatey.chocolatey\Minikube.1.4.0.version".
2019-10-22 14:30:19,708 25672 [DEBUG] - Attempting to delete file "C:\ProgramData\chocolatey.chocolatey\Minikube.1.4.0.sxs".
2019-10-22 14:30:19,709 25672 [DEBUG] - Attempting to delete file "C:\ProgramData\chocolatey.chocolatey\Minikube.1.4.0.pin".
2019-10-22 14:30:19,711 25672 [DEBUG] - Sending message 'HandlePackageResultCompletedMessage' out if there are subscribers...
2019-10-22 14:30:19,713 25672 [DEBUG] - Attempting to delete file "C:\ProgramData\chocolatey\lib\Minikube.chocolateyPending".
2019-10-22 14:30:19,719 25672 [DEBUG] - Attempting to delete directory "C:\ProgramData\chocolatey\lib-bkp\minikube".
2019-10-22 14:30:19,731 25672 [INFO ] - The upgrade of minikube was successful.
2019-10-22 14:30:19,735 25672 [INFO ] - Software install location not explicitly set, could be in package or
default install location if installer.
2019-10-22 14:30:19,738 25672 [DEBUG] - Attempting to delete file "C:\Users\asloan204\AppData\Local\NuGet\Cache\Minikube.1.4.0.nupkg".
2019-10-22 14:30:19,753 25672 [WARN ] -
Chocolatey upgraded 1/1 packages.
See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).
2019-10-22 14:30:19,756 25672 [DEBUG] - Sending message 'PostRunMessage' out if there are subscribers...
2019-10-22 14:30:19,800 25672 [DEBUG] - Exiting with 0


PS C:\Windows\system32> systeminfo

Host Name: PATAPL-28WMZF2
OS Name: Microsoft Windows 10 Enterprise
OS Version: 10.0.14393 N/A Build 14393
OS Manufacturer: Microsoft Corporation
OS Configuration: Member Workstation
OS Build Type: Multiprocessor Free
Registered Owner: Windows User
Registered Organization:
Product ID: 00329-00000-00003-AA690
Original Install Date: 8/23/2016, 1:05:12 PM
System Boot Time: 10/18/2019, 9:05:23 AM
System Manufacturer: Dell Inc.
System Model: Latitude E5470
System Type: x64-based PC
Processor(s): 1 Processor(s) Installed.
[01]: Intel64 Family 6 Model 94 Stepping 3 GenuineIntel ~2701 Mhz
BIOS Version: Dell Inc. 1.18.6, 12/8/2017
Windows Directory: C:\Windows
System Directory: C:\Windows\system32
Boot Device: \Device\HarddiskVolume2
System Locale: en-us;English (United States)
Input Locale: en-us;English (United States)
Time Zone: (UTC-05:00) Eastern Time (US & Canada)
Total Physical Memory: 16,276 MB
Available Physical Memory: 6,984 MB
Virtual Memory: Max Size: 18,708 MB
Virtual Memory: Available: 7,347 MB
Virtual Memory: In Use: 11,361 MB
Page File Location(s): C:\pagefile.sys
Domain: aaa.bbb.com
Logon Server: \PACDCADDCCB13
Hotfix(s): 11 Hotfix(s) Installed.
[01]: KB3176936
[02]: KB3211320
[03]: KB4013418
[04]: KB4023834
[05]: KB4091664
[06]: KB4093137
[07]: KB4132216
[08]: KB4465659
[09]: KB4485447
[10]: KB4493478
[11]: KB4493470
Network Card(s): 4 NIC(s) Installed.
[01]: Intel(R) Ethernet Connection (2) I219-LM
Connection Name: Ethernet
Status: Media disconnected
[02]: Intel(R) Dual Band Wireless-AC 8260
Connection Name: Wi-Fi
DHCP Enabled: Yes
DHCP Server: 69.252.250.82
IP address(es)
[01]: 10.21.178.99
[02]: fe80::454e:834f:cfd8:22af
[03]: 2001:558:1404:e:858f:f8ee:1eb1:ea15
[04]: 2001:558:1404:e:454e:834f:cfd8:22af
[03]: VirtualBox Host-Only Ethernet Adapter
Connection Name: VirtualBox Host-Only Network
DHCP Enabled: No
IP address(es)
[01]: 192.168.56.1
[02]: fe80::6c0b:ebd3:aa32:b2b8
[04]: Hyper-V Virtual Ethernet Adapter
Connection Name: vEthernet (DockerNAT)
DHCP Enabled: No
IP address(es)
[01]: 10.0.75.1
[02]: fe80::45d:a1fe:7e42:541e
Hyper-V Requirements: A hypervisor has been detected. Features required for Hyper-V will not be displayed.

@tstromberg
Copy link
Contributor

tstromberg commented Oct 22, 2019

Interesting. Do you mind sharing the output of:

Get-VMSwitch

I don't know why it's the case, but it appears that the default network switch for Hyper-V is either unable to be found, or just does not exist. The solution is likely to add a virtual switch in Hyper-V, but it'd be good to get confirmation first. This command may work for doing so:

New-VMSwitch -name ExternalSwitch -NetAdapterName Ethernet -AllowManagementOS $true

Thanks!

@tstromberg tstromberg added co/hyperv HyperV related issues triage/needs-information Indicates an issue needs more information in order to work on it. labels Oct 22, 2019
@tstromberg tstromberg changed the title install - minikube-v1.4.0 on Windows 10 - no External vswitch nor Default Switch found hyperv: no External vswitch nor Default Switch found Oct 22, 2019
@tstromberg tstromberg added the kind/support Categorizes issue or PR as a support question. label Oct 22, 2019
@asloan7
Copy link
Author

asloan7 commented Oct 22, 2019

PS C:\Windows\system32> Get-VMSwitch
Get-VMSwitch : Hyper-V encountered an error trying to access an object on computer 'PATAPL-28WMZF2' because the object
was not found. The object might have been deleted. Verify that the Virtual Machine Management service on the computer
is running.
At line:1 char:1

  • Get-VMSwitch
  •   + CategoryInfo          : ObjectNotFound: (:) [Get-VMSwitch], VirtualizationException
      + FullyQualifiedErrorId : ObjectNotFound,Microsoft.HyperV.PowerShell.Commands.GetVMSwitch
    

@tstromberg
Copy link
Contributor

@asloan7 - Interesting, and atypical. Do you mind trying to create an external switch to see if minikube works properly with it?

https://docs.microsoft.com/en-us/windows-server/virtualization/hyper-v/get-started/create-a-virtual-switch-for-hyper-v-virtual-machines

@JaremAndersen
Copy link

I had the same issue described above and creating a new virtual switch and instructing minikube to use it solved my problem.

@asloan7
Copy link
Author

asloan7 commented Oct 23, 2019

I had the same issue described above and creating a new virtual switch and instructing minikube to use it solved my problem.

@JaremPDQ Can you paste the commands to do this? I haven't had success yet

@asloan7
Copy link
Author

asloan7 commented Oct 23, 2019

PS C:\Windows\system32> Get-NetAdapter

Name InterfaceDescription ifIndex Status MacAddress LinkSpeed


vEthernet (DockerNAT) Hyper-V Virtual Ethernet Adapter 5 Up 00-15-5D-60-12-02 10 Gbps
Wi-Fi Intel(R) Dual Band Wireless-AC 8260 12 Up 28-16-AD-94-28-98 173.3 Mbps
Ethernet Intel(R) Ethernet Connection (2) I21... 21 Disconnected D4-81-D7-A5-98-CF 0 bps
VirtualBox Host-Only N... VirtualBox Host-Only Ethernet Adapter 3 Up 0A-00-27-00-00-03 1 Gbps

@sharifelgamal
Copy link
Collaborator

@asloan7 Have you tried following the instructions that @tstromberg posted to create an external switch?

@asloan7
Copy link
Author

asloan7 commented Oct 30, 2019

I have tried, might be corporate lock down of being able to do hyper-v stuff

@medyagh
Copy link
Member

medyagh commented Nov 4, 2019

@asloan7 are you still having this issue with the newest version?

@asloan7
Copy link
Author

asloan7 commented Nov 5, 2019

@JaremPDQ Can you paste the commands to do this? I haven't had success yet

PS C:\Windows\system32> New-VMSwitch -name ExternalSwitch -NetAdapterName Ethernet -AllowManagementOS $true
New-VMSwitch : Hyper-V encountered an error trying to access an object on computer 'PATAPL-28WMZF2' because the object
was not found. The object might have been deleted. Verify that the Virtual Machine Management service on the computer
is running.
At line:1 char:1

  • New-VMSwitch -name ExternalSwitch -NetAdapterName Ethernet -AllowMana ...
  •   + CategoryInfo          : ObjectNotFound: (:) [New-VMSwitch], VirtualizationException
      + FullyQualifiedErrorId : ObjectNotFound,Microsoft.HyperV.PowerShell.Commands.NewVMSwitch
    

@asloan7
Copy link
Author

asloan7 commented Nov 5, 2019

@asloan7 are you still having this issue with the newest version?

PS C:\Windows\system32> choco upgrade minikube
...
You have minikube v1.4.0 installed. Version 1.5.2 is available based on your source(s).
Progress: Downloading Minikube 1.5.2... 100%
Minikube v1.5.2 [Approved]
minikube package files upgrade completed. Performing other installation steps.
ShimGen has successfully created a shim for minikube.exe
The upgrade of minikube was successful.
Software install location not explicitly set, could be in package or default install location if installer.
Chocolatey upgraded 1/1 packages.

PS C:\Windows\system32> minikube start --vm-driver=hyperv

  • minikube v1.5.2 on Microsoft Windows 10 Enterprise 10.0.14393 Build 14393
  • Upgrading from Kubernetes 1.16.0 to 1.16.2
  • Downloading VM boot image ...

    minikube-v1.5.1.iso.sha256: 65 B / 65 B [--------------] 100.00% ? p/s 0s
    minikube-v1.5.1.iso: 143.76 MiB / 143.76 MiB 100.00% 443.96 KiB p/s 5m31

  • Creating hyperv VM (CPUs=2, Memory=2000MB, Disk=20000MB) ...
    E1105 10:02:30.203493 17676 main.go:106] libmachine: [stderr =====>] : Hyper-V\Get-VMSwitch : Hyper-V encountered an error trying to access an object on computer 'PATAPL-28WMZF2' because
    the object was not found. The object might have been deleted. Verify that the Virtual Machine Management service on the computer is running.
    At line:1 char:69
  • ... [Text.Encoding]::UTF8; ConvertTo-Json @(Hyper-V\Get-VMSwitch|Select ...
  •                                          ~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : ObjectNotFound: (:) [Get-VMSwitch], VirtualizationException
    • FullyQualifiedErrorId : ObjectNotFound,Microsoft.HyperV.PowerShell.Commands.GetVMSwitch

@brainfull
Copy link

brainfull commented Nov 6, 2019

Did you try to reboot. The default VM switch gets re-created at each reboot.

Also look at this post, it seems there is a solution. Potential Fix

I was having the same error message just trying to connect to the Hyper-V manager on the localhost and the following steps resolved my issue maybe it will help you:

  1. Open "Window Security"
  2. Open "App & Browser control"
  3. Click "Exploit protection settings" at the bottom
  4. Switch to "Program settings" tab
  5. Locate "C:\WINDOWS\System32\vmcompute.exe" in the list and expand it
  6. Click "Edit"
  7. Scroll down to "Code flow guard (CFG)" and uncheck "Override system settings"
  8. Start vmcompute from powershell "net start vmcompute"

Also I suggest you look at using internal VM Switch. In my opinion it is a more robust solution than external switch. #5812 #5072

@medyagh
Copy link
Member

medyagh commented Nov 6, 2019

@asloan7 do you mind trying to see if @brainfull will comment helps ?

@asloan7
Copy link
Author

asloan7 commented Nov 6, 2019

Looks like that is under Windows Defender, but my laptop is using Symantec Endpoint Protection instead. So I don't have access to those setting, maybe there is a Symantec equivalent. Or in Registry?

@gbraad
Copy link
Contributor

gbraad commented Nov 19, 2019

Windows Enterprise does not offer the Default Switch (Windows 10 Home/Pro only) and HyperV support needs to be installed as a Server Role. It might very well be that you have installed just the manegement tools, although the Qualified Not Found might indicate an issue with cmdlets not being located correctly?

@gbraad
Copy link
Contributor

gbraad commented Nov 19, 2019

Hyper-V encountered an error trying to access an object on computer 'PATAPL-28WMZF2' because
the object was not found. The object might have been deleted. Verify that the Virtual Machine Management service on the computer is running.

Install the server role and make sure the services is started properly.

@asloan7
Copy link
Author

asloan7 commented Nov 21, 2019

@gbraad if you can provide a few Get-WindowsFeature, Install-WindowsFeature shell commands I can try that would be great

@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Feb 19, 2020
@tstromberg
Copy link
Contributor

@asloan7 - do you mind checking with the answer given here: https://superuser.com/questions/1026651/how-to-find-out-whether-hyper-v-is-currently-enabled-running

You can check the system log to see if any activity has occurred guide here:

  • Open Event Viewer. Click Start, click Administrative Tools, and then click Event Viewer.

  • Open the Hyper-V-Hypervisor event log. In the navigation pane, expand Applications and Services Logs, expand Microsoft, expand Hyper-V-Hypervisor, and then click Operational.

  • If Windows hypervisor is running, no further action is needed. If Windows hypervisor is not running, perform the following steps.

  • Open the System log. (In the navigation pane, expand Windows Logs and then select System.)

  • Look for events from Hyper-V-Hypervisor for more information. For example, event ID 41 indicates a problem with the BIOS configuration: “Hyper-V launch failed; Either VMX not present or not enabled in BIOS.” (To filter for these events, from the Actions pane, click Filter Current Log, and then for Event sources, specify “Hyper-V-Hypervisor”.)

@tstromberg tstromberg removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Mar 18, 2020
@asloan7
Copy link
Author

asloan7 commented Mar 19, 2020

I am guessing it is a permissions issue, not authorized to connect to server. I don't see any errors in Event Logs. But Virtual Machine Management Service doesn't show up in Services, possibly not installed? How did I get this far without it?

hyper-v-1

@sharifelgamal
Copy link
Collaborator

@asloan7 Is this still an issue? Did you try connecting to the Hyper-V Manager as an admin?

@tstromberg tstromberg changed the title hyperv: no External vswitch nor Default Switch found hyperv: no External vswitch nor Default Switch found (Get-VMSwitch fails) Apr 15, 2020
@tstromberg tstromberg removed the triage/needs-information Indicates an issue needs more information in order to work on it. label Apr 15, 2020
@sharifelgamal
Copy link
Collaborator

I'm going to go ahead and close this issue. Feel free to reopen if needed.

@C00kiie
Copy link

C00kiie commented Nov 20, 2023

I had a default VMSwitch that the script didn't detect on its own, and I even made an external one and it didn't get either.

PS C:\Windows\System32> Get-VMSwitch

Name           SwitchType NetAdapterInterfaceDescription
----           ---------- ------------------------------
Default Switch Internal
ExternalSwitch External   Realtek PCIe GbE Family Controller

PS C:\Windows\System32>

I ended up putting the name of the externalswitch:

Set-IniFileValue -Path $configFilePath -Section "vm" -Key "external_switch" -Value "ExternalSwitch"

You can get the name of your switch with this:

$(Get-VMSwitch)[0].Name
# or the second one
$(Get-VMSwitch)[1].Name

Not sure why it's not working with an internal switch to be honest. Hope this helps someone out there!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
co/hyperv HyperV related issues kind/support Categorizes issue or PR as a support question.
Projects
None yet
Development

No branches or pull requests

10 participants