minikube: Hyper-V PowerShell Module is not available error when module is installed

Environment:

Minikube version (use minikube version): v0.25.1

  • OS (e.g. from /etc/os-release): Windows 10 Pro
  • VM Driver (e.g. cat ~/.minikube/machines/minikube/config.json | grep DriverName): n/a
  • ISO version (e.g. cat ~/.minikube/machines/minikube/config.json | grep -i ISO or minikube ssh cat /etc/VERSION): n/a
  • Install tools: Installed via isntaller and choco (same result)

What happened:

PS C:\WINDOWS\system32> minikube start --vm-driver hyperv --hyperv-virtual-switch “Primary Virtual Switch” Starting local Kubernetes v1.9.4 cluster… Starting VM… E0322 15:54:09.998217 13800 start.go:159] Error starting host: Error creating host: Error executing step: Running precreate checks. : Hyper-V PowerShell Module is not available.

Retrying. E0322 15:54:10.002181 13800 start.go:165] Error starting host: Error creating host: Error executing step: Running precreate checks. : Hyper-V PowerShell Module is not available PS C:\WINDOWS\system32>

How to reproduce it (as minimally and precisely as possible): Run minikube start --vm-driver hyperv --hyperv-virtual-switch "Primary Virtual Switch"

Anything else do we need to know:

It looks like line

https://github.com/kubernetes/minikube/blob/a000c35e17dbf74c571f439c41171343fa5ab67f/vendor/github.com/docker/machine/drivers/hyperv/powershell.go#L64 expects "Hyper-V", however when I run @(Get-Command hyper-v\Get-VM).ModuleName i get hyper-v (lowercase)

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 2
  • Comments: 34 (13 by maintainers)

Most upvoted comments

I am seeing this after upgrading to Minikube 0.26.0 on Windows 10 64-bit.

I’ll get a point release out today or tomorrow.

With 0.26.0, I was having the same issue reported here. I noticed that the case of module name changes, between powershell and powershell in administrative mode. See screenshots below

Powershell Administrative mode image

Regular Powershell image

Downgrading to 0.25.2 did resolve the issue.

@gbraad it does not appear that there is a “correct casing”, rather that should be case insensitive. Also what is interesting, I don’t have this problem with 0.25.2 only with 0.26.0.

Import-Module hyper-v didn’t seem to work for me:

Starting local Kubernetes v1.10.0 cluster...
Starting VM...
E0416 09:59:32.849705    6828 start.go:159] Error starting host: Error creating host: Error executing step: Running precreate checks.
: Hyper-V PowerShell Module is not available.

 Retrying.
E0416 09:59:32.852150    6828 start.go:165] Error starting host:  Error creating host: Error executing step: Running precreate checks.
: Hyper-V PowerShell Module is not available

Edit* didn’t notice the newline there, which gave it different behavior. I’ll try that out. Edit 2* nope, no luck.

@dlorenc why are we closing this issue? (At least a timeline on release would help?) I’m still facing this issue as one of the Hyper-V users. What’s the plan for preventing this issue from coming back again?..

Well, we have experienced the same problem on Minishift’s end. This fix was only taken for the latest point-release, so you are right to say you didn’t have this with 0.25.2. If you actually look carefully at https://github.com/kubernetes/minikube/commits/v0.25.2 you can see @r2d4 took the fix I suggested => https://github.com/kubernetes/minikube/commit/d56405610edd0abc8491f49c8b7fd93fc1cca965 with the correct case. However, for some reason this fix is not in the master branch (and therefore also not in the 0.26.0 tagged release). The PR I pushed also changes the test to:

PS> @(Get-Module -ListAvailable hyper-v).Name | Get-Unique

which returns:

Hyper-V

Related issues: https://github.com/docker/machine/pull/4426, https://github.com/docker/machine/issues/4424, https://github.com/docker/machine/issues/4441, and a ton of others on the Docker/machine end.

Minikube original synced docker/machine version 0.14.0 as tag, but these fixes only came AFTER the release was made. they are included in the Docker edge releases, but as of now, it is still untagged.

