0
votes

I cannot ssh into Google compute engine instance. Here is scenario.

  • I tried to ssh into an instance from ubuntu ssh client, so generated a private & public key in my local and added pubkey to metadata.

  • But got Permission denied (publickey) error message and the instance console was saying No space left on device

  • I then increased the size of the instance by 100GB more and then restart the instance.

  • After few mins later, tried to ssh into the instance again and getting the Permission denied (publickey) error again and the console said No usable temporary directory found in ['/tmp', '/var/tmp', '/usr/tmp', '/']

    Now I can't connect to the instance by any tool such as browser console, ssh client etc.

Is there any solution to address this problem?

Thanks in advance.

2
It sounds like you filled up your disk, and now stuff that needs to make new files is failing. Making it larger doesn't help automatically, you still need to grow the partition and expand the filesystem to use the new disk space. There are instructions for this here. You will also likely need to use the serial console since SSH doesn't have space to run. - Dan
@Dan, I am facing the same issue. I did upgrade the disk size but still not able to connect through SSH. I also tried to use serial console, but it prompts username and password which I don't know. Can you please give some light on this matter?. - sanjay
@sanjay: Sorry, I'm not sure how to get access to the VM through the console if you don't have a password for it. - Dan

2 Answers

1
votes

I faced the same problem during these days, and I solved it using winSCP to access the storage and delete a lot of heavy files created by my scripts, also because the the instructions here have been not so useful. If you do not know how to configure winSCP and GCP, follow my steps or this video.

winSCP - Create Keys

While creating a new site in winSCP

  • go to advanced --> ssh --> Authentication
  • click on Tools and open the Putty gen
  • generate public and private key
  • save them

copy the public key and open GCP

Setting your GCP instance

Click on your instance to edit its settings

  • scroll down until you reach ssh keys enter image description here
  • paste your key
  • save

Done, now you can access your instance storage and remove some files; after that, your instance will be able to boot correctly creating the temporary files needed.

0
votes

As Dan mentioned, you need to connect on serial console to expand the filesystem making use of the additional disk space allocated. You can also attempt to free up some space etc.