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

Cannot create a new VM on git bash or cygwin #4996

Closed
cvila84 opened this issue Aug 6, 2019 · 13 comments · Fixed by #5025
Closed

Cannot create a new VM on git bash or cygwin #4996

cvila84 opened this issue Aug 6, 2019 · 13 comments · Fixed by #5025
Assignees
Labels
os/windows priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release.
Milestone

Comments

@cvila84
Copy link

cvila84 commented Aug 6, 2019

Hello,

When using GIT bash or cygwin, it is no more possible to create a new VM the first time as it fails with the following error (and hangs):

$ minikube start
* minikube v1.3.0 on Microsoft Windows 7 Enterprise Service Pack 1 6.1.7601 Build 7601
* Downloading VM boot image ...
E0806 14:52:32.005000    3936 progressbar.go:52] pool start: Can't get terminal settings: The handle is invalid.

Using winpty works but is not very convenient...

@afbjorklund
Copy link
Collaborator

Probably related to the emergency fix for #4983, don't think it was tested too much on Windows...

@tstromberg
Copy link
Contributor

tstromberg commented Aug 6, 2019

Interesting! Did this behavior change between v1.2.0 and v1.3.0? We're still using the same progressbar library, just a slightly different version of it. I suspect the error is raised here:

https://github.com/cheggaaa/pb/blob/40231cf7fa00b7c9098939b6a9e6f54f4b3ce020/pb_win.go#L115

@cvila84 - I currently don't have a way to duplicate this. My naive solution is to turn off the progressbar if the library returns an error. Do you mind trying to see if returning after we log the error solves the issue for you?

After this line:

glog.Errorf("pool start: %v", err)

Add:

return &readCloser{Reader: reader, close: func() error { return nil }}

@tstromberg tstromberg added the priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. label Aug 6, 2019
@tstromberg tstromberg added this to the v1.4.0 Candidate milestone Aug 6, 2019
@cvila84
Copy link
Author

cvila84 commented Aug 6, 2019

On minikube 1.2, it is working with the following display:

$ minikube start
* minikube v1.2.0 on windows (amd64)
* Downloading Minikube ISO ...
 73.66 MB / 129.33 MB   56.95% 5ss

On minikube 1.3 with winpty, it is working with the following display, which is quite different:

$ winpty minikube start
* minikube v1.3.0 on Microsoft Windows 7 Enterprise Service Pack 1 6.1.7601 Build 7601
* Upgrading from Kubernetes 1.15.0 to 1.15.2
* Downloading VM boot image ...
    minikube-v1.3.0.iso.sha256: 65 B / 65 B [=====================] 100.00% 0s
    minikube-v1.3.0.iso: 24.87 MiB / 131.07 MiB [==>----------]  18.98% 00m11s

@tstromberg I will test later your proposal and will let you know

@blueelvis
Copy link
Contributor

@cvila84 - Just curious but is there a reason why you are using Cygwin/Git for Bash and not PowerShell or CMD?

+1 . Can reproduce this on my machine in Git for Bash.

@tstromberg
Copy link
Contributor

Thanks for the update! I took a look at the old progress bar code, and nothing jumped out to me as to how it implemented a fallback from a full progress bar to the smaller version you saw.

https://github.com/jimmidyson/go-download/blob/master/download.go

It suspect the difference may come down to either the version of the pb library, or our use of pb.NewPool() rather than pb.NewProxyReader()

@blueelvis
Copy link
Contributor

@tstromberg -- I tried running after putting the line (which fails the compilation though so I returned without reader) and it is failing there -

