The officially official Devuan Forum!

You are not logged in.

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

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

[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: 3,316  

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: 570  

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: 3,316  

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: 570  

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: 2,486  

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: 3,316  

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: 570  

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: 570  

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: 2,486  

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: 570  

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: 3,316  

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

#14 2018-08-18 06:07:18

paulwratt
Member
Registered: 2018-08-08
Posts: 7  

Re: [SOLVED] apt-file search not working

golinux wrote:
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 . . .

that "workaround" wont help, because it searches the contents of the copied apt-file caches and uses the Debian repos, NOT the Devuan repos and caches created from them.

https://dev1galaxy.org/viewtopic.php?id=2291

looks for "dir/Content-_arch_.gz" instead of "dir/binary-_arch_/Packages.gz"

Cheers

Paul

Offline

#15 2018-08-18 19:04:09

paulwratt
Member
Registered: 2018-08-08
Posts: 7  

Re: [SOLVED] apt-file search not working

there is now a 100% solution, no patch needed the Devuan Jessie repos

EDIT: in fact after a quick check it turns out @golinux is right, there is no issue with the original script IF your repo points to deb.devuan.org:
https://dev1galaxy.org/viewtopic.php?pid=11397#p11397

Last edited by paulwratt (2018-08-19 13:47:04)

Offline

#16 2018-08-18 20:00:21

golinux
Administrator
Registered: 2016-11-25
Posts: 3,316  

Re: [SOLVED] apt-file search not working

If there is not already a bug report please submit one at bugs.devuan.org

Offline

#17 2018-08-19 13:48:20

paulwratt
Member
Registered: 2018-08-08
Posts: 7  

Re: [SOLVED] apt-file search not working

golinux wrote:

If there is not already a bug report please submit one at bugs.devuan.org

I edited the other thread and the above post to reflect the situation.

Offline

Board footer