minishift / minishift-centos-iso

CentOS based ISO as an alternative for boot2docker ISO
GNU Lesser General Public License v3.0
40 stars 33 forks source link

Failed to do minishift start when "ssh" binary is not present in Windows 10 #95

Closed coolbrg closed 7 years ago

coolbrg commented 7 years ago

When trying to run minishift start in Windows 10 with no ssh binary in PowerShell/CMD, it fails with error Error configuring authorization on host: Something went wrong running an SSH command.

Full debug logs:

PS C:\> ssh
ssh : The term 'ssh' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, ver
the path is correct and try again.
At line:1 char:1
+ ssh
+ ~~~
    + CategoryInfo          : ObjectNotFound: (ssh:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

PS C:\> minishift.exe version
Minishift version: 1.0.0-beta.3

PS C:\> minishift.exe start -v 5 --show-libmachine-logs --iso-url https://github.com/minishift/minishift-centos-iso/releases/download/v1.0.0-rc.1/minishift-centos7.iso
Starting local OpenShift cluster using 'hyperv' hypervisor...
Found binary path at C:\usr_bin\minishift.exe
Launching plugin server for driver hyperv
Plugin server listening at address 127.0.0.1:52988
() Calling .GetVersion
Using API Version  1
() Calling .SetConfigRaw
() Calling .GetMachineName
(minishift) Calling .GetState
(minishift) DBG | [executing ==>] : C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive ( Get-VM minishift ).state
(minishift) DBG | [stdout =====>] : Running
(minishift) DBG |
Waiting for SSH to be available...
(minishift) DBG | [stderr =====>] :
Getting to WaitForSSH function...
(minishift) Calling .GetSSHHostname
(minishift) DBG | [executing ==>] : C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive ( Get-VM minishift ).state
(minishift) DBG | [stdout =====>] : Running
(minishift) DBG |
(minishift) DBG | [stderr =====>] :
(minishift) DBG | [executing ==>] : C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive (( Get-VM minishift ).networkadapters[0]).ipaddre
(minishift) DBG | [stdout =====>] : 10.70.35.184
(minishift) DBG |
(minishift) DBG | [stderr =====>] :
(minishift) Calling .GetSSHPort
(minishift) Calling .GetSSHKeyPath
(minishift) Calling .GetSSHKeyPath
(minishift) Calling .GetSSHUsername
SSH binary not found, using native Go implementation
&{{{<nil> 0 [] [] []} docker [0xa2bb10] <nil>  []} 10.70.35.184 22 <nil>}
About to run SSH command:
exit 0
SSH cmd err, output: <nil>:
(minishift) Calling .GetSSHHostname
(minishift) DBG | [executing ==>] : C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive ( Get-VM minishift ).state
(minishift) DBG | [stdout =====>] : Running
(minishift) DBG |
(minishift) DBG | [stderr =====>] :
(minishift) DBG | [executing ==>] : C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive (( Get-VM minishift ).networkadapters[0]).ipaddre
(minishift) DBG | [stdout =====>] : 10.70.35.184
(minishift) Calling .GetSSHPort
(minishift) DBG |
(minishift) DBG | [stderr =====>] :
(minishift) Calling .GetSSHKeyPath
(minishift) Calling .GetSSHKeyPath
(minishift) Calling .GetSSHUsername
SSH binary not found, using native Go implementation
&{{{<nil> 0 [] [] []} docker [0xa2bb10] <nil>  []} 10.70.35.184 22 <nil>}
About to run SSH command:
cat /etc/os-release
SSH cmd err, output: <nil>: NAME="Red Hat Enterprise Linux Server"
VERSION="7.3 (Maipo)"
ID="rhel"
ID_LIKE="fedora"
VERSION_ID="7.3"
PRETTY_NAME="Red Hat Enterprise Linux Server 7.3 (Maipo)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:redhat:enterprise_linux:7.3:GA:server"
HOME_URL="https://www.redhat.com/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"

REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 7"
REDHAT_BUGZILLA_PRODUCT_VERSION=7.3
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="7.3"
VARIANT="minishift"
VARIANT_VERSION="1.0.0-beta.1"
BUILD_ID="32b1717-25012017120136-8"

Detecting the provisioner...
Couldn't set key CPE_NAME, no corresponding struct field found
Couldn't set key , no corresponding struct field found
Couldn't set key REDHAT_BUGZILLA_PRODUCT, no corresponding struct field found
Couldn't set key REDHAT_BUGZILLA_PRODUCT_VERSION, no corresponding struct field found
Couldn't set key REDHAT_SUPPORT_PRODUCT, no corresponding struct field found
Couldn't set key REDHAT_SUPPORT_PRODUCT_VERSION, no corresponding struct field found
Couldn't set key VARIANT_VERSION, no corresponding struct field found
Couldn't set key BUILD_ID, no corresponding struct field found
No storage driver specified, instead using devicemapper

(minishift) Calling .GetMachineName
(minishift) Calling .GetSSHHostname
(minishift) DBG | [executing ==>] : C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive ( Get-VM minishift ).state
(minishift) DBG | [stdout =====>] : Running
(minishift) DBG |
(minishift) DBG | [stderr =====>] :
(minishift) DBG | [executing ==>] : C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive (( Get-VM minishift ).networkadapters[0]).ipaddre
(minishift) DBG | [stdout =====>] : 10.70.35.184
(minishift) DBG |
(minishift) Calling .GetSSHPort
(minishift) DBG | [stderr =====>] :
(minishift) Calling .GetSSHKeyPath
(minishift) Calling .GetSSHKeyPath
(minishift) Calling .GetSSHUsername
SSH binary not found, using native Go implementation
&{{{<nil> 0 [] [] []} docker [0xa2bb10] <nil>  []} 10.70.35.184 22 <nil>}
About to run SSH command:
sudo hostname minishift && echo "minishift" | sudo tee /etc/hostname
SSH cmd err, output: The handle is invalid.:
E0202 15:52:09.949643    5528 start.go:135] Error starting the VM: Error configuring authorization on host: Something went wrong running an SSH command!
command : sudo hostname minishift && echo "minishift" | sudo tee /etc/hostname
err     : The handle is invalid.
output  :
. Retrying.
Found binary path at C:\usr_bin\minishift.exe
Launching plugin server for driver hyperv
Plugin server listening at address 127.0.0.1:52998
() Calling .GetVersion
Using API Version  1
() Calling .SetConfigRaw
() Calling .GetMachineName
(minishift) Calling .GetState
(minishift) DBG | [executing ==>] : C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive ( Get-VM minishift ).state
(minishift) DBG | [stdout =====>] : Running
(minishift) DBG |
Waiting for SSH to be available...
(minishift) DBG | [stderr =====>] :
Getting to WaitForSSH function...
(minishift) Calling .GetSSHHostname
(minishift) DBG | [executing ==>] : C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive ( Get-VM minishift ).state
(minishift) DBG | [stdout =====>] : Running
(minishift) DBG |
(minishift) DBG | [stderr =====>] :
(minishift) DBG | [executing ==>] : C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive (( Get-VM minishift ).networkadapters[0]).ipaddre
(minishift) DBG | [stdout =====>] : 10.70.35.184
(minishift) DBG |
(minishift) Calling .GetSSHPort
(minishift) DBG | [stderr =====>] :
(minishift) Calling .GetSSHKeyPath
(minishift) Calling .GetSSHKeyPath
(minishift) Calling .GetSSHUsername
SSH binary not found, using native Go implementation
&{{{<nil> 0 [] [] []} docker [0xa2bb10] <nil>  []} 10.70.35.184 22 <nil>}
About to run SSH command:
exit 0
SSH cmd err, output: <nil>:
(minishift) Calling .GetSSHHostname
(minishift) DBG | [executing ==>] : C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive ( Get-VM minishift ).state
(minishift) DBG | [stdout =====>] : Running
(minishift) DBG |
(minishift) DBG | [stderr =====>] :
(minishift) DBG | [executing ==>] : C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive (( Get-VM minishift ).networkadapters[0]).ipaddre
(minishift) DBG | [stdout =====>] : 10.70.35.184
(minishift) DBG |
(minishift) DBG | [stderr =====>] :
(minishift) Calling .GetSSHPort
(minishift) Calling .GetSSHKeyPath
(minishift) Calling .GetSSHKeyPath
(minishift) Calling .GetSSHUsername
SSH binary not found, using native Go implementation
&{{{<nil> 0 [] [] []} docker [0xa2bb10] <nil>  []} 10.70.35.184 22 <nil>}
About to run SSH command:
cat /etc/os-release
SSH cmd err, output: <nil>: NAME="Red Hat Enterprise Linux Server"
VERSION="7.3 (Maipo)"
ID="rhel"
ID_LIKE="fedora"
VERSION_ID="7.3"
PRETTY_NAME="Red Hat Enterprise Linux Server 7.3 (Maipo)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:redhat:enterprise_linux:7.3:GA:server"
HOME_URL="https://www.redhat.com/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"

REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 7"
REDHAT_BUGZILLA_PRODUCT_VERSION=7.3
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="7.3"
VARIANT="minishift"
VARIANT_VERSION="1.0.0-beta.1"
BUILD_ID="32b1717-25012017120136-8"

Detecting the provisioner...
Couldn't set key CPE_NAME, no corresponding struct field found
Couldn't set key , no corresponding struct field found
Couldn't set key REDHAT_BUGZILLA_PRODUCT, no corresponding struct field found
Couldn't set key REDHAT_BUGZILLA_PRODUCT_VERSION, no corresponding struct field found
Couldn't set key REDHAT_SUPPORT_PRODUCT, no corresponding struct field found
Couldn't set key REDHAT_SUPPORT_PRODUCT_VERSION, no corresponding struct field found
Couldn't set key VARIANT_VERSION, no corresponding struct field found
Couldn't set key BUILD_ID, no corresponding struct field found
No storage driver specified, instead using devicemapper

(minishift) Calling .GetMachineName
(minishift) Calling .GetSSHHostname
(minishift) DBG | [executing ==>] : C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive ( Get-VM minishift ).state
(minishift) DBG | [stdout =====>] : Running
(minishift) DBG |
(minishift) DBG | [stderr =====>] :
(minishift) DBG | [executing ==>] : C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive (( Get-VM minishift ).networkadapters[0]).ipaddre
(minishift) DBG | [stdout =====>] : 10.70.35.184
(minishift) Calling .GetSSHPort
(minishift) DBG |
(minishift) DBG | [stderr =====>] :
(minishift) Calling .GetSSHKeyPath
(minishift) Calling .GetSSHKeyPath
(minishift) Calling .GetSSHUsername
SSH binary not found, using native Go implementation
&{{{<nil> 0 [] [] []} docker [0xa2bb10] <nil>  []} 10.70.35.184 22 <nil>}
About to run SSH command:
sudo hostname minishift && echo "minishift" | sudo tee /etc/hostname
SSH cmd err, output: The handle is invalid.:
E0202 15:52:15.920605    5528 start.go:135] Error starting the VM: Error configuring authorization on host: Something went wrong running an SSH command!
command : sudo hostname minishift && echo "minishift" | sudo tee /etc/hostname
err     : The handle is invalid.
output  :
. Retrying.
Found binary path at C:\usr_bin\minishift.exe
Launching plugin server for driver hyperv
Plugin server listening at address 127.0.0.1:53010
() Calling .GetVersion
Using API Version  1
() Calling .SetConfigRaw
() Calling .GetMachineName
(minishift) Calling .GetState
(minishift) DBG | [executing ==>] : C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive ( Get-VM minishift ).state
(minishift) DBG | [stdout =====>] : Running
Waiting for SSH to be available...
(minishift) DBG |
(minishift) DBG | [stderr =====>] :
Getting to WaitForSSH function...
(minishift) Calling .GetSSHHostname
(minishift) DBG | [executing ==>] : C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive ( Get-VM minishift ).state
(minishift) DBG | [stdout =====>] : Running
(minishift) DBG |
(minishift) DBG | [stderr =====>] :
(minishift) DBG | [executing ==>] : C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive (( Get-VM minishift ).networkadapters[0]).ipaddre
(minishift) DBG | [stdout =====>] : 10.70.35.184
(minishift) DBG |
(minishift) DBG | [stderr =====>] :
(minishift) Calling .GetSSHPort
(minishift) Calling .GetSSHKeyPath
(minishift) Calling .GetSSHKeyPath
(minishift) Calling .GetSSHUsername
SSH binary not found, using native Go implementation
&{{{<nil> 0 [] [] []} docker [0xa2bb10] <nil>  []} 10.70.35.184 22 <nil>}
About to run SSH command:
exit 0
SSH cmd err, output: <nil>:
(minishift) Calling .GetSSHHostname
(minishift) DBG | [executing ==>] : C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive ( Get-VM minishift ).state
(minishift) DBG | [stdout =====>] : Running
(minishift) DBG |
(minishift) DBG | [stderr =====>] :
(minishift) DBG | [executing ==>] : C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive (( Get-VM minishift ).networkadapters[0]).ipaddre
(minishift) DBG | [stdout =====>] : 10.70.35.184
(minishift) Calling .GetSSHPort
(minishift) DBG |
(minishift) DBG | [stderr =====>] :
(minishift) Calling .GetSSHKeyPath
(minishift) Calling .GetSSHKeyPath
(minishift) Calling .GetSSHUsername
SSH binary not found, using native Go implementation
&{{{<nil> 0 [] [] []} docker [0xa2bb10] <nil>  []} 10.70.35.184 22 <nil>}
About to run SSH command:
cat /etc/os-release
SSH cmd err, output: <nil>: NAME="Red Hat Enterprise Linux Server"
VERSION="7.3 (Maipo)"
ID="rhel"
ID_LIKE="fedora"
VERSION_ID="7.3"
PRETTY_NAME="Red Hat Enterprise Linux Server 7.3 (Maipo)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:redhat:enterprise_linux:7.3:GA:server"
HOME_URL="https://www.redhat.com/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"

REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 7"
REDHAT_BUGZILLA_PRODUCT_VERSION=7.3
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="7.3"
VARIANT="minishift"
VARIANT_VERSION="1.0.0-beta.1"
BUILD_ID="32b1717-25012017120136-8"

Detecting the provisioner...
Couldn't set key CPE_NAME, no corresponding struct field found
Couldn't set key , no corresponding struct field found
Couldn't set key REDHAT_BUGZILLA_PRODUCT, no corresponding struct field found
Couldn't set key REDHAT_BUGZILLA_PRODUCT_VERSION, no corresponding struct field found
Couldn't set key REDHAT_SUPPORT_PRODUCT, no corresponding struct field found
Couldn't set key REDHAT_SUPPORT_PRODUCT_VERSION, no corresponding struct field found
Couldn't set key VARIANT_VERSION, no corresponding struct field found
Couldn't set key BUILD_ID, no corresponding struct field found
No storage driver specified, instead using devicemapper

(minishift) Calling .GetMachineName
(minishift) Calling .GetSSHHostname
(minishift) DBG | [executing ==>] : C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive ( Get-VM minishift ).state
(minishift) DBG | [stdout =====>] : Running
(minishift) DBG |
(minishift) DBG | [stderr =====>] :
(minishift) DBG | [executing ==>] : C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive (( Get-VM minishift ).networkadapters[0]).ipaddre
(minishift) DBG | [stdout =====>] : 10.70.35.184
(minishift) DBG |
(minishift) DBG | [stderr =====>] :
(minishift) Calling .GetSSHPort
(minishift) Calling .GetSSHKeyPath
(minishift) Calling .GetSSHKeyPath
(minishift) Calling .GetSSHUsername
SSH binary not found, using native Go implementation
&{{{<nil> 0 [] [] []} docker [0xa2bb10] <nil>  []} 10.70.35.184 22 <nil>}
About to run SSH command:
sudo hostname minishift && echo "minishift" | sudo tee /etc/hostname
SSH cmd err, output: The handle is invalid.:
E0202 15:52:21.928084    5528 start.go:135] Error starting the VM: Error configuring authorization on host: Something went wrong running an SSH command!
command : sudo hostname minishift && echo "minishift" | sudo tee /etc/hostname
err     : The handle is invalid.
output  :
. Retrying.
E0202 15:52:21.931098    5528 start.go:141] Error starting the VM:  Error configuring authorization on host: Something went wrong running an SSH command!
command : sudo hostname minishift && echo "minishift" | sudo tee /etc/hostname
err     : The handle is invalid.
output  :

