1
votes

I have set up and have been using a Google Cloud Platform virtual machine. The browser ssh (a browser tab imitating a console) used to work fine. Yesterday, the sites and API hosted on the machine became unreachable.

The GCP console dashboard shows the machine to be up and running. However, the ssh (which used to work before), is not working. On click, it opens a new window, displays messages of transferring ssh keys ..., and then ultimately shows - An error occurred while communicating with the SSH server. Check the server and the network configuration.

After numerous such attempts, I restarted the VM instance from the GCP console, and everything started working again. But in less than a few hours of restart, the VM has again become reachable. Also, note that (1) the ping gives positive reply, (2) Console shows VM to be running normally, (3) All web pages, and API hosted on the machine are returning 408 (Request time out), (4) Restart cures the problem for a short while, (5) ssh through gcloud also not working, indefinitely waiting for connection with the server.

Since google support is only available on a paid basis, I am stuck. Any help would be deeply appreciated.

2
Can you share the serial port output? There may be an error message on your instance visible there. - rsalinas
Can you paste your firewall rules configuration? - guillaume blaquiere
First, stop using the Browser based SSH. This is a great feature, but invest in setting up good quality SSH tools (most are free). For Windows I use OpenSSH and Bitvise. Putty is famous. Plain old ssh works just fine on macOS and Linux. For example, with Bitvise I get a good file transfer window, I can easily open multiple terminal sessions, etc. - John Hanley
There are several things that can prevent you from connecting via ssh. Try using the following command in Cloud Shell (just remember to put your vm details) gcloud compute ssh example-instance --zone us-central1-a --verbosity=debug You could also look at the serial port 1 logs and look for things like: "no space left on device", "fail", "error", etc - grimmjow_sms
@grimmjow_sms Thanks about the verbosity flag. I have cleaned up some space in the system already. But it might come handy the next time. - Abhishek Prabhat

2 Answers

0
votes

As your issue seems to be more related with the OS, you may want to try and connect through the serial port as described here, however, I would say that a faster and more reliable way to solve this would be to simple increase the disk size of your instance as what you have assigned right now may not be enough for the operations you are running.

Additionally, you may find more help with this over at this answer which has a very complete rundown on what you may do in these cases.

0
votes

One other reason for not being able to ssh into a machine is because you are connected to a VPN network locally. This can prevent sshing to a gcp vm instance.

Disable local VPN connection and try again.