1
votes

I created a google compute engine VM instance from a snapshot but I could not SSH into the instance. Got a message below saying

We are unable to connect to the VM on port 22

Upon looking at the serial console logs, it seems stuck at login for localhost:

Debian GNU/Linux 8 localhost ttyS0

localhost login: 
1
It's not stuck, it's waiting for you to enter login and password. If you don't have user and password to login, shutdown your VM and set a startup script by adding at the section Custom metadata key startup-script and value: useradd --groups google_sudoers tempuser and at the next line echo "tempuser:password" | chpasswd, and then start your VM. Here you can find an example. - Serhii Rohoza
@JohnHanley yup Google Cloud Firewall allows port 22 - Stanley
@Stanley Please have a look at the documentation Troubleshooting SSH. Have you tried to follow the instructions? - Serhii Rohoza
@Stanley The log looks good on the first glance. Please provide more details about your use case, VM configuration and machine-type. Do you have same issue with entering the VM via Console? - Serhii Rohoza
@SerhiiRohoza yup it is the same issue ... used an older snapshot to create the instance and it works ... could be an issue with snapshot corruption.. - Stanley

1 Answers

1
votes

As it was confirmed by @Stanley at the comment section, this issue was be an issue related to snapshot corruption.

If you have similar issues you can follow the documentation or/and this 3rd party example to troubleshoot your VM instance via serial console. In addition, some step by step guidance you can find in this answer.