Error configuring authorization on host: Something went wrong running an SSH command!
command : sudo hostname minishift && echo "minishift" | sudo tee /etc/hostname
err     : The handle is invalid.
output  :

Error configuring authorization on host: Something went wrong running an SSH command!
command : sudo hostname minishift && echo "minishift" | sudo tee /etc/hostname
err     : The handle is invalid.
output  :

Running following command seems to work:

PS C:\> minishift.exe ssh 'sudo hostname minishift && echo "minishift" | sudo tee /etc/hostname'
minishift

NOTE : Not reproducible in Boot2docker-iso and happening with both HyperV and Virtualbox.

coolbrg commented 7 years ago

@hferentschik Looks like centos-iso issue and created here as not reproducible with boot2docker one.

Will be debugging now.

hferentschik commented 7 years ago

@budhrg any update on this. Did you get a chance to investigate?

coolbrg commented 7 years ago

any update on this. Did you get a chance to investigate?

Not yet @hferentschik due to service-manager issues last week. Will investigate if @gbraad is not (he seems to assigned himself 4 days ago)

gbraad commented 7 years ago

@budhrg you can have a look. I thought I was able to resolve it alongside of the other minor issues, but at the moment the other issue seems to consume a lot of time.

coolbrg commented 7 years ago

Ok @gbraad sure.

