CentOS 5.2 - 64 bits - error while loading shared libraries : libresolv.so.2 : cannot open shared object file

By BXTra |

My server was running great for about a month without reboot. Yesterday, I just thought about what many people said that if a server is running fine, don't try to restart it. If you do, there is a chance that a server won't start back up normally. No one explain why but then, I thought about it and for some reason, I wanted to try to restart it that night. I didn't think I will run into any problem but I was wrong.

After restarted, my server didn't have network connection at all. I can only use my server in front of it. I really had no idea what cause it. I had to try command by command and I found that when I try to restart network with below command:

SSH

/etc/init.d/network restart

I got error message below :

arping : error while loading shared libraries: libresolv.so.2 : cannot open shared object file. No such file or directory
Error some other host already use address xxx.xxx.xxx.xxx.

That caused my eth0 to fail to start. At first, I looked for the method to fix the error that some other host already used my IP address. That took me many hours to search and follow many instructions. That didn't help at all.

I then, found that I couldn't use ping, yum or many command with the error of "libresolv.so.2". Now, I've changed my mind and search for "libresolv.so.2". It's a file under /lib64 I found that it's one library in glic It's located under lib64 directory. I thought I can try to reinstall glibc but no, I couldn't. I mounted my DVD and try to yum install from it but it said it's installed.

Now, I just thought that if I can get that "libresolv.so.2", that would be it. So, I downloaded it. "libresolv.so.2" is not really a file, it's a link to another file which is "libresolv-2.5.so". So, I just extracted that file from "glibc.rpm" and replace that file with a new one. (Renamed old one and copied a new one into it.) Try to restart network. Now, I got an error below :

arping : error while loading shared libraries: libc.so.6 : cannot open shared object file. No such file or directory
Error some other host already use address xxx.xxx.xxx.xxx.

"libc.so.6" is a link to a file "libc-2.5.so". So, I started by rename "libc-2.5.so" to something else. NOW... this was a big mess. Once I've renamed it, I couldn't use most command like cp, rm, mkdir, ls, yum or anything else. I realized that it's an important file. So, what else can I do? I immediately thought about installation DVD. It may have some recovering mode. So, I tried and found that there is a rescue mode by typing linux rescue.

Just get into that mode. Copy whatever files that you wan to replace the old one. Restart it and that's it. My server was came back to work as normal. Well, everything seems to be very easy for a long story I've wrote. But I think I've said before that I'm new to a linux world. Most of the time, I did many things on CentOS by reading others' instruction. So, I didn't even know if there is a rescue mode in the installation DVD.

Sir Thanks for the info, i just wondering how did you fixed that? Do you have step by step scenario? I also experience the same concerns.... Kindly let us know.. thanks again for your shared knowledge

Basically, before enter to rescue mode on DVD, you should note any files that has problem. (In my case, it's libresolv-2.5.so and libc-2.5.so.) Then, enter to Linux Rescue Mode on DVD. When you do that, your computer is running a linux on DVD, not from harddrive. So, you have 2 copies of Linux : 1st copy - Linux rescue mode on DVD. (Which contain original files from provider.) 2nd copy - Linux on harddrive. (Which has some problem with library thing.) Now, since you're running on Linux Rescue Mode on DVD, you can just copy any files that have problem from Linux Rescue Mode on DVD to Linux on harddrive. For that problem, I had to stay in a server room for like... 7 - 8 hours straight. No break. Just to try to bring my server back to normal :( So, I hope what I've written can help anyone to fix it faster than me :)

CentOS 5.5 2.6.18-194.32.1.el5PAE #1 SMP Trying to ping would bring this error, ping: error while loading shared libraries: libresolv.so.2: cannot open shared object file: No such file or directory So I searched for what glibc packages where installed, `rpm -qa | grep glibc` glibc-common-2.5-49.el5_5.7 glibc-2.5-49.el5_5.7 Luckily my yum was still working fine, `yum reinstall glibc*` reinstalled the to glibc packages and resolved the issue. All is good now.

Sanjay Chakraborty

11 years 8 months ago

If you selinux config changed from SELINUX=perm issive to "SELINUX=enforcing" then you need to reboot. Otherwise this kind of errors are common.

Add new comment

  • No HTML tags allowed.
  • Web page addresses and email addresses turn into links automatically.
  • Lines and paragraphs break automatically.
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.