4

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.

  • 1
    You could extract the contents of the newer RPM using cpio, then put them in the directory with your java app or in a directory and reference it using $LD_LIBRARY_PATH. – slm Jun 27 '14 at 15:49
  • Are these RPM's in your configured repo's? If so you can actually just do a yum localinstall on the RPM you need and it should depsolve the rest for you. – Bratchley Jun 27 '14 at 20:19
1

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.

  • If you attempt to modify the source RPMs be sure to change the names of the packages otherwise they'll potentially collide with the already existing ones. – slm Jun 27 '14 at 22:39
  • 1
    yes I said that in my answer, to avoid the package being accidentaly upgraded by yum etc, there's nothing in rpm istself to prevent two packages with same name different versions from being installed simultanously, however typically only the kernel is installed like that, so yes, I usually too change the name if the pakcage i install is provided by the OS also, it can also help make it more clear that this package is custom – Petter H Jun 28 '14 at 8:49
  • FWIW when we do this officially in Fedora, it's normal to name the package itself something like libpcap14 (so, libpcap14-1.4.0-1.x86_64.rpm). – mattdm Oct 10 '15 at 3:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.