chelapurath commented 7 years ago

I am having the same issue.

Starting local OpenShift cluster using 'virtualbox' hypervisor... E0307 15:12:18.770542 15868 start.go:150] Error starting the VM: Error configuring authorization on host: something went wrong running an SSH command command : sudo hostname minishift && echo "minishift" | sudo tee /etc/hostname

chelapurath commented 7 years ago

Further looking into the issue, I found the problem. ( not sure this is correct )

the config file under .minishift\machines\minishift ssh port needs to be 22
"ConfigVersion": 3, "Driver": { "IPAddress": "192.168.99.100", "MachineName": "minishift", "SSHUser": "docker", "SSHPort": 22,

coolbrg commented 7 years ago

the config file under .minishift\machines\minishift ssh port needs to be 22

@chelapurath , interesting finding. Will need to check our end. Thanks.

So what is the SSHPort right now?

chelapurath commented 7 years ago

it does not work with port 22

(minishift) Waiting for an IP... Waiting for machine to be running, this may take a few minutes... Detecting operating system of created instance... Waiting for SSH to be available... Detecting the provisioner... Provisioning with minishift... E0308 10:48:11.786105 11372 start.go:150] Error starting the VM: Error creating the VM. Error creating machine: Error running provisioning: something went wrong running an SSH command command : sudo hostname minishift && echo "minishift" | sudo tee /etc/hostname err : The handle is invalid. output : . Retrying.

coolbrg commented 7 years ago

@chelapurath

