Linux – Redhat server broken error while loading shared libraries: libz.so.1: cannot open shared object file

linuxredhat

My Linux server seems to be broken. I can't do yum, rpm or neither can start any services

It throws out following error, everything time I try to do anything related installation.

error while loading shared libraries: libz.so.1: cannot open shared object file

I am not able to fix the issue. Need help ASAP.

Best Answer

You don't say which version of Red Hat you are using so I will assume a recent version of EL6. If you are using a different version you will need to figure out exactly what the filenames are yourself.

To fix this you need to put a copy of libz.so.1.2.3 into /lib64 and soft link libz.so.1 to it.

As you can't use the package system you are going to have to try to do it manually and even then it may be too difficult to solve.

From a similarly configured system get a copy of the file that /lib64/ libz.so.1 points to

ls -l /lib64/libz*
lrwxrwxrwx. 1 root root    13 Nov  9 12:21 /lib64/libz.so.1 -> libz.so.1.2.3
-rwxr-xr-x. 1 root root 91096 Nov  9 12:21 /lib64/libz.so.1.2.3

in this case it is /lib64/libz.so.1.2.3 so that's the name of the file you need to get onto your system.

Once you have a copy of libz.so.1.2.3 on the system

cp libz.so.1.2.3 /lib64
cd /lib64
ln -s libz.so.1.2.3 libz.so.1

Now you should be back in business.


Getting the library back onto the system is the hard thing here you can

  • Boot the installation media and use Troubleshooting to get to it.