Crc: [BUG] Windows Setup: Virtual Switch not Found

Created on 8 Sep 2019  Â·  13Comments  Â·  Source: code-ready/crc

General information

  • OS: Windows 10 1903
  • Hypervisor: Hyper-V

CRC version

crc-windows-1.0.0-beta.3-amd64

Steps to reproduce

  1. Download CRC Package
  2. Add crc Binary to PATH
  3. run crc setup

Expected

Installation should proceed as default switch exists

Actual

Installation fails with error: Virtual Switch not Found

Logs

\> crc setup --log-level debug
INFO Caching oc binary
DEBU oc binary already cached
INFO Unpacking bundle from the CRC binary
INFO Check Windows 10 release
INFO Hyper-V installed
INFO Is user a member of the Hyper-V Administrators group
DEBU Always add user
INFO Does the Hyper-V virtual switch exist
ERRO Error occurred: Virtual Switch not found
DEBU Virtual Switch not found
ERRO Error occurred: Please override the default by adding an external virtual switch and set configuration
FATA Please override the default by adding an external virtual switch and set configuration
kinbug owindows prioritmajor sizS

Most helpful comment

Dug through the code, found that it was looking for a switch explicitly named crc.

Renamed my Hyper-v virtual switch to crc and it setup without issue.

All 13 comments

Duplicate of #558 that I opened. Make sure that you logout after running it to ensure that you really are a member of the Hyper-V Administrators group. The Powershell cmdlet Get-VMSwitch should execute without error as a normal user (NOT in an elevated Powershell)

As mntioned, please relogin to make sure you are a member of the Hyper-V Administrators group.

We need to modify the message or detection somehow... the user check never worked well to do this, as it would return you are a member (but it wasn't activate as you can see with the vswitch check).

'the user check would return he is a member, but we find out an admin call that needs these privileges fails'...

hold on

hmmm... HEY! We can actually use this as a trick to optimize this check. We check for the user being part of the group. If not, we add him... at the end we perform a simple get-vmswitch and see if it fails, to determine IF a reboot/relogin is needed.

@code-ready/crc-devel WDYT?

Updated the message and use Get-VMSwitch to determine if admin privileges are given

While troubleshooting the error below on my Windows 10 machine

ERRO Error occurred: Virtual Switch not found

running the PowerShell cmdlet Get-VMSwitch gave me the following error:

Hyper-V encountered an error trying to access an object on computer [_hostname_] because the object was not found. The object might have been deleted...

this is what fixed it:

Run the following command from an Elevated (Administrator) command prompt or PowerShell.
MOFCOMP %SYSTEMROOT%\System32\WindowsVirtualization.V2.mof

See details here FIX: Hyper-V encountered...

@enriquejavier Are you using BTW Windows 10 Enterprise? This is a non-standard situation, and likely caused by either a reconfig on the system. What did you do in recent time that prevented access to the Hyper-V cmdlets?

@enriquejavier ~Are you using BTW Windows 10 Enterprise?~ This is a non-standard situation, and likely caused by either a reconfig on the system. What did you do in recent time that prevented access to the Hyper-V cmdlets?

OS is Windows 10 Professional; I suspect the condition was related to having previously installed VirtualBox; but there is nothing special about this system.

However, on another system running Windows 10 Enterprise, the same “solution” did not work; in that case I had to completely remove the Hyper-V features from the system, and enable them back for CRC to get going.

Environment

Win 10 Enterprise
Behind corporate firewall
Set HTTP_PROXY and HTTPS_PROXY accordingly

Group

I'm in the Hyper-V Administrators group​

Switch

Added "Default Switch", rebooted

(non elevated powershell) λ Get-VMSwitch

Name           SwitchType NetAdapterInterfaceDescription
----           ---------- ------------------------------
Default Switch External   Broadcom NetXtreme Gigabit Ethernet

Still no dice, can't find switch (non elevated powershell)

(non elevated powershell) λ crc setup --log-level debug DEBU HTTP-PROXY: http://--correct-proxy--:80, HTTPS-PROXY: http://--correct-proxy--:80, NO-PROXY: 127.0.0.1,localhost INFO Checking if oc binary is cached DEBU oc binary already cached INFO Checking if CRC bundle is cached in '$HOME/.crc' INFO Checking if running as normal user INFO Checking Windows 10 release INFO Checking if Hyper-V is installed and operational INFO Checking if user is a member of the Hyper-V Administrators group INFO Checking if Hyper-V service is enabled INFO Checking if the Hyper-V virtual switch exist DEBU Virtual Switch not found ERRO Unable to perform Hyper-V administrative commands. Please make sure to re-login or reboot your system FATA Unable to perform Hyper-V administrative commands. Please make sure to re-login or reboot your system ​

Dug through the code, found that it was looking for a switch explicitly named crc.

Renamed my Hyper-v virtual switch to crc and it setup without issue.

Dug through the code, found that it was looking for a switch explicitly named crc.

Renamed my Hyper-v virtual switch to crc and it setup without issue.

That worked, thanks a lot!

This fix worked thanks!

Was this page helpful?
0 / 5 - 0 ratings