首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >不能SSH进入谷歌云引擎。引导错误

不能SSH进入谷歌云引擎。引导错误
EN

Stack Overflow用户
提问于 2021-10-16 16:47:50
回答 1查看 392关注 0票数 0

我无法深入了解我的情况。我尝试了以下方法

  • 创建了新的ssh密钥对并添加了该项目,但这没有帮助。我在同一个项目中创建了一个全新的实例,我可以轻松地使用ssh。因此,我不认为ssh键是problem.
  • "Block项目范围内的SSH键“没有被选中,
  • 创建了一个机器映像并产生了一个新的实例,这与使用”启动脚本“的
  • 启用串行控制台有相同的问题,但这也没有帮助。它根本不接受密码。

代码语言:javascript
复制
    #! /bin/bash
    adduser serial1
    echo serial1:desperate-attempt | chpasswd
    usermod -aG google-sudoers serial1

  • 我不认为这是磁盘空间问题。实例有10 GB的磁盘。我只写一个日志文件,最后我检查了它是50 MB。我也没有在控制台日志中看到磁盘空间错误--

我在“串行端口1(控制台)”日志中确实看到了这些错误。

代码语言:javascript
复制
Oct 16 16:29:01 instance-1 ntpd[668]: bind(21) AF_INET6 fe80::4001:aff:fe8e:2%2#123 flags 0x11 failed: Cannot assign requested address
Oct 16 16:29:01 instance-1 ntpd[668]: unable to create socket on eth0 (5) for fe80::4001:aff:fe8e:2%2#123
Oct 16 16:29:01 instance-1 ntpd[668]: failed to init interface for address fe80::4001:aff:fe8e:2%2
Oct 16 16:29:01 instance-1 ntpd[668]: Listening on routing socket on fd #21 for interface updates
Oct 16 16:29:02 instance-1 ntpd[668]: bind(24) AF_INET6 fe80::4001:aff:fe8e:2%2#123 flags 0x11 failed: Cannot assign requested address
Oct 16 16:29:02 instance-1 ntpd[668]: unable to create socket on eth0 (6) for fe80::4001:aff:fe8e:2%2#123
Oct 16 16:29:02 instance-1 ntpd[668]: failed to init interface for address fe80::4001:aff:fe8e:2%2
Oct 16 16:29:02 instance-1 google_instance_setup[663]: Traceback (most recent call last):
Oct 16 16:29:02 instance-1 google_instance_setup[663]:   File "/usr/bin/google_instance_setup", line 6, in <module>
Oct 16 16:29:02 instance-1 google_instance_setup[663]:     from pkg_resources import load_entry_point
Oct 16 16:29:02 instance-1 google_instance_setup[663]:   File "/usr/local/lib/python3.9/site-packages/pkg_resources/__init__.py", line 3257, in <module>
Oct 16 16:29:02 instance-1 google_instance_setup[663]:     def _initialize_master_working_set():
Oct 16 16:29:02 instance-1 google_instance_setup[663]:   File "/usr/local/lib/python3.9/site-packages/pkg_resources/__init__.py", line 3240, in _call_aside
Oct 16 16:29:02 instance-1 google_instance_setup[663]:     f(*args, **kwargs)
Oct 16 16:29:02 instance-1 google_instance_setup[663]:   File "/usr/local/lib/python3.9/site-packages/pkg_resources/__init__.py", line 3269, in _initialize_master_working_set
Oct 16 16:29:02 instance-1 google_instance_setup[663]:     working_set = WorkingSet._build_master()
Oct 16 16:29:02 instance-1 google_instance_setup[663]:   File "/usr/local/lib/python3.9/site-packages/pkg_resources/__init__.py", line 582, in _build_master
Oct 16 16:29:02 instance-1 google_instance_setup[663]:     ws.require(__requires__)
Oct 16 16:29:02 instance-1 google_instance_setup[663]:   File "/usr/local/lib/python3.9/site-packages/pkg_resources/__init__.py", line 899, in require
Oct 16 16:29:02 instance-1 google_instance_setup[663]:     needed = self.resolve(parse_requirements(requirements))
Oct 16 16:29:02 instance-1 google_instance_setup[663]:   File "/usr/local/lib/python3.9/site-packages/pkg_resources/__init__.py", line 785, in resolve
Oct 16 16:29:02 instance-1 google_instance_setup[663]:     raise DistributionNotFound(req, requirers)
Oct 16 16:29:02 instance-1 google_instance_setup[663]: pkg_resources.DistributionNotFound: The 'google-compute-engine==2.8.13' distribution was not found and is required by the application
[[0;1;31mFAILED[0m] Failed to start Google Compute Engine Instance Setup.
代码语言:javascript
复制
Oct 16 16:29:02 instance-1 google_instance_setup[663]: pkg_resources.DistributionNotFound: The 'google-compute-engine==2.8.13' distribution was not found and is required by the application
[[0;1;31mFAILED[0m] Failed to start Google Compute Engine Instance Setup.
See 'systemctl status google-instance-setup.service' for details.
         Starting NSS cache refresh...
Oct 16 16:29:02 instance-1 systemd[1]: google-instance-setup.service: Main process exited, code=exited, status=1/FAILURE
Oct 16 16:29:02 instance-1 systemd[1]: Failed to start Google Compute Engine Instance Setup.
Oct 16 16:29:02 instance-1 systemd[1]: google-instance-setup.service: Unit entered failed state.
Oct 16 16:29:02 instance-1 systemd[1]: google-instance-setup.service: Failed with result 'exit-code'.

对google_accounts_daemon、google_metadata_script_runner、google_network_daemon、google_*、.

听起来有些包裹不是最新的。但是,如何在不登录实例的情况下安装呢?有什么好办法来纠正这个错误吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-10-17 16:17:05

以您为例,Google包或Python安装或两者都已损坏。此问题使您无法登录。

我建议您创建一个新实例,并将持久性磁盘从损坏的实例移动到新实例。

步骤1:

在同一区域中创建一个新实例。一个微观的例子就行了。

步骤2:

打开Cloud提示符(如果设置了gcloud,它也可以从桌面上运行)。执行这个命令。将名称替换为实例名称(已损坏的系统),将磁盘替换为引导磁盘名称,并将区域替换为系统所在的区域:

代码语言:javascript
复制
gcloud compute instances detach-disk NAME --disk=DISK --zone=ZONE

确保前面的命令没有报告错误。

步骤3:

将此磁盘附加到您创建的新实例。

在附加第二个磁盘之前,确保新的VM实例正在运行。有时,如果多个磁盘是可引导的,则实例可能会混淆要从哪个磁盘上引导。

转到Compute -> VM实例。单击实例。点击编辑。在“其他磁盘”下单击“添加项”。对于名称,输入/选择从已损坏的实例中分离出来的磁盘。单击保存。

步骤4:

将SSH与两个磁盘连接到新实例中。

步骤5:

请仔细遵循这些步骤。将第二个磁盘作为子目录挂载到根文件系统。

  • 成为超级用户。执行sudo -s
  • ,执行命令df -h。确保/dev/sdb1 1不是mounted.
  • Create,是装入点的目录:mkdir /mnt/oldsystem
  • Mount第二个磁盘:挂载/dev/sdb1 1 /mnt/oldsystem

您现在可以在路径/mnt/oldsystem.上访问旧文件系统中的文件。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/69597655

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档