Pranav.Jituri@DESKTOP-7RDHA6M MINGW64 /c/utilities
$ minikube start --vm-driver=hyperv --hyperv-virtual-switch="Default Switch" --alsologtostderr --v=9
W0806 23:49:08.351577    5400 root.go:208] Error reading config file at C:\Users\Pranav.Jituri\.minikube\config\config.json: open C:\Users\Pranav.Jituri\.minikube\config\config.json: The system cannot find the path specified.
I0806 23:49:08.365149    5400 notify.go:124] Checking for updates...
I0806 23:49:08.963989    5400 start.go:223] hostinfo: {"hostname":"DESKTOP-7RDHA6M","uptime":600187,"bootTime":1564515361,"procs":423,"os":"windows","platform":"Microsoft Windows 10 Enterprise","platformFamily":"Standalone Workstation","platformVersion":"10.0.18362 Build 18362","kernelVersion":"","virtualizationSystem":"","virtualizationRole":"","hostid":"d65b802f-d67d-4ab5-9441-d23671857fd0"}
W0806 23:49:08.963989    5400 start.go:231] gopshost.Virtualization returned error: not implemented yet
* minikube v1.3.0 on Microsoft Windows 10 Enterprise 10.0.18362 Build 18362
I0806 23:49:08.968065    5400 downloader.go:76] full url: https://storage.googleapis.com/minikube/iso/minikube-v1.3.0.iso?checksum=file:https://storage.googleapis.com/minikube/iso/minikube-v1.3.0.iso.sha256
* Downloading VM boot image ...
E0806 23:49:10.503699    5400 progressbar.go:52] pool start: Can't get terminal settings: The handle is invalid.

@afbjorklund
Copy link
Collaborator

Apparently this is "normal", as in a difference between winpty and mintty (that MSYS2/Cygwin uses)

Note that mintty does not provide a Windows console environment. These are two different worlds, you cannot expect GetConsole... to work. To find out the terminal size, ioctl should work in an MSYS program but not necessarily in a MinGW program, note there is a distinction. Alternatively, you may query the terminal with the respective control sequences and check the response.

