The officially official Devuan Forum!

You are not logged in.

#1 2017-03-16 16:09:01

GNUser
Member
Registered: 2017-03-16
Posts: 150

[SOLVED] apt-file search not working

I use apt-file to find which package contains a given file. This is extremely handy and sometimes is the only way I know to get such information.

While apt-file works flawlessly in Debian Jessie, in Devuan Jessie apt-file cannot find what it needs to build its cache:

bruno@devuan:~$ sudo apt-file update
Ignoring source without Contents File:
  http://us.mirror.devuan.org/merged/dists/jessie/main/Contents-amd64.gz
Ignoring source without Contents File:
  http://us.mirror.devuan.org/merged/dists/jessie-security/main/Contents-amd64.gz
Ignoring source without Contents File:
  http://us.mirror.devuan.org/merged/dists/jessie-updates/main/Contents-amd64.gz

bruno@devuan:~$ apt-file search foo
E: The cache is empty. You need to run 'apt-file update' first.

Is this a problem on my end or is something missing from Devuan's repositories? It seems more likely to be the latter. If it's a repository problem as I suspect, does anyone know whether there are plans to add the missing "Contents Files" to Devuan's repositories? Thanks!

Last edited by GNUser (2017-03-25 11:23:12)

Offline

#2 2017-03-17 05:50:59

golinux
Administrator
Registered: 2016-11-25
Posts: 691

Re: [SOLVED] apt-file search not working

This is a known issue.

Offline

#3 2017-03-17 14:12:25

GNUser
Member
Registered: 2017-03-16
Posts: 150

Re: [SOLVED] apt-file search not working

Oops, my bad. Sorry for missing that.

Offline

#4 2017-03-17 23:32:35

golinux
Administrator
Registered: 2016-11-25
Posts: 691

Re: [SOLVED] apt-file search not working

No worries.  smile  Welcome to the forum btw!

Offline

#5 2017-03-18 15:17:26

GNUser
Member
Registered: 2017-03-16
Posts: 150

Re: [SOLVED] apt-file search not working

Thank you. I'm very happy to be part of this new community--it's truly an island of sanity. I have no interest in making my system orders of magnitude more complex so that I can (maybe) shave a few seconds off my boot time. When it comes to my OS, I'll take something I can more easily understand and control over something new and (supposedly) faster *anyday* smile Long live Devuan!

Last edited by GNUser (2017-03-18 15:18:07)

Offline

#6 2017-03-18 17:28:55

fsmithred
Administrator
Registered: 2016-11-25
Posts: 471

Re: [SOLVED] apt-file search not working

I was chrooting into an old wheezy installation to run apt-file until someone showed me these:

 To find what package a file comes from:
dpkg -S <file>

To find what files come with a package:
dpkg -L <package>

Offline

#7 2017-03-18 18:13:28

golinux
Administrator
Registered: 2016-11-25
Posts: 691

Re: [SOLVED] apt-file search not working

Could you possibly add that to your Package manager magic incantations?  And while you're there would be nice to have code tags around the commands.  wink

Offline

#8 2017-03-18 20:22:37

GNUser
Member
Registered: 2017-03-16
Posts: 150

Re: [SOLVED] apt-file search not working

Very nice, but has one drawback: "dpkg -S" can only search the contents of packages that are already installed on the system. If the purpose of the search is to determine which package to install, "dpkg -S" isn't going to help.

Last edited by GNUser (2017-03-21 18:32:02)

Offline

#9 2017-03-22 14:30:54

GNUser
Member
Registered: 2017-03-16
Posts: 150

Re: [SOLVED] apt-file search not working

Here's a robust workaround for the time being:

1. On a Debian Jessie system:

$ sudo apt-file update

2. Copy /var/cache/apt/apt-file directory from Debian to Devuan
3. Copy /etc/apt/sources.list from Debian to Devuan, renaming it /etc/apt/debian-sources.list in Devuan so it doesn't conflict with Devuan's "real" sources.list
4. Put this in your ~/.bashrc:

alias apt-file='apt-file --sources-list /etc/apt/debian-sources.list'

Now apt-file searches work as expected, regardless of whether the package containing the file is already installed on your system or not. We're obviously searching through Debian's packages, but 99% of the time it'll be close enough. Just make sure to run apt-file as regular user, since regular user is the one who has the alias:

$ apt-file search foo

Offline

#10 2017-03-23 12:36:36

fsmithred
Administrator
Registered: 2016-11-25
Posts: 471

Re: [SOLVED] apt-file search not working

Thank you for that gem! I've been missing apt-file for a long time.

Slight modification: I didn't copy the cache file. I copied the debian sources.list to my user's home and ran 'apt-file -s sources.list update' and it put an apt-file directory in ~/.cache.

Offline

#11 2017-03-23 13:23:06

GNUser
Member
Registered: 2017-03-16
Posts: 150

Re: [SOLVED] apt-file search not working

Hats off, fsmithred. Your modification is much more elegant. Very nice.

Offline

#12 2017-07-26 05:04:27

Count_Cucaracha
Member
Registered: 2017-07-17
Posts: 37

Re: [SOLVED] apt-file search not working

GNUser wrote:

Here's a robust workaround for the time being

Its robustness was short-lived as that option to apt-file no longer exists.

Offline

#13 2017-07-27 00:51:44

golinux
Administrator
Registered: 2016-11-25
Posts: 691

Re: [SOLVED] apt-file search not working

Count_Cucaracha wrote:
GNUser wrote:

Here's a robust workaround for the time being

Its robustness was short-lived as that option to apt-file no longer exists.

More information as to why not would be helpful.   Perhaps it was PEBKAC . . .

Offline

Board footer