0

I am attempting to install some packages using YUM. The command I am using is:

sudo yum repo-pkgs [my repo] install

This produces the following result:

 Error: Package: [package name] ([my repo])
       Requires: jdk >= 2000:1.8.0
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

This error is confounding because I already have a JDK installed in /user/java/jdk1.8.0_25, which should be a sufficiently new version according to the error message.

Is there something I need to do to get YUM to recognize the JDK?

Any suggestions are welcome, thanks.

  • How did you install the JDK in /usr/java/jdk1.8.0_25? – John Jun 10 '15 at 14:37
  • I'm not sure...I am using a VM that had the JDK already installed there. Do you think I should try uninstalling it and then reinstalling a new JDK RPM package from Oracle? – scottyseus Jun 10 '15 at 14:40
  • 1
    Not necessarily. What is the output of which java? If it shows a valid binary in /usr/jva/jdk1.8.0_25, what is the output of rpm -qf ${binary} where ${binary} is the output of the which command? – John Jun 10 '15 at 14:45
  • Alternately, what does rpm -qa | grep jdk show? – John Jun 10 '15 at 14:46
  • Thanks for the troubleshooting help. which java returns /usr/bin/java rather than a location within the /usr/java/jdk1.8.0_25 directory. rpm -qf /usr/bin/java prints that java is not owned by any package. rpm -qa | grep jdk prints jdk1.8.0_25-1.8.0_25-fcs.x86_64 – scottyseus Jun 10 '15 at 14:49
0

As @Arthur stated, the problem is the disconnect between what's on the system and what's in the RPMDB. While the RPMDB does indeed have a JDK that it knows is installed, that JDK may not satisfy the package dependencies of the package you're attempting to install - in fact it definitely does not or you wouldn't be getting the particular error message. Where you go from here will depend on how "clean" you want the solution to be (versus "quick").

You can, as @Arthur suggested, create a dummy package. This package should depend on jdk, and should provide jdk 1.8.0 with an epoch of 2000 or greater. It should have no payload - not even symlinks, which is where @Arthur's suggestion breaks down.

You can also install your package with --nodeps, which is the quick-and-dirty solution, but that may lead to dependency issues down the road if you have additional packages that depend on the current one or if you attempt to update it.

Finally, as our discussion ended up finding out, you can change the Requires: line in the specfile, since you're the one building this package and putting it in your repo.

  • To answer your last sentence, I would prefer a 'clean' solution ;) – scottyseus Jun 10 '15 at 14:59
  • Then I would strongly recommend building a dummy package with only a Provides: and no payload. That is the cleanest solution I can think of at the moment. – John Jun 10 '15 at 15:02
  • Great, thanks. I am new to RPM package creation. Should Provides be preceded by jdk1.8.0_25? – scottyseus Jun 10 '15 at 15:06
  • No. I would start with Provides: jdk = 2000:1.8.0 in the specfile, though I may not have that syntax completely correct. – John Jun 10 '15 at 15:09
  • 1
    Alternately, since it looks like the package you're trying to isntall is coming from your repo, you can change the Requires line in that specfile so that it doesn't have the 2000 epoch value, which should then let it install without the shiv package. Sorry I didn't think of that earlier. – John Jun 10 '15 at 15:10
0

It's true that you have a JDK, but it is not in the RPM database, which is used by yum and other similar automatic package managers to know what packages are installed and get there respective versions.

The best solution may be running sudo yum install jdk so you can get a version with yum and rpm.

You can also consider following its suggestion to add the --skip-broken option, however it shares the problem with the second point in P.S.

Running the rpm -Va stuff may help RPM find missing packages and files. If you believe that you installed Java with RPM, try it.

P.S.: At first I considered creating a dummy package like what dpkg users may do, however:

  1. It's quite complicated to make a package under RPM, since you will have to write a long spec. RPM also uses the file list to look for library dependencies, so you have to give it quite a long file list.
    Possible workaround: Automatic %files generation with find and a lot of shell.
  2. Even though you completed making a dummy package and installed it, your package is quite likely to be unable to find your java, if it uses some hard-encoded logic to navigate to the Java installed by the jdk package. (Most packagers don't use a weird directory like /user, and if you are unlucky enough to find a package written by a guy who doesn't know any java_home stuff…)
    Possible workaround: symlinking.

Update:

It seems that the package name of your JDK is jdk1.8.0_25. Since you already have one installed with RPM, it would be much easier and cleaner to create a dummy package, although it is still somehow a dirty hack.

Just write a spec for the package jdk of the reqired version, and make it depend on jdk1.8.0_25. Then add some symlinks to the %files block so your program can find it. Finally, really create the symlinks and do rpmbuild -bb dummy_jdk.spec.

  • It's actually quite simple to make a dummy RPM package, and point two doesn't come in to this matter since it's an RPM dependency, not a file dependency. – John Jun 10 '15 at 14:52
  • sudo yum install jdk simply prints No package jdk available. I had already tried that before. Additionally, rpm -Va seemed to help clean up things, but when I tried the install again it still failed with the same error. --skip-broken is what I have been using until now, but at this point I need that package. – scottyseus Jun 10 '15 at 14:56
  • @John Yes, you are right. However I'm not sure if scott is going to see some file deps afterwards… Anyway, with that jdk1.8.0_25 package, the dummy one can be much cleaner. – Arthur2e5 Jun 10 '15 at 14:58

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.