unable to connect to vm instance via SSH browser

772 views
Skip to first unread message

rob stgeorge

unread,
Jul 18, 2018, 8:54:26 AM7/18/18
to gce-discussion


Unable to connect to one of my instances via SSH. This is after upgrading debian jesse to stretch. It says transferring ssh keys, then says establishing connetion, then eventually comes up with below error.


Serial logs don't mean much to me, so if anyone has any ideas of ways to reset or fix this please let me know.


Thanks 





Fady (Google Cloud Platform)

unread,
Jul 18, 2018, 6:07:22 PM7/18/18
to gce-discussion

Hello Rob,


There are many reasons that the instance may not be accepting SSH keys. For example, you could have a full disk, broken SSH daemon, or a misconfigured firewall. Your issue could also be similar to this thread. Hence, I suggest checking this document that is detailing different approaches to troubleshoot it.


rob stgeorge

unread,
Jul 18, 2018, 8:49:21 PM7/18/18
to gce-discussion
So I can definitely connect via SSH via PUTTY, however how does one know what password to use?

Rahi (Google Cloud Support)

unread,
Jul 20, 2018, 2:46:25 PM7/20/18
to gce-discussion
Hello Rob,

Yes, you can definitely connect to your instance via the third party tools like Putty. Would you please confirm what password you are referring? Did you mean the "Passphrase" while generating Keys? 

However, if you are referring this thread then you need to setup a password you like into the startup script.

rob stgeorge

unread,
Jul 21, 2018, 12:32:52 AM7/21/18
to gce-discussion
Hi Rahi

My instance already has a startup script entered. How do I edit that if I can't SSH to it?

Many thanks again for your reply.

Rob

Navi Aujla (Google Cloud Support)

unread,
Jul 23, 2018, 10:25:24 AM7/23/18
to gce-discussion
Hello Rob, 

You can edit the startup script as follows:

Click on the instance > EDIT > Look for the 'custom metadata' section > Look for the key section with the parameter 'starup-script' and you can edit/add the contents of the existing starup script data. 

In addition, you can login directly to the instance by enabling interactive serial console and connect to the serial console. However, you will need existing username/password to login using this method. If you do not have any existing username/password, as mentioned by Rahi you can provide startup script to create username/password as example provided in this thread. 

rob stgeorge

unread,
Jul 23, 2018, 4:44:33 PM7/23/18
to gce-discussion
Thanks, I have done that and replaced the username and password with a username and password. Reset the instance and can get to the login prompt via the serial connection, however it continually says login incorrect as though the start up script has not run.

This is exactly what is in the value field of startup-script

#! /bin/bash
useradd -G sudo myusername
echo 'myusername:mypassword' | chpasswd              

Any ideas why it might not have run? Thankyou again.

Navi Aujla (Google Cloud Support)

unread,
Jul 24, 2018, 3:18:08 PM7/24/18
to gce-discussion
Hello Rob, 

As a test I spun up a new Debian strech using image : debian-9-stretch-v20180716 and use the same script you provided as a 'startup-script'. I was able to add a new user and login using the interactive serial console with the same user. 

You can verify the startup-script operation in the serial console logs (Click on the instance on Cloud console > Logs > Serial port 1 (console)) and look for the 'startup-script' operation in the log output to verify any error. In addition, make sure you are entering the right password when login to the instance.  

In addition, as suggested by Fady in earlier message, You can add SSH keys to the project metadata or instance metadata login to the instance with third party tools like putty. If already exist, verify the SSH key is not expired and test the login. 

Another login method you can try is using Google Cloud SDK: 'gcloud compute ssh'. If it fails, you can get more details on the failure using flags '--verbosity=debug' or '--log-http'. 

For example: gcloud compute ssh instance-name --zone us-central1-c --project=test-project --verbosity=debug 

I hope it helps.

rob stgeorge

unread,
Jul 24, 2018, 4:56:25 PM7/24/18
to gce-discussion
Thanks Navi, it appears from the serial logs that the start up scripts stopped running after I upgraded to Stretch.

This part "Starting Google Compute Engine Startup Scripts.." no longer happens.

I guess that explains why the user is not created. Any ideas how I can get this part running again?

Thanks again..

Rob

Navi Aujla (Google Cloud Support)

unread,
Jul 25, 2018, 12:41:53 PM7/25/18
to gce-discussion
Hello Rob, 

In order for us to verify, I would suggest you open a private issue report using this link providing all related information, for example, project-number, instance name and outcome of the provided workarounds(eg: 'gcloud compute ssh' etc.) mentioned in our conversation on this thread. 

艾俠

unread,
Aug 9, 2018, 8:38:17 AM8/9/18
to gce-discussion
I have totally same problem. I cannot connect to my debian 9 instances in my browser recently, with same error message. Use putty with SSH key pairs not work too, and startup-scripts seems not start at all. Would you suggest me to submit the issue report too?

Navi Aujla (Google Cloud Support)於 2018年7月26日星期四 UTC+8上午12時41分53秒寫道:

Taame (Google Cloud Support)

unread,
Aug 9, 2018, 5:53:15 PM8/9/18
to gce-discussion
Hi, 

if you're experiencing the same exact issue and after trying my colleagues provided solutions above. I would recommend you to open a private issue report using this link providing all your issue related information. 

For example ( project-number, instance name, and outcome of the provided workarounds(eg: 'gcloud compute ssh' etc.) ) mentioned in this thread. 

艾俠

unread,
Aug 30, 2018, 8:43:57 PM8/30/18
to gce-discussion
Thank you Taame. I have reported the issue but they can't help this situation, since I can't sure this isn't a person instance-related problem. Now I have tried all solutions, include the "gcloud compute ssh" way which described in the reply of the ticket, and I'm ready to install a new instance. Luckily I still could access to all of my files in my web server.

Anyway I personally think this problem could related to some Debian Stretch update, since my home file server (in my home) also stop works with SSH at similar time, when I did anything with just a chrooted user..

Taame (Google Cloud Support)於 2018年8月10日星期五 UTC+8上午5時53分15秒寫道:
Reply all
Reply to author
Forward
0 new messages