ldd

I recently had a client that went to backup a specific account using the cpanel backup script ‘pkgacct username’ located in the /scripts folder. Whenever he tried to use this script, the backup would fail. I found the error was not related to the cpanel script itself but to the gzip command itself. I needed to re-install gzip, which when complated, repaired the issue. In order to track this issue down, I used the ldd command

The ldd command is one that is rarely used by most and can be very helpful in deducing specific install error related to shared library dependencies. The actual ldd command is used for printing shared library dependencies like so;


root@host [~]# ldd /bin/tar
libc.so.6 => /lib/tls/libc.so.6 (0xb7eae000)
/lib/ld-linux.so.2 (0xb7fe8000)

root@host [~]# ldd /bin/gzip
libc.so.6 => /lib/tls/libc.so.6 (0xb7eae000)
/lib/ld-linux.so.2 (0xb7fe8000)

We can see that the tar/gzip commands uses the specified files in order to function correctly. If those files are corrupted or missing, then the pkgacct script will fail.

Using the ldd, gdb and strace commands helped me find and quickly solve this specific error.

Oh, to repair this error, I simply used RPM to uninstall and re-install the gzip package. I downloaded the rpm from CentOS;

http://mirror.centos.org/centos-5/5.4/os/x86_64/CentOS/gzip-1.3.5-10.el5.centos.x86_64.rpm

rpm -qpR {.rpm-file} Find out what dependencies a rpm file has

rpm -ev {package} Erase/remove/ an installed package

rpm -ev –nodeps {package} Erase/remove/ an installed package without checking for dependencies

rpm -ivh {rpm-file} Install the package

g33kadmin

I am a g33k, Linux blogger, developer, student and Tech Writer for Liquidweb.com/kb. My passion for all things tech drives my hunt for all the coolz. I often need a vacation after I get back from vacation....

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.