Minikube: powershell core: Get-WindowsOptionalFeature -FeatureName Microsoft-Hyper-V-All -Online fails

Created on 11 Feb 2020  路  12Comments  路  Source: kubernetes/minikube

The exact command to reproduce the issue:
minikube start --vm-driver=hyperv

The full output of the command that failed:

* minikube v1.7.2 on Microsoft Windows 10 Pro 10.0.18362 Build 18362
* Using the hyperv driver based on user configuration

! 'hyperv' driver reported an issue: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe Get-WindowsOptionalFeature -FeatureName Microsoft-Hyper-V-All -Online failed:

* Suggestion: Start PowerShell as Administrator, and run: 'Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All'
* Documentation: https://minikube.sigs.k8s.io/docs/reference/drivers/hyperv/

X hyperv does not appear to be installed

The operating system version:
Microsoft Windows 10 Pro 10.0.18362 Build 18362

I tried this on 2 seperate machines that I use PowerShell Core primarily from and both failed with the same error. If I run the suspected "failed" command:

Get-WindowsOptionalFeature -FeatureName Microsoft-Hyper-V-All -Online

It seems to work just fine from Windows PowerShell so the error is at the very least misleading. I would suggest at least putting notes in the documentation stating that it is incompatible with PS Core until the issue is fixed or update the error message to allow users to be more aware of the actual issue.

Thanks!

chyperv help wanted kinbug lifecyclrotten prioritbacklog

Most helpful comment

Using --force as suggested in this issue got me started and the vm started up #6579

All 12 comments

I've got it running in PSCore on Linux Mint using the --vm-driver=none option and it's working great. Have you tried that?

I have not, but I am not using Linux. This issue seems to be specifically related to minikube's ability to detect Hyper-V enablement which would only be applicable on a Windows OS. If anyone can confirm either a reproduction of the issue or a succesful running of minikube installing under these parameters that would help.

same

> minikube.exe version
minikube version: v1.7.2
commit: 50d543b5fcb0e1c0d7c27b1398a9a9790df09dfb

windows version

> [System.Environment]::OSVersion.Version

Major  Minor  Build  Revision
-----  -----  -----  --------
10     0      18363  0

Followed the advice of last failure to enable online feature

> Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All


Path          :
Online        : True
RestartNeeded : False

Rebooted windows 10, then try minikube install

> minikube start --memory=4G --vm-driver hyperv --hyperv-virtual-switch minikube --v=7 --alsologtostderr
I0212 06:42:23.457174    8276 notify.go:125] Checking for updates...
I0212 06:42:23.593411    8276 start.go:259] hostinfo: {"hostname":"LAPTOP-8JAKAPLQ","uptime":1082,"bootTime":1581517461,"procs":229,"os":"windows","platform":"Microsoft Windows 10 Pro","platformFamily":"Standalone Workstation","platformVersion":"10.0.18363 Build 18363","kernelVersion":"","virtualizationSystem":"","virtualizationRole":"","hostid":"cea0e649-68e9-4d06-82a7-593b6f97a431"}
W0212 06:42:23.594175    8276 start.go:267] gopshost.Virtualization returned error: not implemented yet
* minikube v1.7.2 on Microsoft Windows 10 Pro 10.0.18363 Build 18363
I0212 06:42:23.599204    8276 driver.go:199] Setting default libvirt URI to qemu:///system
* Using the hyperv driver based on user configuration
I0212 06:42:25.622355    8276 start.go:306] selected driver: hyperv
I0212 06:42:25.622355    8276 start.go:612] validating driver "hyperv" against <nil>
I0212 06:42:25.623320    8276 start.go:618] status for hyperv: {Installed:false Healthy:false Error:C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe Get-WindowsOptionalFeature -FeatureName Microsoft-Hyper-V-All -Online failed:
 Fix:Start PowerShell as Administrator, and run: 'Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All' Doc:https://minikube.sigs.k8s.io/docs/reference/drivers/hyperv/}

! 'hyperv' driver reported an issue: C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe Get-WindowsOptionalFeature -FeatureName Microsoft-Hyper-V-All -Online failed:

* Suggestion: Start PowerShell as Administrator, and run: 'Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All'
* Documentation: https://minikube.sigs.k8s.io/docs/reference/drivers/hyperv/

X hyperv does not appear to be installed

the output of WindowsOptionalFeature

> Get-WindowsOptionalFeature -FeatureName Microsoft-Hyper-V-All -Online


FeatureName      : Microsoft-Hyper-V-All
DisplayName      : Hyper-V
Description      : Provides services and management tools for creating and running virtual machines and their
                   resources.
RestartRequired  : Possible
State            : Enabled
CustomProperties :

Using --force as suggested in this issue got me started and the vm started up #6579

Just looked into the source where this checks for hyperv availability and I think the underlying issue is something that can't really be scripted away: You'll need to run the Powershell session with elevated permissions (as administrator).

Was running as admin - sorry should have mentioned that. The related issue i posted in my last comment worked around the issue for me.

@mhintzke in 1.7.3 we added a feature to auto create virtual switches. do you mind trying with 1.7.3 ?

@mhintzke do you still have this issue, have you had the chance to try with latest release ?

I tried this with the v1.8.0 of minikube on W10 and an admin powershell instance.

I tried this with the v1.8.0 of minikube on W10 and an admin powershell instance.

@asatrur what was the error ?

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

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.

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 rotten

Was this page helpful?
0 / 5 - 0 ratings