(says mintty/mintty#482)

So I think you need to file a bug with github.com/cheggaaa/pb, to check for a MinTTY on Windows ?

@tstromberg tstromberg modified the milestones: v1.4.0 Candidate, v1.3.1 Aug 7, 2019
@blueelvis
Copy link
Contributor

This also seems to be happening on Command Prompt (With Admin). I was trying to run integration tests and facing this same issue -

D:\dev\minikube>go test -v -test.timeout=60m ./test/integration --tags="integration container_image_ostree_stub containers_image_openpgp" -minikube-start-args='--vm-driver=hyperv' -test.run=TestDocker -minikube-args='--hyperv-virtual-switch="Default Switch"'
ERROR: logging before flag.Parse: I0807 12:32:45.761285   32932 vm_assets.go:203] Created asset deploy/addons/addon-manager.yaml.tmpl with 1452 bytes
ERROR: logging before flag.Parse: I0807 12:32:45.772285   32932 vm_assets.go:203] Created asset deploy/addons/dashboard/dashboard-dp.yaml.tmpl with 1605 bytes
ERROR: logging before flag.Parse: I0807 12:32:45.772285   32932 vm_assets.go:203] Created asset deploy/addons/dashboard/dashboard-svc.yaml.tmpl with 979 bytes
ERROR: logging before flag.Parse: I0807 12:32:45.772285   32932 vm_assets.go:203] Created asset deploy/addons/storageclass/storageclass.yaml.tmpl with 271 bytes
ERROR: logging before flag.Parse: I0807 12:32:45.775292   32932 vm_assets.go:203] Created asset deploy/addons/storage-provisioner/storage-provisioner.yaml.tmpl with 1755 bytes
ERROR: logging before flag.Parse: I0807 12:32:45.775292   32932 vm_assets.go:203] Created asset deploy/addons/storage-provisioner-gluster/storage-gluster-ns.yaml.tmpl with 230 bytes
ERROR: logging before flag.Parse: I0807 12:32:45.775292   32932 vm_assets.go:203] Created asset deploy/addons/storage-provisioner-gluster/glusterfs-daemonset.yaml.tmpl with 3888 bytes
ERROR: logging before flag.Parse: I0807 12:32:45.776283   32932 vm_assets.go:203] Created asset deploy/addons/storage-provisioner-gluster/heketi-deployment.yaml.tmpl with 3932 bytes
ERROR: logging before flag.Parse: I0807 12:32:45.778301   32932 vm_assets.go:203] Created asset deploy/addons/storage-provisioner-gluster/storage-provisioner-glusterfile.yaml.tmpl with 3145 bytes
ERROR: logging before flag.Parse: I0807 12:32:45.788840   32932 vm_assets.go:203] Created asset deploy/addons/heapster/influx-grafana-rc.yaml.tmpl with 2540 bytes
ERROR: logging before flag.Parse: I0807 12:32:45.788840   32932 vm_assets.go:203] Created asset deploy/addons/heapster/grafana-svc.yaml.tmpl with 1085 bytes
ERROR: logging before flag.Parse: I0807 12:32:45.788840   32932 vm_assets.go:203] Created asset deploy/addons/heapster/influxdb-svc.yaml.tmpl with 1048 bytes
ERROR: logging before flag.Parse: I0807 12:32:45.789835   32932 vm_assets.go:203] Created asset deploy/addons/heapster/heapster-rc.yaml.tmpl with 1651 bytes
ERROR: logging before flag.Parse: I0807 12:32:45.789835   32932 vm_assets.go:203] Created asset deploy/addons/heapster/heapster-svc.yaml.tmpl with 1006 bytes
ERROR: logging before flag.Parse: I0807 12:32:45.795837   32932 vm_assets.go:203] Created asset deploy/addons/efk/elasticsearch-rc.yaml.tmpl with 2209 bytes
ERROR: logging before flag.Parse: I0807 12:32:45.795837   32932 vm_assets.go:203] Created asset deploy/addons/efk/elasticsearch-svc.yaml.tmpl with 947 bytes
ERROR: logging before flag.Parse: I0807 12:32:45.807836   32932 vm_assets.go:203] Created asset deploy/addons/efk/fluentd-es-rc.yaml.tmpl with 2096 bytes
ERROR: logging before flag.Parse: I0807 12:32:45.808860   32932 vm_assets.go:203] Created asset deploy/addons/efk/fluentd-es-configmap.yaml.tmpl with 9863 bytes
ERROR: logging before flag.Parse: I0807 12:32:45.808860   32932 vm_assets.go:203] Created asset deploy/addons/efk/kibana-rc.yaml.tmpl with 1606 bytes
ERROR: logging before flag.Parse: I0807 12:32:45.808860   32932 vm_assets.go:203] Created asset deploy/addons/efk/kibana-svc.yaml.tmpl with 1011 bytes
ERROR: logging before flag.Parse: I0807 12:32:45.809839   32932 vm_assets.go:203] Created asset deploy/addons/ingress/ingress-configmap.yaml.tmpl with 1281 bytes
ERROR: logging before flag.Parse: I0807 12:32:45.809839   32932 vm_assets.go:203] Created asset deploy/addons/ingress/ingress-rbac.yaml.tmpl with 2575 bytes
ERROR: logging before flag.Parse: I0807 12:32:45.811834   32932 vm_assets.go:203] Created asset deploy/addons/ingress/ingress-dp.yaml.tmpl with 3056 bytes
ERROR: logging before flag.Parse: I0807 12:32:45.811834   32932 vm_assets.go:203] Created asset deploy/addons/metrics-server/metrics-apiservice.yaml.tmpl with 401 bytes
ERROR: logging before flag.Parse: I0807 12:32:45.822840   32932 vm_assets.go:203] Created asset deploy/addons/metrics-server/metrics-server-deployment.yaml.tmpl with 671 bytes
ERROR: logging before flag.Parse: I0807 12:32:45.823845   32932 vm_assets.go:203] Created asset deploy/addons/metrics-server/metrics-server-service.yaml.tmpl with 401 bytes
ERROR: logging before flag.Parse: I0807 12:32:45.823845   32932 vm_assets.go:203] Created asset deploy/addons/registry/registry-rc.yaml.tmpl with 748 bytes
ERROR: logging before flag.Parse: I0807 12:32:45.823845   32932 vm_assets.go:203] Created asset deploy/addons/registry/registry-svc.yaml.tmpl with 333 bytes
ERROR: logging before flag.Parse: I0807 12:32:45.823845   32932 vm_assets.go:203] Created asset deploy/addons/registry/registry-proxy.yaml.tmpl with 754 bytes
ERROR: logging before flag.Parse: I0807 12:32:45.823845   32932 vm_assets.go:203] Created asset deploy/addons/registry-creds/registry-creds-rc.yaml.tmpl with 2868 bytes
ERROR: logging before flag.Parse: I0807 12:32:45.827840   32932 vm_assets.go:203] Created asset deploy/addons/freshpod/freshpod-rc.yaml.tmpl with 1437 bytes
ERROR: logging before flag.Parse: I0807 12:32:45.840839   32932 vm_assets.go:203] Created asset deploy/addons/gpu/nvidia-driver-installer.yaml.tmpl with 2487 bytes
ERROR: logging before flag.Parse: I0807 12:32:45.841837   32932 vm_assets.go:203] Created asset deploy/addons/gpu/nvidia-gpu-device-plugin.yaml.tmpl with 2111 bytes
ERROR: logging before flag.Parse: I0807 12:32:45.841837   32932 vm_assets.go:203] Created asset deploy/addons/logviewer/logviewer-dp-and-svc.yaml.tmpl with 1942 bytes
ERROR: logging before flag.Parse: I0807 12:32:45.842855   32932 vm_assets.go:203] Created asset deploy/addons/logviewer/logviewer-rbac.yaml.tmpl with 1064 bytes
ERROR: logging before flag.Parse: I0807 12:32:45.846861   32932 vm_assets.go:203] Created asset deploy/addons/gvisor/gvisor-pod.yaml.tmpl with 1908 bytes
ERROR: logging before flag.Parse: I0807 12:32:45.847835   32932 vm_assets.go:203] Created asset deploy/addons/gvisor/gvisor-config.toml with 1789 bytes
ERROR: logging before flag.Parse: I0807 12:32:45.847835   32932 vm_assets.go:203] Created asset deploy/addons/gvisor/gvisor-containerd-shim.toml with 90 bytes
=== RUN   TestDocker
 12:32:46 | Run: [D:\dev\minikube\out\minikube delete]
 12:32:46 | > ! "minikube" cluster does not exist
 12:32:46 | > * The "minikube" cluster has been deleted.
 12:32:46 | Run: [D:\dev\minikube\out\minikube start '--vm-driver=hyperv' --wait=false '--hyperv-virtual-switch=Default Switch' --docker-env=FOO=BAR --docker-env=BAZ=BAT --docker-opt=debug --docker-opt=icc=true]
 12:32:46 | > * minikube v1.3.0 on Microsoft Windows 10 Enterprise 10.0.18362 Build 18362
 12:32:46 | > * Downloading VM boot image ...
 12:32:47 | ! E0807 12:32:47.069163   31116 progressbar.go:52] pool start: Can't get terminal settings: The handle is invalid.
