不小心移動了 /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。

相關內容