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

SSH never times out #233

Open
Temikus opened this issue Feb 21, 2020 · 3 comments
Open

SSH never times out #233

Temikus opened this issue Feb 21, 2020 · 3 comments

Comments

@Temikus
Copy link
Collaborator

Temikus commented Feb 21, 2020

Well this is embarassing, see run_instance.rb:

          unless env[:terminated]
            env[:metrics]["instance_ssh_time"] = Util::Timer.time do
              # Wait for SSH to be ready.
              env[:ui].info(I18n.t("vagrant_google.waiting_for_ssh"))
              while true
                # If we're interrupted just back out
                break if env[:interrupted]
                break if env[:machine].communicate.ready?
                sleep 2
              end
            end
            @logger.info("Time for SSH ready: #{env[:metrics]["instance_ssh_time"]}")
            env[:ui].info(I18n.t("vagrant_google.ready_ssh")) unless env[:interrupted]
          end

We need to add some communication and a timeout here.

@gdubicki
Copy link
Contributor

gdubicki commented Dec 26, 2021

I just tried to use this in a new GCP project where I forgot to add my public SSH key as project metadata and starting a new instance was hanging forever on:

==> default: Waiting for instance to become "ready"...
==> default: Machine is booted and ready for use!
==> default: Waiting for Communicator to become available...

...until I terminated it manually.

Is this the same problem or a similar one but in a different provisioning stage, @Temikus ?

I did #258 as a weak workaround, to prevent other people from wasting time the same way (I think that the best solution would be to implement validation for this in the plugin code. But it looks like fog-google does not have "get_project_SSH_keys" implemented and I don't feel strong enough in Ruby to implement that there and then using it here.)

@ericraio
Copy link

@gdubicki thanks for your comment, I realized that I did not hit the save button on the ssh key in the dashboard, looks like we need a timeout as this is suggesting

@FranckRnt
Copy link

FranckRnt commented Mar 7, 2023

Hello to all,
I found a workaround for the connection to be established, I had to set the variable override.ssh.host with an IP address.

I saw that this value was not filled in after running a vagrant up --debug.

For the moment I set the ip in hard because I haven't found a way to do it with a variable or dynamically

below the code :

Vagrant.configure("2") do |config|
  config.vm.box = "gce"

  config.vm.provider :google do |google, override|
    google.google_project_id = "your-project-id"
    google.google_json_key_location = "cred.json"
    google.image_family = 'rocky-linux-9'
    google.image_project_id = 'rocky-linux-cloud'
    google.name = "develvagrant"
    google.zone = "europe-west4-a"
    google.machine_type = "n2-standard-2"
    google.disk_size = 30
    google.network = 'lz-network'
    google.subnetwork = 'lz-subnetwork-eemshaven'
    google.external_ip = false
    google.tags = ['internet', 'ssh', 'europe-west-4']
    google.network_ip = '1.2.3.4'
    override.ssh.host = '1.2.3.4'
    override.ssh.username = "tstvagrantfrt"
    override.ssh.private_key_path = "id_rsa"
  end

end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants