file is not owned by any package ? Ahh.. Whats wrong ?

One of my friend was trying to see , which rpm/package provide /usr/bin/java in his system by below method..

[cc]

[root@ ~]# which java
/usr/bin/java
[root@ ~]# rpm -qf /usr/bin/java
file /usr/bin/java is not owned by any package
[root@ ~]#

[/cc]

Its a common practice that checking a particular file/binary is provided by which rpm using rpm command as shown above.

But what will you do if you see the message like “is not owned by package” ? .. In such situations ,you have to look into something called “alternatives” .

Some of the binaries can be configured using “alternatives” ..

[cc]
alternatives – maintain symbolic links determining default commands

alternatives creates, removes, maintains and displays information about the symbolic links comprising the alternatives system.
The alternatives system is a reimplementation of the Debian alternatives system. It was  rewritten  primarily  to  remove  the
dependence  on  perl;  it  is intended to be a drop in replacement for Debian’s update-dependencies script. This man page is a
slightly modified version of the man page from the Debian project.

It is possible for several programs fulfilling the same or similar functions to be installed on a single system  at  the  same
time.   For  example,  many  systems have several text editors installed at once.  This gives choice to the users of a system,
allowing each to use a different editor, if desired, but makes it difficult for a program to make a good choice of  editor  to
invoke if the user has not specified a particular preference.

[/cc]
PLEASE READ man page  of alternatives for more details on this ..

Alternatives got below options with it.

alternatives version 1.3.49.3 – Copyright (C) 2001 Red Hat, Inc.
This may be freely redistributed under the terms of the GNU Public License.

usage: alternatives –install <link> <name> <path> <priority>
                    [–initscript ]
                    [–slave <link> <name> <path>]*
       alternatives –remove <name> <path>
       alternatives –auto <name>
       alternatives –config
       alternatives –display <name>
       alternatives –set <name> <path>

common options: –verbose –test –help –usage –version
                –altdir –admindir
[root@ ~]#

Now something like below, can be tried.
[cc]
[root@ ~]# alternatives –config java

There are 3 programs which provide ‘java’.

Selection    Command
——————————

—————–
+ 1           /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java
*  2           /usr/lib/jvm/jre-1.6.0-sun.x86_64/bin/java
3           /usr/lib/jvm/jre-1.5.0-gcj/bin/java
[/cc]

If you want to know which PACKAGE provides above binaries , go for “rpm command” now with the links you got from above..

For ex:
/usr/lib/jvm/jre-1.6.0-sun.x86_64/bin/java
[cc]

[root@ ~]# rpm -qf /usr/lib/jvm/jre-1.6.0-sun.x86_64/bin/java
java-1.6.0-sun-XX.XX.XX
[root@ ~]#

[/cc]
Please note that this is not only for java.. Any binary which can be configured with “alternatives” system…

One Reply to “file is not owned by any package ? Ahh.. Whats wrong ?”

  1. Thanks a lot for this post.. I was irritated by seeing this ( ‘file is not ….) error message till now.. 🙁

Leave a Reply

Your email address will not be published. Required fields are marked *