我有一个 Ubuntu 20.04.6 LTS 服务器。
- 它突然开始拒绝 ssh 连接,并引用
/bin/bash: No such file or directory
。 - 重启机器失败,出现内核崩溃,摘录如下:
Begin: Running /scripts/init-bottom ... mkdir: can't create directory '/root/lib/modules': Read-only file system
[...]
run-init: can't execute '/sbin/init', No such file or directory
[...]
run-init, can't execute '/etc/init': Permission denied
[...]
Kernel panic not syncing: Attempted to kill Init! exitcode-Ox00000100`
- 从实时 USB 启动,并查看根磁盘内部。
/sbin/init
没有丢失,但它是一个软链接,它/lib/systemd/systemd
指向的丢失。这让我发现是/lib
一个只包含x86_64-linux-gnu
文件夹的目录,而在其他机器上,/lib
通常是指向的软链接。usr/lib
- 备份
/lib
并将其替换为软链接后usr/lib
,我现在可以重新启动并通过 ssh 进入机器了! - 但是,当尝试运行
sudo apt update
并sudo apt upgrade
确保我的软件包有序时,我现在面临这些导致 apt 失败的错误:
/usr/bin/python3: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.35' not found (required by /usr/bin/python3)
/usr/bin/python3: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by /usr/bin/python3)
/usr/bin/python3: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found (required by /usr/bin/python3)
/usr/bin/python3: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by /usr/bin/python3)
在这种情况下,除了重新安装 Ubuntu,我该如何恢复系统?此外,是什么原因导致了这种情况?
编辑1:
x86_64-linux-gnu
这是我最初找到的的内容/lib
。我认为它包含的文件数量没有预期的多
$ ls [...]/lib/x86_64-linux-gnu/
libexpat.so.1 libexpat.so.1.8.7 libhistory.so.8 libhistory.so.8.1 libreadline.so.8 libreadline.so.8.1
$ diff [...]/lib/x86_64-linux-gnu /lib/x86_64-linux-gnu | grep -v "Only in /lib/x86_64-linux-gnu"
Binary files [...]/lib/x86_64-linux-gnu/libexpat.so.1 and /lib/x86_64-linux-gnu/libexpat.so.1 differ
Only in [...]/lib/x86_64-linux-gnu: libexpat.so.1.8.7
Binary files [...]/lib/x86_64-linux-gnu/libhistory.so.8 and /lib/x86_64-linux-gnu/libhistory.so.8 differ
Only in [...]/lib/x86_64-linux-gnu: libhistory.so.8.1
Binary files [...]/lib/x86_64-linux-gnu/libreadline.so.8 and /lib/x86_64-linux-gnu/libreadline.so.8 differ
Only in [...]/lib/x86_64-linux-gnu: libreadline.so.8.1
此外,当我通过 SSH 登录时也会出现这些警告:
/usr/bin/xauth: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by /usr/bin/xauth)
/usr/bin/xauth: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by /usr/bin/xauth)
/usr/bin/xauth: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by /lib/x86_64-linux-gnu/libX11.so.6)
/usr/bin/xauth: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by /lib/x86_64-linux-gnu/libX11.so.6)
/usr/bin/xauth: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by /lib/x86_64-linux-gnu/libXau.so.6)
/usr/bin/xauth: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by /lib/x86_64-linux-gnu/libbsd.so.0)
/usr/bin/xauth: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by /lib/x86_64-linux-gnu/libmd.so.0)