Short Tip: Searching files and packages

Tux
In case you ever compiled anything by hand you might have gotten an error message like this:

make[2]: *** No rule to make target `/lib/libacl.so', needed by `lib/kstyle_qtcurve_config.so'.  Stop.
make[1]: *** [config/CMakeFiles/kstyle_qtcurve_config.dir/all] Error 2
make: *** [all] Error 2

There is obviously a file missing, in this case to compile a specific KDE 4 theme. There are now two ways of searching for the package which contains the file: either through the command line, or through an online package database.

The command line of course depends on the used package manager, here are some examples:

apt-file -x search libacl.so*
urpmf libacl.so
yum whatprovides libacl.so*
zypper wp libacl.so

The -x in case of apt-file makes it possible to use regular expressions. Except for zypper all commands above can be used with regular expressions or show matches if the searched expression is only part of a result (like libacl.so.1)

The package databases depend again on the distribution, but at least for the rpm based distributions there is one common place: rpm.pbone.net. Especially the advanced link is of interest since the results can be filtered by distribution and distribution version.
For Ubuntu based distributions there is the Ubuntu package database, but make sure you use the second entry field. Unfortunately, the database only supports the right file names. Searching for libacl will bring you zero results – which is, to be honest, quite stupid. Gentoo users can try portagefilelist.de.

I am well aware that each distribution has again its own database – but that’s not handy if you deal with different distributions each day. If you now more commands for other distribution tools or other central databases for file/package searches, please leave a comment and I will add them.

About these ads

19 thoughts on “Short Tip: Searching files and packages

  1. And there is obviously a proper test for the existence of libacl in the cmake files missing.
    Something like
    find_library(ACL_LIBRARY acl)
    if(NOT ACL_LIBRARY)
    message(FATAL_ERROR “libacl not found”)
    endif(NOT ACL_LIBRARY)

    Alex

  2. For gentoo:
    equery b libacl.so (app-portage/gentoolkit)
    but of course it will not find libs which are not installed on system. And don’t forget about revdep-rebuild

  3. openSUSE >=11.0:

    zypper wp libacl.so.1
    or
    zypper –what-provides libacl.so.1

    all openSUSE:
    start yast -i, tick “provides” and search for “libacl.so.1″

  4. dBera, does urpmf support asterisks, like urpmf libacl.so* ? And the mentioned web address is a distribution specific, and therefore is not interesting since rpm.pbone.net offers more.

    inful, thx – still, I wonder why to add the -x…

    Alex, yes, of course, but as the result cmake would tell you that libacl is missing, and you still have to install it ;)

    Thomas, non7top: does equery only support installed files, or also general available files? Because I’m focussing on the second case here. Besides, does it support regular expressions? And since I am not a Gentoo user, what is about revdep-rebuild?

    Robin, thanks for the zypper hint, I was wondering if that is possible with zypper. Any idea how to teach zypper regular expressions?

  5. @liquidat:
    zypper supports patterns when searching, i.e.:

    zypper se *zypp*

    regex is not supported nor planned afaik.

    zypper wp /–what-provides doesn’t support patterns, at least it gave me an error when I tried it. Dunno if this should work (maybe file a bug report for it)

  6. Smarter, you are of course right – but then again, the search must (!) be specified for a specific distribution version. I don’t get it why I can’t have both.

    Robin, thx for the hint, but unfortunately zypper se *libacl.so* doesn’t result in packages containing files.

  7. liquidat, that’s because zypper se (search) does not search for dependencies but only for package names (or descriptions if called with “-d”.
    only zypper wp (what-provides) searches for rpm-”provides”

  8. liquidat, to answer your question to dBera about urpmf, I found this in the manpage of urpmf : “Perl-style regular expressions are allowed.”

  9. > Thomas, non7top: does equery only support installed files, or also general available files? Because I’m focussing on the second case here. Besides, does it support regular expressions?

    Equery does the first class. The reason is that Portage (Gentoo’s package manager) cannot account for all of the installable files in advanced, since it compiles all of the applications, and different compiler options may result in different files.

    > And since I am not a Gentoo user, what is about revdep-rebuild?
    Again, since everything is compiled, upgrades may break other packages. revdep-rebuild scans all of the installed libraries and programs for broken dynamic linking, and recompiles when it finds it.

  10. This one should work on all RPM-based systems (and much faster than the package managers on top of it): rpm -q –whatprovides libacl.so.1

  11. Stefan, that only works for installed files – and is therefore totally useless when you want to search for packages of files which are *missing*.

    hrongyorgy, thx.

  12. Mandriva rocks. You don’t have to install the external apt-file package, that should really be part of debian base … urpmf does everything for you.

  13. Benjamin, the commands above give examples for the various different distributions. So of course for Mandriva you use urpmf, while on Debian you use something apt-based.

Comments are closed.