I hope you are running only PowerShell or CMD here which doesn't have ssh package and hence the failure.

We are still detecting here why Golang native ssh is not working here.

In the meantime, could you install mingw (http://www.mingw.org/) and verify it works for you?

We tried with cygwin and it works but this seems to be heavy package.

chelapurath commented 7 years ago

Yes, that did work. Now facing issue with red hat subscription behind self-signed proxy I am passing http-proxy and https-proxy variables... since it is self signed the subscription manager failed on handshake

coolbrg commented 7 years ago

@praveenkumar Any clue on it? I think we have faced similar issue with CDK 2.* right?

BTW, @chelapurath we hangout on #minishift in irc.freenode.net. Feel free to join us .

praveenkumar commented 7 years ago

@chelapurath We don't have any support yet for self signed proxy (ssl support) for http/https one :(, We would love to hear how you set up your proxy environment so we can add support and test those piece out.

coolbrg commented 7 years ago

Thanks @praveenkumar

chelapurath commented 7 years ago

At this time, all of the developers are behind proxy (self-signed ssl) and need to connect to RHN network via proxy to subscribe their docker instances.

chelapurath commented 7 years ago

when I start minishift I see the following. What is exactly happening. Is there a provision to add my self signed cert into .minishift/certs folder and then it gets copied to /etc/rhsm/ca folder during the startup, so that the subscription can take place, securely?

Copying certs to the local machine directory... Copying certs to the remote machine.

praveenkumar commented 7 years ago

@chelapurath below certs are related to docker which generated when minishift start. As of now you can do it manually after minishift ssh

Copying certs to the local machine directory...
Copying certs to the remote machine.
coolbrg commented 7 years ago

Happening with VirtualBox driver too.

coolbrg commented 7 years ago

Some interesting bits:

I can inspect VM via ssh

PS C:\WINDOWS\system32>  minishift.exe ssh "df -h"
Filesystem           Size  Used Avail Use% Mounted on
/dev/mapper/live-rw  9.8G  770M  8.9G   8% /
devtmpfs             979M     0  979M   0% /dev
tmpfs               1001M     0 1001M   0% /dev/shm
tmpfs               1001M   17M  984M   2% /run
tmpfs               1001M     0 1001M   0% /sys/fs/cgroup
/dev/sr0             335M  335M     0 100% /run/initramfs/live
/dev/sda1             18G   56M   17G   1% /mnt/sda1
tmpfs                201M     0  201M   0% /run/user/0
tmpfs                201M     0  201M   0% /run/user/1000
coolbrg commented 7 years ago

I did some debugging and found that the error is coming up from docker/machine#redhat_ssh_commander.go and then found already opened issue in docker/machine#issue-3937.

The logs are exactly same as ours.

cc @hferentschik @gbraad @praveenkumar @LalatenduMohanty .

Also, introduced a new label status/blocked-by-other to mark it.

hferentschik commented 7 years ago

I think we should keep looking. Just because the issue might be in libmachine does not mean that we cannot debug it.

coolbrg commented 7 years ago

I think we should keep looking. Just because the issue might be in libmachine does not mean that we cannot debug it.

Ya @hferentschik , need a deep look into it. No update in the issue about resolution since 3 months

gbraad commented 7 years ago

Note: once the VM is running, doing a minishift ssh echo hello will work as expected from both cmd and powershell. (confirms the finding from Budhram made earlier)

It seems different paths are used for communication using minishift ssh and the provisioning...

gbraad commented 7 years ago

when using the generic ssh commander:

diff --git a/pkg/minishift/provisioner/minishift_provisioner.go b/pkg/minishift/provisioner/minishift_provisioner.go
index a2dd9394..10e235ef 100644
--- a/pkg/minishift/provisioner/minishift_provisioner.go
+++ b/pkg/minishift/provisioner/minishift_provisioner.go
@@ -35,7 +35,7 @@ import (

 func NewMinishiftProvisioner(osReleaseID string, d drivers.Driver) *MinishiftProvisioner {
        systemdProvisioner := provision.NewSystemdProvisioner(osReleaseID, d)
-       systemdProvisioner.SSHCommander = provision.RedHatSSHCommander{Driver: d}
+       systemdProvisioner.SSHCommander = provision.GenericSSHCommander{Driver: d}
        return &MinishiftProvisioner{

the code can run. The difference is in the generic implementation, ssh is invoked with:

func (sshCmder GenericSSHCommander) SSHCommand(args string) (string, error) {
    return drivers.RunSSHCommandFromDriver(sshCmder.Driver, args)
}

calling client.go: NewClient

func NewClient(user string, host string, port int, auth *Auth) (Client, error) {
    sshBinaryPath, err := exec.LookPath("ssh")
    if err != nil {
        log.Debug("SSH binary not found, using native Go implementation")
        client, err := NewNativeClient(user, host, port, auth)
        log.Debug(client)
        return client, err
    }

    if defaultClientType == Native {
        log.Debug("Using SSH client type: native")
        client, err := NewNativeClient(user, host, port, auth)
        log.Debug(client)
        return client, err
    }

    log.Debug("Using SSH client type: external")
    client, err := NewExternalClient(sshBinaryPath, user, host, port, auth)
    log.Debug(client)
    return client, err
}

and in the Red hat specific implementation as:

    var output string
    switch c := client.(type) {
    case *ssh.ExternalClient:
        c.BaseArgs = append(c.BaseArgs, "-tt")
        output, err = c.Output(args)
    case *ssh.NativeClient:
        log.Debugf("Using native client:\n%s", args)

        output, err = c.OutputWithPty(args)
    }
hferentschik commented 7 years ago

once the VM is running, doing a minishift ssh echo hello

interesting

hferentschik commented 7 years ago

The difference is in the generic implementation,

Does this mean we have a potential solution?

gbraad commented 7 years ago

@hferentschik I am trying to find out WHY there is a RedHat implementation. It seems they handle the requiretty case ? But in our case we are not having an issue with this on CentOS ? confused

hferentschik commented 7 years ago

I am trying to find out WHY there is a RedHat implementation. It seems they handle the requiretty case ? But in our case we are not having an issue with this on CentOS

Not sure. If not we should be able to just change the implementation, right. @praveenkumar was working on this initially, maybe he has some insights?

gbraad commented 7 years ago

@hferentschik just asked him on IRC, but again here... @praveenkumar why do we use the RedHatSSHCommander during the provisioning? is there a special need for this?

Would still have to test with the actual ssh clients being used (as they add -tt in the RedHatSSHCommander for similar reasons). Also still want to find why the handle is invalid...

gbraad commented 7 years ago

The problem occurs in RedHatSSHCommander at:

    fd := int(os.Stdin.Fd())
    termWidth, termHeight, err := terminal.GetSize(fd)

it seems the filehandle is not valid at this point, so it will never get the term size.

When ignored and using fixed values for termsize, like:

        ///fd := int(os.Stdin.Fd())
    termWidth := 80
    termHeight := 25

it will pass....

gbraad commented 7 years ago

Replacing RedHatSSHCommander (redhat.go) with:

package provision

import (
    "github.com/docker/machine/libmachine/drivers"
)

type RedHatSSHCommander struct {
    Driver drivers.Driver
}

func (sshCmder RedHatSSHCommander) SSHCommand(args string) (string, error) {
    return drivers.RunSSHCommandFromDriver(sshCmder.Driver, args)
}

passes install

gbraad commented 7 years ago

Proposed a fix to libmachine which address this problem: https://github.com/docker/machine/pull/4094

hferentschik commented 7 years ago

So with the merge of https://github.com/minishift/minishift/issues/912, can we close this issue. No external ssh client needed anymore on Windows, right?

If so, could we also resolve the corresponding CDK issue?

gbraad commented 7 years ago

Right. We can close this issue.