无法连接到 Google 虚拟机

Can't connect to Goggle VM

需要一些帮助...

无法访问我的 VM 我已尝试使用 gcloudbrowser sshssh...

我编辑了元数据,enable-oslogin 设置为 FALSE...我在这里回答了所有问题,但找不到解决我遇到的问题的方法。

一开始我认为这是一个 space 问题,所以我停止了实例并调整了我的磁盘大小,即使在那之后我也无法 ssh 进入它。

我已经尝试了这个post的所有建议:ERROR: (gcloud.compute.ssh) [/usr/bin/ssh] exited with return code [255]

但没有任何效果...

端口 22 已打开并且防火墙具有 default-allow-ssh...

我不能从这个实例中丢失我的数据,所以请提供任何帮助!

编辑:实例是 运行 Ubuntu 20.04

日志

Jan  5 01:48:21 my-instance GCEGuestAgent[744]: 2022-01-05T01:48:21.1503Z GCEGuestAgent Info: Adding existing user user_name to google-sudoers group.
Jan  5 01:48:21 my-instance GCEGuestAgent[744]: 2022-01-05T01:48:21.1556Z GCEGuestAgent Error non_windows_accounts.go:152: gpasswd: /etc/group.956: No space left on device#012gpasswd: cannot lock /etc/group; try again later.#012.
Jan  5 01:48:21 my-instance GCEGuestAgent[744]: 2022-01-05T01:48:21.1557Z GCEGuestAgent Info: Updating keys for user user_name.
Jan  5 01:48:22 my-instance otelopscol[703]: 2022-01-05T01:48:22.415Z#011info#011exporterhelper/queued_retry.go:215#011Exporting failed. Will retry the request after interval.#011{"kind": "exporter", "name": "googlecloud", "error": "rpc error: code = Unavailable desc = connection error: desc = \"transport: Error while dialing dial tcp: lookup monitoring.googleapis.com on [::1]:53: read udp [::1]:55573->[::1]:53: read: connection refused\"", "interval": "21.556591578s"}
Jan  5 01:48:32 my-instance otelopscol[703]: 2022-01-05T01:48:32.623Z#011info#011exporterhelper/queued_retry.go:215#011Exporting failed. Will retry the request after interval.#011{"kind": "exporter", "name": "googlecloud", "error": "[rpc error: code = Unavailable desc = connection error: desc = \"transport: Error while dialing dial tcp: lookup monitoring.googleapis.com on [::1]:53: read udp [::1]:39674->[::1]:53: read: connection refused\"; rpc error: code = Unavailable desc = connection error: desc = \"transport: Error while dialing dial tcp: lookup monitoring.googleapis.com on [::1]:53: read udp [::1]:39674->[::1]:53: read: connection refused\"; rpc error: code = Unavailable desc = connection error: desc = \"transport: Error while dialing dial tcp: lookup monitoring.googleapis.com on [::1]:53: read udp [::1]:39674->[::1]:53: read: connection refused\"]", "interval": "14.527205159s"}
Jan  5 01:48:43 my-instance otelopscol[703]: 2022-01-05T01:48:43.974Z#011info#011exporterhelper/queued_retry.go:215#011Exporting failed. Will retry the request after interval.#011{"kind": "exporter", "name": "googlecloud", "error": "rpc error: code = Unavailable desc = connection error: desc = \"transport: Error while dialing dial tcp: lookup monitoring.googleapis.com on [::1]:53: read udp [::1]:39674->[::1]:53: read: connection refused\"", "interval": "23.912476906s"}
Jan  5 01:48:46 my-instance GCEGuestAgent[744]: 2022-01-05T01:48:46.6336Z GCEGuestAgent Info: Adding existing user user_name to google-sudoers group.
Jan  5 01:48:46 my-instance GCEGuestAgent[744]: 2022-01-05T01:48:46.6352Z GCEGuestAgent Error non_windows_accounts.go:152: gpasswd: /etc/group.972: No space left on device#012gpasswd: cannot lock /etc/group; try again later.#012.
Jan  5 01:48:46 my-instance GCEGuestAgent[744]: 2022-01-05T01:48:46.6353Z GCEGuestAgent Info: Updating keys for user user_name.
Jan  5 01:48:46 my-instance dbus-daemon[561]: [system] Activating via systemd: service name='org.freedesktop.login1' unit='dbus-org.freedesktop.login1.service' requested by ':1.1' (uid=0 pid=689 comm="/usr/bin/python3 /usr/share/unattended-upgrades/un" label="unconfined")
Jan  5 01:48:46 my-instance systemd[1]: Condition check resulted in Load Kernel Module drm being skipped.
Jan  5 01:48:46 my-instance systemd[1]: systemd-logind.service: Failed to run 'start' task: No space left on device
Jan  5 01:48:46 my-instance systemd[1]: systemd-logind.service: Failed with result 'resources'.
Jan  5 01:48:46 my-instance systemd[1]: Failed to start Login Service.
Jan  5 01:48:46 my-instance systemd[1]: systemd-logind.service: Scheduled restart job, restart counter is at 1.
Jan  5 01:48:46 my-instance systemd[1]: Stopped Login Service.
Jan  5 01:48:46 my-instance systemd[1]: Condition check resulted in Load Kernel Module drm being skipped.
Jan  5 01:48:46 my-instance systemd[1]: systemd-logind.service: Failed to run 'start' task: No space left on device
Jan  5 01:48:46 my-instance systemd[1]: systemd-logind.service: Failed with result 'resources'.
Jan  5 01:48:46 my-instance systemd[1]: Failed to start Login Service.
Jan  5 01:48:46 my-instance systemd[1]: systemd-logind.service: Scheduled restart job, restart counter is at 2.
Jan  5 01:48:46 my-instance systemd[1]: Stopped Login Service.
Jan  5 01:48:46 my-instance systemd[1]: Condition check resulted in Load Kernel Module drm being skipped.
Jan  5 01:48:46 my-instance systemd[1]: systemd-logind.service: Failed to run 'start' task: No space left on device
Jan  5 01:48:46 my-instance systemd[1]: systemd-logind.service: Failed with result 'resources'.
Jan  5 01:48:46 my-instance systemd[1]: Failed to start Login Service.
Jan  5 01:48:46 my-instance systemd[1]: systemd-logind.service: Scheduled restart job, restart counter is at 3.
Jan  5 01:48:46 my-instance systemd[1]: Stopped Login Service.
Jan  5 01:48:46 my-instance systemd[1]: Condition check resulted in Load Kernel Module drm being skipped.
Jan  5 01:48:46 my-instance systemd[1]: systemd-logind.service: Failed to run 'start' task: No space left on device
Jan  5 01:48:46 my-instance systemd[1]: systemd-logind.service: Failed with result 'resources'.
Jan  5 01:48:46 my-instance systemd[1]: Failed to start Login Service.
Jan  5 01:48:46 my-instance systemd[1]: systemd-logind.service: Scheduled restart job, restart counter is at 4.
Jan  5 01:48:46 my-instance systemd[1]: Stopped Login Service.
Jan  5 01:48:46 my-instance systemd[1]: Condition check resulted in Load Kernel Module drm being skipped.
Jan  5 01:48:46 my-instance systemd[1]: systemd-logind.service: Failed to run 'start' task: No space left on device
Jan  5 01:48:46 my-instance systemd[1]: systemd-logind.service: Failed with result 'resources'.
Jan  5 01:48:46 my-instance systemd[1]: Failed to start Login Service.
Jan  5 01:48:46 my-instance systemd[1]: systemd-logind.service: Scheduled restart job, restart counter is at 5.
Jan  5 01:48:46 my-instance systemd[1]: Stopped Login Service.
Jan  5 01:48:46 my-instance systemd[1]: Condition check resulted in Load Kernel Module drm being skipped.
Jan  5 01:48:46 my-instance systemd[1]: systemd-logind.service: Start request repeated too quickly.
Jan  5 01:48:46 my-instance systemd[1]: systemd-logind.service: Failed with result 'resources'.
Jan  5 01:48:46 my-instance systemd[1]: Failed to start Login Service.

提前致谢

如果您已经尝试在控制台上调整磁盘大小但同样的错误仍然存​​在,则更改一定没有应用到 OS 级别。某些操作系统会在重新启动时自动调整分区大小,您无需使用 fdisk、resize2fs 或 xfs growfs 等实用程序。您可以尝试以下命令并将其添加到您的 startup script 以解决此问题:

对于Debian/Ubuntu:

$ sudo apt install -y cloud-utils 
$ sudo apt install -y cloud-guest-utils 
$ sudo growpart /dev/sda 1 
$ sudo resize2fs /dev/sda1

对于RedHat/Fedora/CentOS:

$ sudo dnf install -y cloud-utils-growpart
$ sudo growpart /dev/sda 1
$ sudo xfs_growfs -d / 

如果您只需要实例内部的数据,您也可以mount your disk到一个新的实例并从那里获取数据。