FAIL    k8s.io/minikube/test/integration        22.646s

On PowerShell, the tests are not running but on CMD, they seem to be running but then this is happening.

@afbjorklund
Copy link
Collaborator

The winpty workaround seems to be the quickest fix for now, dockeruses the same workaround...

docker/for-win#1588

@cvila84
Copy link
Author

cvila84 commented Aug 7, 2019

Thanks for the update! I took a look at the old progress bar code, and nothing jumped out to me as to how it implemented a fallback from a full progress bar to the smaller version you saw.

https://github.com/jimmidyson/go-download/blob/master/download.go

It suspect the difference may come down to either the version of the pb library, or our use of pb.NewPool() rather than pb.NewProxyReader()

@tstromberg, I confirm it is related to NewPool instead of NewProxyReader. I tested with v2 and v3, and NewProxyReader is working well. I guess the pool is used because we now want to download in // 2 files for the ISO (the SHA and the actual ISO content). I suspect using a pool requires to lock the console differently as we need to write progress characters on several lines instead of only one with NewProxyReader. A potential fix could be to use 2 "simple" bars instead of a pool of 2. That said, the workaround is fine for me, less for my team mates who rely on a minikube wrapper for their day 2 day work (see our gokube project) which is not able yet to install and run winpty in front of each minikube command.

@blueelvis, we are using git bash/cygwin because some of our internal tools are bash scripts, and we don't want to rely on docker to run them, neither port them for the moment in powershell.

@tstromberg
Copy link
Contributor

tstromberg commented Aug 7, 2019

@cvila84 Thanks for the extra context. I propose we:

  • Check if cheggaaa/progressbar v3 has the same issue
  • If v3 has the same issue, switch from NewPool to NewProxyReader.

If someone wants to look at this, feel free to /assign yourself. Otherwise, I'm setting up a Windows machine today so that I can get better acquainted with Windows-specific issues.

I'd like this to be fixed ASAP and ship as part of v1.3.1 this week.

@blueelvis
Copy link
Contributor

/assign

@tstromberg - I did some testing today with v3 which doesn't have the Pools but it was causing weird display issues. Let me tinker some more with this.

-Pranav

@tstromberg
Copy link
Contributor

Any luck?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
os/windows priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants