2

On a Synology NAS (uses a 'home grown' *nix variant (possibly based on Debian?)) I have installed ipkg package manager. When I try a command like

ipkg search shred 

or

ipkg search *shred* 

it returns only the single line:

Successfully terminated

without any package name.

I specifically used shred in my example as I know that shred exists for my platform and is part of the coreutils package (and so should return that answer.)

What is going wrong? Is this a bug, an error in my syntax or possibly something else?

Edit -

I found the answer - filename needed to be enclosed in single quotes like

ipkg search '*shred*'

This returns the correct answer - coretutils.

I also found that Pavel is correct, it only returns info on installed packages, which is not what I needed.

How would I go about finding what pkg to install if I need a given program/util that is part of a larger collection but don't know what package contains it?

(is that permitted or should I start another question?)

JoelAZ
  • 147
  • 2
  • 9
  • 1
    Why do you assume it should return that answer if there's no package called shred but instead it's part of coreutils? – Pavel Šimerda May 10 '14 at 21:16
  • The description of ipkg search states that it should find files within packages. From `ipkg --help`: `search Search for a package providing ` I take this to mean for a given filename, return the package containing it. To be sure however, `ipkg search coreutils` also returns nothing. – JoelAZ May 10 '14 at 21:35
  • Sorry, new to Stack - meant to call out @PavelŠimerda in my previous comment. – JoelAZ May 10 '14 at 21:42
  • I'm getting your comments even without the tag. – Pavel Šimerda May 10 '14 at 21:53
  • 1
    Assuming `ipkg` behaves closely like `opkg` (on OpenWrt): `opkg search xyzzy` will return which installed package has the file `xyzzy`. After updating the packages information using `opkg update` you can do `opkg find *shred*` and this returns `coreutils-shred`... –  May 10 '14 at 21:54
  • @yeti: If you have any information on files of packages that are not installed, please edit my answer or add comments so I can edit myself. – Pavel Šimerda May 10 '14 at 21:56
  • 1
    I have not seen a debian-like `apt-file` command needing an own files-to-packagename database in OpenWrt. For systems aiming to have a small footprint this is contra productive. but maybe I just do not know it's name in OpenWrt? –  May 10 '14 at 22:02
  • @yeti: I wasn't aware there's such a tool with its own database in Debian. It has to be generated from the package files themselves. In RPM based distributions I don't know anything like that either. – Pavel Šimerda May 10 '14 at 22:09
  • 1
    Look at `ftp://ftp.debian.org/debian/dists/stable/` ... the file-to-packagenames indices are the files named `Contents-$ARCHITECTURE.gz`. Building such indices for OpenWrt and relatives and publishing them as web service would be easy... but I doubt it'll make sense to keep these lists in a small embedded system... –  May 10 '14 at 22:18
  • I believe you're doing the right thing by amending the question to be more useful (and to get a more useful answer). – Pavel Šimerda May 10 '14 at 22:18
  • Thanks @yeti. Your answer led me to http://ipkg.nslu2-linux.org/feeds/optware/ which led to http://ipkg.nslu2-linux.org/feeds/optware/syno-i686/cross/unstable/Packages.filelist which is equiv to what you provided but for my Synology platform. So I guess the search for a given file is a manual one and you have to find the repo, distro by distro. Thanks. – JoelAZ May 10 '14 at 22:41

1 Answers1

0

I don't think package metadata include lists of files. I believe ipkg search is only meant to get package names for installed files, similarly to rpm -qf. You may need to provide full path of an installed file.

When looking for information about the coreutils package, you might want to try the following:

ipkg info coreutils
ipkg status coreutils
ipkg files coreutils

You can also see how the results differ for installed and not installed packages.

When searching of an installed package providing a specific file, you can use:

ipkg search /path/to/installed/file

As you pointed out in your edited question, you have to use asterisk if you don't want to specify the complete path name, for example:

ipkg search \*file

ipkg search '*file'

In my opinion, there's no information you can get for files that don't exist or haven't been installed.

You may also need to check whether you have metadata for packages downloaded at all and download them:

ipkg update

How would I go about finding what pkg to install if I need a given program/util that is part of a larger collection but don't know what package contains it?

ipkg can't help you here as it doesn't have the data. I don't think your distribution has a tool like apt-file which would be a solution. In that case, you typically need to revert to using a websearch to get such information.

Sources:

Disclaimer: I'm only using opkg on OpenWRT, which is very close to ipkg.

Pavel Šimerda
  • 6,394
  • 2
  • 26
  • 33
  • Thanks Pavel. I know searching for coreutils makes no sense. I was responding to your comment about why I thought it should return shred when there was no package called shred. – JoelAZ May 10 '14 at 22:04
  • Sure. I made that comment before I looked up the semantics if `ipkg search`. – Pavel Šimerda May 10 '14 at 22:06
  • @JoelAZ: I removed that part from the answer. – Pavel Šimerda May 10 '14 at 22:11
  • I don't have reputation to vote your answer up but I take your answer as correct as you lead me to the solution and also you are correct that `ipkg search` is only related to installed packages. – JoelAZ May 10 '14 at 22:17
  • @JoelAZ: While you don't have the power to *up* the answer, you should have the power to *accept* it as it belongs to your question. – Pavel Šimerda May 10 '14 at 22:19
  • Thanks Pavel. Wasn't obvious but I see it now. Still groping my way around Stack.. 8| – JoelAZ May 10 '14 at 22:43