Delete Linux dependency libraries and enter rescue mode recovery

Simulate the dependency library file being deleted and restored in rescue mode

System: CentOS7

1. Delete mv dependency library files

Delete/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 

After deletion, many commands such as mv cannot be used.

[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

2. Forced shutdown, boot from CD-ROM

0. Boot into BIOS from CD

1,Troubleshooting

2. Recure a CentOS system (rescue mode)

3. Input 1, return

4. The prompt system is mounted on / mnt/sysimage and press Enter

5. Copy the library files of CD-ROM

Use cp to copy library files to / mnt/sysimage/lib64/; don't mv, otherwise the CD-ROM system will break down again

3. The restarted system has been in normal use.

[root@centos7 ~]# cp /etc/fstab . -a
cp: overwrite './fstab'? y
[root@centos7 ~]# mv fstab /tmp

Tags: Operation & Maintenance Linux CentOS

Posted on Fri, 11 Oct 2019 10:39:52 -0700 by nolos