-->

GCE: cannot login, The VM guest environment is out

2020-07-06 00:18发布

问题:

I cannot ssh into my Google Compute Engine (GCE) Wordpress instance anymore. It was working one month ago when I tried last. I use the Google built-in SSH client in a Chrome browser window. Yesterday I tried an got the following message:

The VM guest environment is outdated and only supports the deprecated 'sshKeys' metadata item. Please follow the steps here to update.

The "Steps here" link navigates to https://cloud.google.com/compute/docs/images/configuring-imported-images#install_guest_environment which does not seem to help me much.

I am not aware of any changes that I may have made.

How can I fix this?

回答1:

It looks like your instance's disk is full, and so the SSH keys can't be created in the temp directory. You can do the following:

  1. Stop your instance and wait for it to shut down
  2. Click on the disk your instance is using, and choose "edit" at the top
  3. Enter a larger disk size, and save
  4. Go back to your instance and start it up again

You should now be able to connect via SSH. While you're in there, check to see what filled up your hard disk so you can prevent this from happening again (maybe a rogue program is printing out too many logs, etc).



回答2:

If you're seeing this on Debian 8 or 9, the most likely reason for this is that the google-compute-engine.* packages that allow SSH access to the instance have been removed by apt-get autoremove.

If you have an open SSH connection to the machine or can use a tool like gcloud, running apt-get update && sudo apt-get install gce-compute-image-packages should fix this.

If you no longer have any SSH access, there is a procedure available on the GCP docs site that can be used to restore it.



回答3:

I've created a bug report here for this.



回答4:

Might be a bit late, but you can

1) Stop the VM

2) Edit and enable serial console

3) Use the serial connection to login and update the VM



回答5:

recent days, I meet similar problem, later I find the permission rights of my home directory fools me, as a lazy-bone, I chmod 777 ~ After did that, I cannot ssh via my terminal, even cannot ssh via browser, only get 'The VM guest environment is outdated and only supports the deprecated 'sshKeys' metadata item, Plese follow the steps here to update'. Sounds like you must set 755 to your home dir, not just care your 700 .ssh or 600 authorized_keys.



回答6:

I met the similar issue after I created a FreeBSD VM, gcloud ssh not works, but I am lucky that I can use the browser window ssh to my VM. Then I manually add the google_compute-engine public key to the .ssh/authorized_keys, now it work, I can use the gcloud ssh to connect. But not sure if this is a better/security way.