I am getting this error also.

> minikube --hyperv-virtual-switch=External --vm-driver hyperv start
Starting local Kubernetes v1.9.4 cluster...
Starting VM...
E0322 15:35:50.113731   14884 start.go:159] Error starting host: Error creating host: Error executing step: Running precreate checks.
: Hyper-V PowerShell Module is not available.

 Retrying.
E0322 15:35:50.118733   14884 start.go:165] Error starting host:  Error creating host: Error executing step: Running precreate checks.
: Hyper-V PowerShell Module is not available

For an odd data point, the module name is “Hyper-V” for me when I check directly, but minikube sees it the same as @dariusj18?

> minikube.exe version
minikube version: v0.25.1

> @(get-command get-vm).ModuleName
Hyper-V

> @(get-command hyper-v\get-vm).ModuleName
Hyper-V

Running minikube verbose:

> minikube --hyperv-virtual-switch=External --vm-driver hyperv --v 7 start
Starting local Kubernetes v1.9.4 cluster...
Starting VM...
[executing ==>] : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive @(Get-Command hyper-v\Get-VM).ModuleName
[stdout =====>] : hyper-v
...

Powershell -NoProfile, it’s hyper-v lowercase?

> powershell -noprofile
> get-command hyper-v\get-vm

CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Cmdlet          Get-VM                                             2.0.0.0    hyper-v

Powershell interactive/default, it’s Hyper-V ?

PS C:\Users\jls> get-command hyper-v\get-vm

CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Cmdlet          Get-VM                                             2.0.0.0    Hyper-V

I confess to not know what exactly is causing this. It’s very strange, and I’m not convinced minikube is the problem, but maybe just a case-insensitive check will fix this?

Looks good to me with the new release 👍

@dlorenc any update? I could not get any of the workarounds mentioned above to work. 😦

As a workaround until a new version is released, try Import-Module hyper-v before using minikube

Gerard Braad | http://gbraad.nl [ Doing Open Source Matters ]

Re-opening until a release has been made and this has been tested by the OP or other Hyper-V users on this issue

@goudarzi yeah, many projects for some reason close issues when some code changes were made in the main branch, but before a release happened and before the fix could be tested by the affected users. That’s quite frustrating because from user’s point of few it is NOT FIXED unless they can download a release and try it. With the issue closed tracking it’s state becomes difficult. So I too wish, that issue are not closed until they actually resolved, or a statement is made that they are not going to be resolved at all.

They have been informed on the official channel => http://kubernetes.slack.com/ (Use http://slack.k8s.io/ if you haven’t signed up yet). It does not help to have another communication channel to discuss.

TL;dr: they have a missing commit from the libmachine codebase in 0.26.0, but @r2d4 did add this commit to 0.25.2

@gbraad I’d like to repeat myself that there is no “correct case” this powershell module names are case insensitive. I have two machines with the same version of Windows, and Powershell and the case returned for the module is different (see here) unless you know explanation for that, the comparison should be case insensitive, as some other links I saw (sorry do not have them now) suggest that the module names in powershell are case insensitive.

I don’t care as long as it works, I’m just pointing out, that stating that there is a “correct” case is dangerous, since empirical testing shows it’s wrong.

For docker-machine, you need to have https://github.com/docker/machine/tree/1e3b6b64504f2970252b06119d6dc1fb1982b4b4/drivers/hyperv compiled as binary… however at the moment they haven’t tagged and/or released this: Related issues: https://github.com/docker/machine/issues/4424, https://github.com/docker/machine/issues/4441

On Tue, Apr 3, 2018 at 2:20 AM, Gerard Braad me@gbraad.nl wrote:

This should have been fixed with syncing: https://github.com/kubernetes/minikube/tree/125eede1530caca69ce442f58b9ce703434f5388/vendor/github.com/docker/machine/drivers/hyperv

Make sure you run v0.25.2 => https://github.com/kubernetes/minikube/releases/tag/v0.25.2

Gerard Braad | http://gbraad.nl [ Doing Open Source Matters ]