I wanted to run the current version of the ClamAV antivirus software with a PLoP Linux boot CD. PLoP Linux provides a LiveCD that can be used to boot a Windows system and scan it for viruses. This can be useful when a Windows system is badly infected and you wish to avoid even booting into Windows to check the system. The version of PLoP Linux I downloaded from the developer's website at http://www.plop.at/page_en_0.html included ClamAV, but it was the 0.86.2 version rather than the current 0.87.1 version. I put the most current version of clamscan on a Zip disk, which I mounted after booting from the PLoP Linux CD, but when I tried to run the current version I got the message "error while loading shared libraries: libbz2.s0.1: cannot open shared object file: No such file or directory."
I used the ldd
command on a Linux system where I had clamav
working to find out what
shared libraries it needed.
# ldd `which clamscan`
libclamav.so.1 => /usr/lib/libclamav.so.1 (0x40022000)
libz.so.1 => /usr/lib/libz.so.1 (0x4006e000)
libbz2.so.1 => /usr/lib/libbz2.so.1 (0x4007c000)
libgmp.so.3 => /usr/lib/libgmp.so.3 (0x4008b000)
libpthread.so.0 => /lib/tls/libpthread.so.0 (0x400b8000)
libnsl.so.1 => /lib/libnsl.so.1 (0x400c6000)
libc.so.6 => /lib/tls/libc.so.6 (0x42000000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
I then copied all of those files to the same directory on the Zip disk where I had the clamscan program. But I got the same error message when I ran clamscan. So clamscan wasn't able to find the libraries it needed in the current directory.
After reading the article
CLI Magic: ldconfig and friends by Joe Barr, I realized I need only
add the directory where I had stored the libraries to /etc/ld.so.conf file.
So I added /mnt/zip
to the end of /etc/ld.so.conf
.
/lib
/user/kerberos/lib
/usr/lib
/opt/multimedia/lib
/media/pluspacks/antivir
/mnt/zip
I then issued the
ldconfig
command. That allowed the newer
version of clamscan I had on the Zip disk to look in the /mnt/zip
directory while searching for the shared libraries it needed, when it
couldn't find them in the other directories listed as locations for shared
library files. I was then able to use /mnt/zip/clamscan
to
run the newer version on the Zip disk rather than the older version on the CD.
If you don't want to add a directory permanently to the list of directories
searched for libraries, then you can issue the ldconfig
command
followed by the directory, e.g. ldconfig /mnt/zip
would specify
that the /mnt/zip
directory be searched for libraries as well,
but only until the system is rebooted.
References:
-
CLI Magic: ldconfig and friends
By Joe Barr May 16, 2005 -
What is ldconfig used for?
By Nathan Wallace, Kim Shrier
August 3, 1999 -
Shared Libraries
By David A. Wheeler
April 11, 2003 -
Building and Using Static and Shared "C" Libraries
By Guy Keren
2002 -
LDD Library Dependencies
By Karsten M. Self
April 8, 2005 -
Automatic Dependencies
By Red Hat, Inc.
2000