Ssh – Couldn’t connect to google VM instance

google-compute-enginesshvirtual-machines

Couldn't connect to google VM instance from browser or even ssh from terminal .
From browser I am getting this error
"You cannot connect to the VM instance because of an unexpected error. Wait a few moments and then try again. (#15)"
From terminal getting error "Authentication failed: Exhausted available authentication methods"
My SSH keys are already added to the instance.
Also there is a good chance of boot disk has run out of space.But not sure how to free up memory without login to that server.
Thanks in Advance.

Best Answer

You can verify in the Serial Console logs if the root cause is the disk space being depleted. To check it see below:

1. Go to Compute Engine > VM Instance.
2. Click on the Instance to enter Instance details page.
3. Under Logs, click Serial port 1 (console).

Once verified, you can increase the disk size of your VM without logging in with SSH or even rebooting depending on your disk partition. See below for step by step instruction:

1. Go to Compute Engine page > Disks.
2. Click the name of the disk that you want to resize.
3. Click "Edit".
4. Enter the new size for your disk.
5. Click "Save" to apply your changes to the disk.

Note: If you are unable to change the disk size, you will need to stop your instance first. If it did not apply right away, try to reboot or add some command on startup script to resize the partition.

You can check this post for more detailed information and steps or the official documentation of GCP for disk resizing.

If you will need to use the growpart command to apply the new disk size but still unable to SSH. You can simply set the commands in the startup script using this guide.

Related Topic