Centos – Make RPM Satisfy Dependency Requirements of Other Installed Packages

centosdependencieslinuxrpm

So, I am installing a java app that I wrote which uses jnetpcap. This requires libpcap of at least v1.0.0. My CentOS 5.8 only has libpcap 0.9.4, which is required by other installed packages. I've got the RPM for libpcap 1.4.0 built but when I try to install it, I get the following:

# rpm -Uvh /root/rpmbuild/RPMS/i386/libpcap-1.4.0-1.i386.rpm
error: Failed dependencies:
        libpcap.so.0.9.4 is needed by (installed) ppp-2.4.4-2.el5.i386
        libpcap.so.0.9.4 is needed by (installed) isdn4k-utils-3.2-56.el5.i386
        libpcap >= 14:0.8.3-6 is needed by (installed) ppp-2.4.4-2.el5.i386

and checking the dependencies of one of those:

# rpm -qR ppp-2.4.4-2.el5.i386
...
libpcap >= 14:0.8.3-6
libpcap.so.0.9.4

Updating the OS is a non-starter, plus, it's a closed system, never net connected, so it matters little. Now, I may be able to remove the packages which are stalling things, but, assuming I cannot, how can I force the install of this package, such that it will satisfy the older dependency requirements? ie: have it "provide" libpcap 0.9.4 soas to satisfy the requirements of already installed software.

Best Answer

I would recommend you alter the source rpm of this file; edit the path in which the files will be installed to, so as to not create conflicts between the files you are about to install, and those provided by libpcap.so.0.9.4 (no two rpm:s may be installed which provide the same file on same path both).

Or remove from the source rpm those files which will conflict with what you have got installed, it could be: /usr/lib/libpcap.so.0 and possibly /usr/share/man/man3/pcap.3.gz. (one is a symlink and the other a man page) from your src rpm:s .spec file, and rpmbuild it.

Then you can install (not upgrade) /root/rpmbuild/RPMS/i386/libpcap-1.4.0-1.i386.rpm along side with libpcap-0.9.4 so that the versions may peacefully coexist on your system.

If you are using yum, then you may need to edit your /etc/yum.conf to add libpcap to your list of installonlypkgs, so that yum will not replace your older version of libpcap with the one you just created (man 5 yum.conf). (if you use yum instead of plain rpm, then it can keep track of all the transactions for you with yum history. It is very powerful). You could also change the name in the .spec file in the source rpm to something like libpcap14, that's what I usually do.

Then add the path on where you installed the packages to $LD_LIBRARY_PATH, in the script/command which fires up your program and it should work. (or LD_PRELOAD your newer version of libpcap instead).

You could do what slm suggested too, it is by far the quickest way to goal: rpm2cpio /root/rpmbuild/RPMS/i386/libpcap-1.4.0-1.i386.rpm > libpcap-1.4.0-1.i386.cpio and then in a separate folder you extract the archive and use the files as described above. However, rpm is the way CentOS ships programs and I think it messy and hard to maintain in the long run.

Another cause of action can be for you to re-build all that depends on libpcap v0.9.4 to v1.0.0 and upgrade those. Normally, it would imply problems for future updates, but as you appear to be using CentOS 5, you need not worry since it is EOL.

A final option for you to consider is yum remove libpcap, see how many packages it wants to remove (yum won't actually remove anything until you hit the Y button and press enter), since you may be able to remove these packages and use yum, if it turns out you couldn't after all, you can roll back with yum history undo command (I don't remember in what version of yum this was implemented in yum, so check first if this sub command is available to you). Also, make sure that you got your repositories pointing to the repos which has these files available.

Related Question