title: SSH using terminal, cloud shell, or window browser in to Google Cloud VM instance not working
body: <p>I am new to google cloud computing. Recently have not been able to SSH into my VM instance, previously it worked by clicking the SSH button and opened a new browser window. I have tried several fixes based on internet searches, mostly summarized below:</p>
  <p>When I click the SSH button, it says &quot;Transferring Keys to the VM&quot; but never logs in and eventually times out.</p>
  <p>Attempt 1: I attempted to follow another thread <a href="https://stackoverflow.com/questions/60830501/google-vm-instance-not-opening-with-ssh">Google VM Instance not opening with SSH</a> and I increased the persistent disk size and reset the VM. Now it says &quot;Could not connect, retrying...&quot; when I click the SSH button and eventually times out.</p>
  <p>Attempt 2: I also tried SSHing into the VM using Google Cloud Shell using the command</p>
  <pre><code>gcloud beta compute ssh --zone &quot;myZONE&quot; &quot;VM_instance_name&quot; --project &quot;PROJECT_ID&quot;
  </code></pre>
  <p>And got the following error</p>
  <pre><code>Permission denied (publickey).
  ERROR: (gcloud.beta.compute.ssh) [/usr/bin/ssh] exited with return code [255].
  </code></pre>
  <p>I created new keys using</p>
  <pre><code>sudo gcloud compute config-ssh
  </code></pre>
  <p>and it gave me this error</p>
  <pre><code>ERROR: (gcloud.compute.config-ssh) The project property is set to the empty string, which is invalid.
  </code></pre>
  <p>I ran the following and it seems to work</p>
  <pre><code>gcloud config set project myPROJECT_ID
  Updated property [core/project].
  </code></pre>
  <p>But when I ran sudo gcloud again it gave me the same empty string error.</p>
  <p>Attempt 3: I also tried setting up the log in locally using google-cloud-sdk. I followed interactive installing instructions on <a href="https://cloud.google.com/sdk/docs/downloads-interactive" rel="nofollow noreferrer">Using the Google Cloud SDK installer</a>. I tried obtaining ssh key using</p>
  <pre><code>gcloud compute project-info describe --project myPROJECT_ID
  </code></pre>
  <p>and copied in into the ssh key on for the VM thru the cloud console website. I also tried</p>
  <pre><code>sudo gcloud compute config-ssh
  </code></pre>
  <p>which seemed to work and gave the following</p>
  <pre><code>Updating project ssh metadata...⠼Updated [https://...].                                                 
  Updating project ssh metadata...done.                                                                                                             
  You should now be able to use ssh/scp with your instances.
  For example, try running:
  
    $ ssh VMinstance.myzone.PROJECT_ID
  </code></pre>
  <p>When I try running the ssh command I get the following error.</p>
  <pre><code>ssh: Could not resolve hostname VMinstance.myzone.PROJECT_ID: nodename nor servname provided, or not known
  </code></pre>
  <p>My instance has &quot;enable connecting to serial ports&quot; activated.</p>
  <p>Any assistance is greatly appreciated.
  Thank you in advance.</p>
  <p>Update: for the VM instance in question, I clicked on <code>serial port 1 (console)</code> and here are the first 100 lines</p>
  <pre><code>serialport: Connected to PROJECT_ID.Zone.VMInstance port 1 (session ID: ##..., active connections: 1).
  Jul  2 12:19:02 INSTANCE google-accounts: INFO Removing user root.
  Jul  2 12:19:02 INSTANCE google-accounts: INFO Removing user root from the Google sudoers group.
  [1##.##8] google_accounts_daemon[822]: Removing user root from group google-sudoers
  Jul  2 12:19:02 INSTANCE google_accounts_daemon[822]: Removing user root from group google-sudoers
  [1##.##0] google_accounts_daemon[822]: gpasswd: /etc/group.####: No space left on device
  Jul  2 12:19:02 INSTANCE google_accounts_daemon[822]: gpasswd: /etc/group.####: No space left on device
  [1##.##6] google_accounts_daemon[822]: gpasswd: cannot lock /etc/group; try again later.
  Jul  2 12:19:02 INSTANCE google_accounts_daemon[822]: gpasswd: cannot lock /etc/group; try again later.
  Jul  2 12:19:02 INSTANCE google-accounts: WARNING Could not update user root. Command '['gpasswd', '-d', 'root', 'google-sudoers']' returned non-zero exit status 1..
  Jul  2 12:19:02 INSTANCE google-accounts: ERROR Exception calling the response handler. [Errno 2] No usable temporary directory found in ['/tmp', '/var/tmp', '/usr/tmp', '/'].#012Traceback (most recent call last):#012  File &quot;/usr/lib/python3/dist-packages/google_compute_engine/metadata_watcher.py&quot;, line 200, in WatchMetadata#012    handler(response)#012  File &quot;/usr/lib/python3/dist-packages/google_compute_engine/accounts/accounts_daemon.py&quot;, line 285, in HandleAccounts#012    self.utils.SetConfiguredUsers(desired_users.keys())#012  File &quot;/usr/lib/python3/dist-packages/google_compute_engine/accounts/accounts_utils.py&quot;, line 318, in SetConfiguredUsers#012    mode='w', prefix=prefix, delete=True) as updated_users:#012  File &quot;/usr/lib/python3.6/tempfile.py&quot;, line 681, in NamedTemporaryFile#012    prefix, suffix, dir, output_type = _sanitize_params(prefix, suffix, dir)#012  File &quot;/usr/lib/python3.6/tempfile.py&quot;, line 269, in _sanitize_params#012    dir = gettempdir()#012  File &quot;/usr/lib/python3.6/tempfile.py&quot;, line 437, in gettempdir#012    tempdir = _get_default_tempdir()#012  File &quot;/usr/lib/python3.6/tempfile.py&quot;, line 372, in _get_default_tempdir#012    dirlist)#012FileNotFoundError: [Errno 2] No usable temporary directory found in ['/tmp', '/var/tmp', '/usr/tmp', '/']
  Jul  2 12:19:41 INSTANCE systemd[1]: snapd.service: Start operation timed out. Terminating.
  Jul  2 12:20:03 INSTANCE google_accounts_daemon[822]: sed: couldn't flush /etc/ssh/sedYpckqQ: No space left on device
  [1##.##1] google_accounts_daemon[822]: sed: couldn't flush /etc/ssh/sedYpckqQ: No space left on device
  Jul  2 12:20:03 INSTANCE google_accounts_daemon[822]: sed: couldn't flush /etc/pam.d/sedeXXx0O: No space left on device
  [1##.##4] google_accounts_daemon[822]: sed: couldn't flush /etc/pam.d/sedeXXx0O: No space left on device
  Jul  2 12:20:03 INSTANCE google_accounts_daemon[822]: sed: couldn't flush /etc/pam.d/sed27Z7HO: No space left on device
  [1##.##2] google_accounts_daemon[822]: sed: couldn't flush /etc/pam.d/sed27Z7HO: No space left on device
  Jul  2 12:20:03 INSTANCE google_accounts_daemon[822]: sed: couldn't flush /etc/pam.d/sed3bBBFO: No space left on device
  [1##.##6] google_accounts_daemon[822]: sed: couldn't flush /etc/pam.d/sed3bBBFO: No space left on device
  Jul  2 12:20:03 INSTANCE google_accounts_daemon[822]: sed: couldn't flush /etc/pam.d/sedUKduxP: No space left on device
  [1##.##3] google_accounts_daemon[822]: sed: couldn't flush /etc/pam.d/sedUKduxP: No space left on device
  Jul  2 12:20:03 INSTANCE google_accounts_daemon[822]: sed: couldn't flush /etc/pam.d/sedhtixlP: No space left on device
  [1##.##0] google_accounts_daemon[822]: sed: couldn't flush /etc/pam.d/sedhtixlP: No space left on device
  Jul  2 12:20:03 INSTANCE google_accounts_daemon[822]: sed: couldn't flush /etc/pam.d/sedy6zVAS: No space left on device
  [1##.##9] google_accounts_daemon[822]: sed: couldn't flush /etc/pam.d/sedy6zVAS: No space left on device
  Jul  2 12:20:03 INSTANCE google_accounts_daemon[822]: Restarting optional services.
  [1##.##7] google_accounts_daemon[822]: Restarting optional services.
  Jul  2 12:20:03 INSTANCE systemd[1]: Stopping Login Service...
  Jul  2 12:20:03 INSTANCE systemd[1]: Stopped Login Service.
  Jul  2 12:20:03 INSTANCE systemd[1]: Starting Login Service...
  Jul  2 12:20:03 INSTANCE systemd[1]: Started Login Service.
  Jul  2 12:20:03 INSTANCE systemd[1]: Stopping Regular background program processing daemon...
  Jul  2 12:20:03 INSTANCE systemd[1]: Stopped Regular background program processing daemon.
  Jul  2 12:20:03 INSTANCE systemd[1]: Started Regular background program processing daemon.
  Jul  2 12:20:03 INSTANCE google_accounts_daemon[822]: Restarting SSHD
  [1##.##5] google_accounts_daemon[822]: Restarting SSHD
  Jul  2 12:20:03 INSTANCE systemd[1]: Stopping OpenBSD Secure Shell server...
  Jul  2 12:20:03 INSTANCE systemd[1]: Stopped OpenBSD Secure Shell server.
  Jul  2 12:20:03 INSTANCE systemd[1]: Starting Google Compute Engine Instance Setup...
  Jul  2 12:20:03 INSTANCE instance-setup: WARNING [Errno 28] No space left on device
  Jul  2 12:20:03 INSTANCE instance-setup: INFO Running google_set_multiqueue.
  Jul  2 12:20:03 INSTANCE instance-setup: INFO Setting /proc/irq/31/smp_affinity_list to 0 for device virtio1.
  Jul  2 12:20:03 INSTANCE instance-setup: INFO /proc/irq/31/smp_affinity_list: real affinity 0
  Jul  2 12:20:03 INSTANCE instance-setup: INFO Setting /proc/irq/32/smp_affinity_list to 0 for device virtio1.
  Jul  2 12:20:03 INSTANCE instance-setup: INFO /proc/irq/32/smp_affinity_list: real affinity 0
  Jul  2 12:20:03 INSTANCE instance-setup: INFO /usr/bin/google_set_multiqueue: line 139: echo: write error: No such file
   or directory
  Jul  2 12:20:03 INSTANCE instance-setup: INFO cat: /sys/class/net/ens4/queues/tx-0/xps_cpus: No such file or directory
  Jul  2 12:20:03 INSTANCE instance-setup: INFO Queue 0 XPS=/sys/class/net/ens4/queues/tx-0/xps_cpus for
  Jul  2 12:20:03 INSTANCE instance-setup: WARNING [Errno 28] No space left on device
  Jul  2 12:20:03 INSTANCE systemd[1]: Started Google Compute Engine Instance Setup.
  Jul  2 12:20:03 INSTANCE systemd[1]: Starting OpenBSD Secure Shell server...
  Jul  2 12:20:03 INSTANCE systemd[1]: Started OpenBSD Secure Shell server.
  Jul  2 12:20:03 INSTANCE systemd[1]: Stopping OpenBSD Secure Shell server...
  Jul  2 12:20:03 INSTANCE systemd[1]: Stopped OpenBSD Secure Shell server.
  Jul  2 12:20:03 INSTANCE systemd[1]: Starting Google Compute Engine Instance Setup...
  Jul  2 12:20:04 INSTANCE instance-setup: WARNING [Errno 28] No space left on device
  Jul  2 12:20:04 INSTANCE instance-setup: INFO Running google_set_multiqueue.
  Jul  2 12:20:04 INSTANCE instance-setup: INFO Setting /proc/irq/31/smp_affinity_list to 0 for device virtio1.
  Jul  2 12:20:04 INSTANCE instance-setup: INFO /proc/irq/31/smp_affinity_list: real affinity 0
  Jul  2 12:20:04 INSTANCE instance-setup: INFO Setting /proc/irq/32/smp_affinity_list to 0 for device virtio1.
  Jul  2 12:20:04 INSTANCE instance-setup: INFO /proc/irq/32/smp_affinity_list: real affinity 0
  Jul  2 12:20:04 INSTANCE instance-setup: INFO /usr/bin/google_set_multiqueue: line 139: echo: write error: No such file or directory
  </code></pre>