2021-05-12 14:32:11
刪除Linux的依賴庫並進入救援模式恢復
2020-06-16 16:34:04
刪除Linux的依賴庫並進入救援模式恢復
模擬一下依賴庫檔案被刪,並進入救援模式恢復
系統:CentOS7
一、刪除mv的依賴庫檔案
刪除/lib64/libc.so.6
[root@centos7 Packages]# which mv
alias mv='mv -i'
/usr/bin/mv
[root@centos7 Packages]# ldd /usr/bin/mv
linux-vdso.so.1 => (0x00007ffd51946000)
libselinux.so.1 => /lib64/libselinux.so.1 (0x00007f40c2bd9000)
libacl.so.1 => /lib64/libacl.so.1 (0x00007f40c29d0000)
libattr.so.1 => /lib64/libattr.so.1 (0x00007f40c27cb000)
libc.so.6 => /lib64/libc.so.6 (0x00007f40c23fe000)
libpcre.so.1 => /lib64/libpcre.so.1 (0x00007f40c219c000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007f40c1f98000)
/lib64/ld-linux-x86-64.so.2 (0x00007f40c2e00000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f40c1d7c000)
[root@centos7 Packages]# rm -f /lib64/libc.so.6
刪除後mv等很多命令變無法使用
[root@centos7 Packages]# mv /etc/fstab .
mv: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
[root@centos7 Packages]# cp /etc/fstab .
cp: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
[root@centos7 Packages]# poweroff
poweroff: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
二、強制關機,從光碟引導
0、進BIOS從光碟引導
1、Troubleshooting
2、Recure a CentOS system(救援模式)
3、輸入1,回車
4、提示系統被掛載到了/mnt/sysimage,按下回車
5、把光碟的庫檔案複製過來
使用cp複製庫檔案到/mnt/sysimage/lib64/;千萬別mv,否則光碟的系統又壞了
三、重新啟動後的系統已經正常使用
[root@centos7 ~]# cp /etc/fstab . -a
cp: overwrite ‘./fstab’? y
[root@centos7 ~]# mv fstab /tmp
相關文章