我正在使用Google Cloud Platform并通过Google Cloud Console连接到我的VM实例。重新启动VM而不保留静态IP因此在VM重新启动时,临时IP已更改。我重新启动VM的原因是因为我注意到CPU利用率一直是100%,我认为这不是我本地VM实例(Ubuntu 16.x)的CPU,而是Google共享容器CPU利用率。但它不允许我通过SSH连接到我的VM实例,所以我认为重启可能有所帮助。
虚拟机重启确实有所帮助,但知识产权发生了变化:(我运行Apache和Nginx服务器,因此我必须手动更新相应配置文件中的新IP才能运行我的应用程序。由于虚拟机重启,我遇到了麻烦通过SSH连接到VM实例。
防火墙规则 - 确定(设置为允许端口22) .ssh / sshd_conf - 好的(RSAauth是的) GCE VM SSH密钥 - 确定(保存用户的公钥)
我尝试了以下步骤解决问题,但徒劳无功
/etc/ssh/authorized_keys
为空时,我使用gcloud init
重新初始化,该gcloud command
处理oAuth部分,但这并未解决问题server refused key
,但它不断抛出错误/var/log/syslog
最后,来自Sep 25 22:30:01 cs-6000-devshell-vm-c72ffc0b-5c39-48a6-854c-fce64f031c54-41 CRON[1746]: (root) CMD (/google/scripts/gcloud_docker_auth.sh)
Sep 25 22:33:19 cs-6000-devshell-vm-c72ffc0b-5c39-48a6-854c-fce64f031c54-41 supervisord: credentials-service INFO:root:Proxying devshell request, attempt (1 of 3)
Sep 25 22:33:19 cs-6000-devshell-vm-c72ffc0b-5c39-48a6-854c-fce64f031c54-41 supervisord: credentials-service INFO:root:Connecting to DEVSHELL_CLIENT_PORT 40159
Sep 25 22:33:19 cs-6000-devshell-vm-c72ffc0b-5c39-48a6-854c-fce64f031c54-41 supervisord: credentials-service INFO:root:writing to devshell 4 bytes
Sep 25 22:33:19 cs-6000-devshell-vm-c72ffc0b-5c39-48a6-854c-fce64f031c54-41 supervisord: credentials-service INFO:root:read from devshell 293 bytes
Sep 25 22:33:19 cs-6000-devshell-vm-c72ffc0b-5c39-48a6-854c-fce64f031c54-41 supervisord: credentials-service INFO:root:Closing devshell forwarding connection.
Sep 25 22:33:19 cs-6000-devshell-vm-c72ffc0b-5c39-48a6-854c-fce64f031c54-41 supervisord: credentials-service INFO:root:Closing client connection.
Sep 25 22:35:01 cs-6000-devshell-vm-c72ffc0b-5c39-48a6-854c-fce64f031c54-41 CRON[1774]: (root) CMD (/google/scripts/gcloud_docker_auth.sh)
Sep 25 22:37:10 cs-6000-devshell-vm-c72ffc0b-5c39-48a6-854c-fce64f031c54-41 supervisord: control-command-service INFO:root:saw no newline in the first 6 bytes Retrying...(1$
Sep 25 22:37:14 cs-6000-devshell-vm-c72ffc0b-5c39-48a6-854c-fce64f031c54-41 supervisord: control-command-service INFO:root:Error, could not connect to devshell. Retrying...$
Sep 25 22:37:22 cs-6000-devshell-vm-c72ffc0b-5c39-48a6-854c-fce64f031c54-41 supervisord: control-command-service ERROR:root:Error, could not connect to devshell. Giving up.
Sep 25 22:37:22 cs-6000-devshell-vm-c72ffc0b-5c39-48a6-854c-fce64f031c54-41 supervisord: control-command-service Traceback (most recent call last):
Sep 25 22:37:22 cs-6000-devshell-vm-c72ffc0b-5c39-48a6-854c-fce64f031c54-41 supervisord: control-command-service File "/google/credentials/control_server.py", line 110, i$
Sep 25 22:37:22 cs-6000-devshell-vm-c72ffc0b-5c39-48a6-854c-fce64f031c54-41 supervisord: control-command-service self.hanging_socket.connect(('localhost', self.server_p$
Sep 25 22:37:22 cs-6000-devshell-vm-c72ffc0b-5c39-48a6-854c-fce64f031c54-41 supervisord: control-command-service File "/usr/lib/python2.7/socket.py", line 224, in meth
Sep 25 22:37:22 cs-6000-devshell-vm-c72ffc0b-5c39-48a6-854c-fce64f031c54-41 supervisord: control-command-service return getattr(self._sock,name)(*args)
Sep 25 22:37:22 cs-6000-devshell-vm-c72ffc0b-5c39-48a6-854c-fce64f031c54-41 supervisord: control-command-service error: [Errno 111] Connection refused
Sep 25 22:37:22 cs-6000-devshell-vm-c72ffc0b-5c39-48a6-854c-fce64f031c54-41 supervisord: 2017-09-25 22:37:22,640 INFO exited: control-command-service (exit status 0; expect$
Sep 25 22:37:23 cs-6000-devshell-vm-c72ffc0b-5c39-48a6-854c-fce64f031c54-41 supervisord: 2017-09-25 22:37:23,642 INFO spawned: 'control-command-service' with pid 1801
Sep 25 22:37:23 cs-6000-devshell-vm-c72ffc0b-5c39-48a6-854c-fce64f031c54-41 supervisord: control-command-service INFO:root:Error, could not connect to devshell. Retrying...$
Sep 25 22:37:23 cs-6000-devshell-vm-c72ffc0b-5c39-48a6-854c-fce64f031c54-41 supervisord: control-command-service INFO:root:Error, could not connect to devshell. Retrying...$
Sep 25 22:37:24 cs-6000-devshell-vm-c72ffc0b-5c39-48a6-854c-fce64f031c54-41 supervisord: 2017-09-25 22:37:24,705 INFO success: control-command-service entered RUNNING state$
Sep 25 22:37:27 cs-6000-devshell-vm-c72ffc0b-5c39-48a6-854c-fce64f031c54-41 supervisord: control-command-service INFO:root:Error, could not connect to devshell. Retrying...$
Sep 25 22:37:27 cs-6000-devshell-vm-c72ffc0b-5c39-48a6-854c-fce64f031c54-41 supervisord: control-command-service INFO:root:Error, could not connect to devshell. Retrying...$
Sep 25 22:37:34 cs-6000-devshell-vm-c72ffc0b-5c39-48a6-854c-fce64f031c54-41 supervisord: control-command-service INFO:root:Executing health check.
and
答案 0 :(得分:0)
我有类似的问题,在我的情况下,根本原因是我的VM是配置的SSH密钥无法在VM重新启动后幸存(一旦重新启动VM实例,它们将从VM配置中消失)。
不太清楚这是什么真正原因,但是我的拙劣理论是,默认情况下,SSH kyes默认直接存储在引导磁盘上(而不是持久卷),并且在我的情况下,VM已配置为{{1} }选项启用后,我猜想此功能已在重启后以某种方式触发,这意味着SSH密钥已因删除启动磁盘而丢失。
答案 1 :(得分:0)
您的问题可能是访客环境。
{#! / bin / bash useradd -G sudo USERNAME 回显“ USERNAME:PASSWORD” | chpasswd}
然后在需要获取的实例内部,该实例无法通过验证来宾环境运行:
首先:在串行控制台中查看下面列出的这些行:
第二:验证是否安装了用于来宾环境的软件包,然后在串行输出中运行命令
apt list --installed | grep google-compute
它应该列出以下行: -谷歌计算引擎 -google-compute-engine-oslogin -python-google-compute-engine -python3-google-compute-engine
第三:您需要通过运行以下命令来验证用于来宾环境的所有服务是否正在运行:
sudo systemctl list-unit-files | grep google | grep enabled
它应该列出以下行:
如果有时与上述情况有所不同,则可能需要重新启动服务或安装Guest environment