Accidentally deleted symlink libc.so.6 in CentOS 6.4. How to get sudo privilege to re-create it?
- by Eric
I accidentally deleted the symbol link /lib64/libc.so.6 - /lib64/libc-2.12.so with
$ sudo rm libc.so.6
Then I can not use anything including ls command. The error appears for any command I type
ls: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
I've tried
$ export LD_PRELOAD=/lib64/libc-2.12.so
After this I can use ls and ln ..., but still can not use sudo ln ..., sudo -E ln ..., sudo su or even su. I always get this err
sudo: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
or
su: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
It seems LD_PRELOAD works only for the current shell session of my account, but not for a new account like root or a new session.
It's a remote server so I can not use a live CD. I now have a ssh bash session alive but can not establish new ones. I have sudo privilege, but don't have root password.
So currently my problem is I need to run sudo sln -s libc-2.12.so libc.so.6 to re-create the symlink libc.so.6, but I can not run sudo without libc.so.6.
How can I fix it? Thanks~