diff --git a/cmd/minikube/cmd/start.go b/cmd/minikube/cmd/start.go index 4701dbeb71df..8e329e212e7c 100644 --- a/cmd/minikube/cmd/start.go +++ b/cmd/minikube/cmd/start.go @@ -1046,8 +1046,19 @@ func validateNetwork(h *host.Host, r command.Runner) string { func trySSH(h *host.Host, ip string) { sshAddr := fmt.Sprintf("%s:22", ip) - conn, err := net.Dial("tcp", sshAddr) - if err != nil { + + dial := func() (err error) { + d := net.Dialer{Timeout: 3 * time.Second} + conn, err := d.Dial("tcp", sshAddr) + if err != nil { + out.WarningT("Unable to verify SSH connectivity: {{.error}}. Will retry...", out.V{"error": err}) + return err + } + _ = conn.Close() + return nil + } + + if err := retry.Expo(dial, time.Second, 13*time.Second); err != nil { exit.WithCodeT(exit.IO, `minikube is unable to connect to the VM: {{.error}} This is likely due to one of two reasons: @@ -1062,7 +1073,6 @@ Suggested workarounds: - Restart or reinstall {{.hypervisor}} - Use an alternative --vm-driver`, out.V{"error": err, "hypervisor": h.Driver.DriverName(), "ip": ip}) } - defer conn.Close() } func tryLookup(r command.Runner) {