不小心移动了 /usr/lib64 如何恢复

不小心移动了 /usr/lib64 如何恢复

我试图释放空间,却毫无头绪地将 /usr/lib64/ 移动到“/srv/maraba_ssd_scratch/apelin/root_files/usr_lib64”。我要做的下一件事是在 usr 中为 lib64 创建一个符号链接以指向 /srv/maraba_ssd_scratch/apelin/root_files/usr_lib64 但很快就发现了 ELF 的问题。

我最大的问题是我使用 sudo 来完成所有这些操作。我根据其他帖子弄清楚了如何发出命令,并且可以执行以下操作:

$ LD_LIBRARY_PATH=/srv/maraba_ssd_scratch/apelin/root_files/usr_lib64 /srv/maraba_ssd_scratch/apelin/root_files/usr_lib64/ld-linux-x86-64.so.2 /usr/bin/echo a
a
bash: /usr/bin/basename: /lib64/ld-linux-x86-64.so.2: bad ELF interpreter: No such file or directory

但是要恢复 /usr/lib64 我需要 root 权限。我尝试了 sudo 但失败了:

LD_LIBRARY_PATH=/srv/maraba_ssd_scratch/apelin/root_files/usr_lib64 /srv/maraba_ssd_scratch/apelin/root_files/usr_lib64/ld-linux-x86-64.so.2 /usr/bin/sudo /usr/bin/ln -s /srv/maraba_ssd_scratch/apelin/root_files/usr_lib64 lib64
/usr/bin/sudo: error while loading shared libraries: /usr/bin/sudo: cannot open shared object file: Permission denied
bash: /usr/bin/basename: /lib64/ld-linux-x86-64.so.2: bad ELF interpreter: No such file or directory

当我尝试 su 时,我也收到错误:

$ LD_LIBRARY_PATH=/srv/maraba_ssd_scratch/apelin/root_files/usr_lib64 /srv/maraba_ssd_scratch/apelin/root_files/usr_lib64/ld-linux-x86-64.so.2 /usr/bin/su root
su: Module is unknown
bash: /usr/bin/basename: /lib64/ld-linux-x86-64.so.2: bad ELF interpreter: No such file or directory

我相信 su 错误可能与我的 /etc/pam.d/su 文件有关:

#%PAM-1.0
auth        sufficient  pam_rootok.so
# Uncomment the following line to implicitly trust users in the "wheel" group.
#auth       sufficient  pam_wheel.so trust use_uid
# Uncomment the following line to require a user to be in the "wheel" group.
#auth       required    pam_wheel.so use_uid
auth        substack    system-auth
auth        include     postlogin
account     sufficient  pam_succeed_if.so uid = 0 use_uid quiet
account     include     system-auth
password    include     system-auth
session     include     system-auth
session     include     postlogin
session     optional    pam_xauth.so
bash: /usr/bin/basename: /lib64/ld-linux-x86-64.so.2: bad ELF interpreter: No such file or directory

pam_rootok.so 位于移动的 lib64 目录中。

除了使用实时磁盘启动之外,还有其他人有什么想法吗?我没有busybox。

PS 应该提到我通过 vncserver 有 GUI。有没有办法从 GUI 调用 root 命令? CentOS 7、Gnome2。

相关内容