/lib 通常是一个软链接,但被一个几乎为空的目录所取代

/lib 通常是一个软链接,但被一个几乎为空的目录所取代

我有一个 Ubuntu 20.04.6 LTS 服务器。

  1. 它突然开始拒绝 ssh 连接,并引用/bin/bash: No such file or directory
  2. 重启机器失败,出现内核崩溃,摘录如下:
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`
  1. 从实时 USB 启动,并查看根磁盘内部。/sbin/init没有丢失,但它是一个软链接,它/lib/systemd/systemd指向的丢失。这让我发现是/lib一个只包含x86_64-linux-gnu文件夹的目录,而在其他机器上,/lib通常是指向的软链接。usr/lib
  2. 备份/lib并将其替换为软链接后usr/lib,我现在可以重新启动并通过 ssh 进入机器了!
  3. 但是,当尝试运行sudo apt updatesudo 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)

相关内容