24

I am thinking on some like Contents-<arch>.gz on Debian. A network service were also okay. Does it exist?

Simple elaboration: For example, we need a binary named exampletool, which we know very good from other distributions or operation systems. We want to install that, for example, with zypper. But zypper can only install a package. To find out, in which package can we find the required exampletool binary, we need to do practically a search, and ideally a fast, indexed search in the file list of the currently not installed, but in the repositories available packages. On debian, there is an index file in the package repositories named Contents-amd64.gz, in which we can find the required package with a single zgrep command. I am looking for some similar, single-command solution for OpenSUSE, too. If there is none, a web service were also okay for the same functionality.

0

6 Answers 6

17

To search from all available packages to find a particular file, you can use the option wp or se --provides --match-exact as an example:

zypper se --provides --match-exact hg

You will see output similiar to the following:

Loading repository data...
Reading installed packages...

S | Name      | Summary                  | Type   
--+-----------+--------------------------+--------
  | mercurial | Scalable Distributed SCM | package

From that point you can install the package through a standard zypper install

zypper in mercurial

It should be noted that zypper wp is obsolete and may no longer be available.

3
  • 1
    This is not always reliable. I don't know why but file names such as zypper search --provides [--match-exact] getenforce do not return results, while zypper search --provides nslookup does.
    – Lester
    Commented Jan 31, 2020 at 14:15
  • I believe that provides are symbolic and set manually by the packager, but I don't know much about how openSUSE creates packages. As such, they don't necessarily reflect package file contents.
    – ZeroKnight
    Commented May 7, 2021 at 23:50
  • I'm on openSUSE Leap 15 and searching for ping package, zypper se --provides --match-exact ping gives me nothing but zypper se --provides --match-exact /usr/bin/ping gives me iputils, to ensure getting result maybe zypper se --provides --match-exact $(which command), for me zypper se --provides --match-exact $(which ping) then. Edit: I just saw the scout bin command below that I prefer since works with scout bin ping and above all is much faster.
    – gluttony
    Commented Oct 27, 2023 at 13:44
11

To the googlers of the future: next to @SailorCire 's wonderful solution :-), there is also a tool named scout, which is able to search in practically everything, we can find rpm-s for a binary just as we can find the jars for a given java class.

For example, we can use scout's bin command to find out what package provides the hg executable:

scout bin hg

The result of this search is the mercurial package:

 repository      | package   | path     | binary
-----------------+-----------+----------+--------
 zypp (repo-oss) | mercurial | /usr/bin | hg    
6
  • Can you please be a little more specific about the scout tool ? Can you give its' complete name or URL to its' code ?
    – SebMa
    Commented Nov 4, 2019 at 15:29
  • @SebMa It was downloadable from rpm, probably by zypper. It is possible, that it was in a non-standard repo. I can't remember very well :-( I don't use SuSE any more. But it is quite possible that I will be, then I will check it and explain what I found. It is possible, that SuSE has changed a lot since then.
    – peterh
    Commented Nov 4, 2019 at 15:33
  • On my Jolla1 device (SailFishOS), zypper wp scout says No matching items found.
    – SebMa
    Commented Nov 4, 2019 at 15:38
  • @SebMa Googling for "scout tool rpm" I found this link on the spot, in the current moment I can't help more. Probably you will need to install it from some non-standard repository.
    – peterh
    Commented Nov 4, 2019 at 15:58
  • On the link you've provided, it says : "Scout is an interface to Tomboy notes or Gnote that uses DBus to communicate." I'm not sure that's the tool we are looking for.
    – SebMa
    Commented Nov 4, 2019 at 17:09
6

Even later to the party than @Vicente Bolea, but I have found a solution by checking the documentation of zypper se, which was suggested by @SailorCire:

zypper search --file-list <filename>

or its short version

zypper se -f <filename>

searches in the file lists of the available packages

1

I am late to this party, but to add my grain of salt.

Currently, there is not a reliable way to do this in OpenSUSE. In theory, the package maintainers must add all the files it "provides" in the Provides section in the spec package. But this is seldom used.

Alternatively, if you have an idea in which package the wanted file it is you could individually inspect the files inside the rpm as in this answer https://stackoverflow.com/a/57397745/2420872

1
  • 2
    I think the provides is a very different thing (not sure in OpenSUSE any more). The last what would be reliable if it depends on what the package maintainers manually say. The question asks for what actually lists the files in all packages in the remote repository, and searches in them. How about the other answers? zypper was quite a reliable solution for me (at the time - I do not use opensuse any more).
    – peterh
    Commented Feb 26, 2021 at 12:35
1

My first shot would always be cnf aka command-not-found:

cnf yelp

The program 'yelp' can be found in following packages:

  • yelp [ path: /usr/bin/yelp, repository: zypp (openSUSE-Leap-15.4-1) ]
  • yelp [ path: /usr/bin/yelp, repository: zypp (repo-oss) ]

Try installing with: sudo zypper install yelp

To further check on available versions and repos, use opi, the OBS Package Installer (CLI), to search and install almost all packages available for openSUSE and SLES:

$ opi yelp

  1. yelp
  2. yelp-xsl
  3. yelp-tools
  4. libyelp0
  5. yelp-lang
  6. yelp-devel Pick a number (0 to quit):

1

You have selected package name: yelp

  1. GNOME:STABLE:41 ? | 41.2 | x86_64 Pick a number (0 to quit):

Picking 1 will first add the repo, if required, enable it, and download and install the package.

The advantages of opi become obvious when there are multiple versions to choose from:

$ opi php8

You have selected package name: php8

  1. devel:languages:php:php82 ? | 8.2.4 | x86_64
  2. devel:languages:php ? | 8.1.17 | x86_64
  3. devel:languages:php:php81 ? | 8.1.13 | x86_64
  4. devel:languages:php:php80 ? | 8.0.28 | x86_64
  5. home:13ilya ! | 8.2.4 | x86_64
  6. home:mmanu84:php8:php82 ! | 8.2.4 | x86_64
  7. home:SCNOPS:php81 ! | 8.1.17 | x86_64
  8. home:illuusio:php-next ! | 8.1.17 | x86_64 Pick a number (0 to quit):

Which will allow you to select between PHP 8.0.28, 8.1.13, 8.1.17, and 8.2.4. Note that there's no stable package yet, all are either labeled devel or home.

0

I'm using Gecko Linux XFCE. I opened Yast2 and installed gnome-search-tool and gnome-shell-search-provider-nautilus. It works fine, just like Catfish.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .