You are not logged in.

#1 2016-07-14 18:24:01

pgoetz
Member
From: Austin, Texas
Registered: 2014-02-21
Posts: 341

[SOLVED] How to use pacman --files?

In another discussion on this forum I was alerted to the pacman --files/-F option.  However when I try using it I get:

toad:~~$ pacman --files awk
warning: database file for 'core' does not exist
warning: database file for 'extra' does not exist
warning: database file for 'community' does not exist
error: no options specified (use -h for help)
toad:~~$ pacman --files 'awk'
warning: database file for 'core' does not exist
warning: database file for 'extra' does not exist
warning: database file for 'community' does not exist
error: no options specified (use -h for help)
toad:~~$ pacman -Fo awk
warning: database file for 'core' does not exist
warning: database file for 'extra' does not exist
warning: database file for 'community' does not exist
toad:~~$ pacman -Fo 'awk'
warning: database file for 'core' does not exist
warning: database file for 'extra' does not exist
warning: database file for 'community' does not exist

On the other hand, -Ss works fine:

toad:~~$ pacman -Ss 'awk'
core/gawk 4.1.3-1 (base base-devel) [installed]
    GNU version of awk
extra/nawk 20121220-2
    The one, true implementation of AWK
community/hawknl 1.68-4
    An open source game oriented network API

What databases is the warning referring to?  I couldn't find any mention of the --files/-F option in the pacman Wiki page, and Google wasn't much help, either.

As a follow up question, what is the difference between  --files and -Ss (other than one works for me and the other doesn't)?

Last edited by pgoetz (2016-07-19 10:40:44)

Offline

#2 2016-07-14 18:27:49

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,858
Website

Re: [SOLVED] How to use pacman --files?

See the pacman man page:

       -F, --files
           Query the files database. This operation allows you to look for packages owning
           certain files or display files owned by certain packages. Only packages that are part
           of your sync databases are searched. See File Options below.
[...]
FILE OPTIONS
       -y, --refresh
           Download fresh package databases from the server. Use twice to force a refresh even if
           databases are up to date.

Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#3 2016-07-14 18:31:17

mis
Member
Registered: 2016-03-16
Posts: 234

Re: [SOLVED] How to use pacman --files?

Have you updated the files database with -Fy ?

Offline

#4 2016-07-14 18:42:20

alphaniner
Member
From: Ancapistan
Registered: 2010-07-12
Posts: 2,810

Re: [SOLVED] How to use pacman --files?

The not-exactly-spoken and not-exactly-documented fact is that -F uses different databases than -S. All things considered I shouldn't be surprised as pkgfile requires its own dbs as well, but I see nothing in pacman(8) suggesting it's not clear from pacman(8) that this is the case for -F.

As to your follow up, -Ss searches package name and description only.

Last edited by alphaniner (2016-07-14 18:48:10)


But whether the Constitution really be one thing, or another, this much is certain - that it has either authorized such a government as we have had, or has been powerless to prevent it. In either case, it is unfit to exist.
-Lysander Spooner

Offline

#5 2016-07-14 19:07:50

pgoetz
Member
From: Austin, Texas
Registered: 2014-02-21
Posts: 341

Re: [SOLVED] How to use pacman --files?

So, to answer several questions at once:

  • WorMzy: Yes, I read the man page.  <:)

  • mis: I ran  pacman -Syu just prior to trying the -F option, so assumed the databases were up to date, but in any case running pacman -Fy did somehow create the database files pacman was looking for:

    [root@toad ~]# pacman -Fy
    :: Synchronizing package databases...
     core is up to date
     extra is up to date
     community is up to date
    [root@toad ~]# pacman -Fo awk
    [root@toad ~]# pacman -Fo 'awk'

    (notice there is no output from running the command)

    However, I just noticed the s file option does work:

    [root@toad ~]# pacman -Fs 'awk'
    core/gawk 4.1.3-1
        usr/bin/awk
    community/9base 6-5
        opt/plan9/bin/awk
    community/plan9port 20150629-2
        usr/lib/plan9/bin/awk
    community/quilt 0.64-1
        usr/share/quilt/compat/awk

    I'm just finding it hard to believe that awk is not a file in the awk package

  • alphaniner:  yes, this is exactly my point.  It would be nice to have some clarity on what databases the error message is talking about.  Apparently the -Fy option sets up different databases (or databases in a different location) as the previous error messages about missing database files disappeared when I ran pacman -Fy.  This doesn't appear to be well documented.  And as I mentioned, the string --files doesn't appear anywhere in the Pacman Wiki page

Last edited by pgoetz (2016-07-14 19:09:25)

Offline

#6 2016-07-14 19:37:51

mis
Member
Registered: 2016-03-16
Posts: 234

Re: [SOLVED] How to use pacman --files?

With the -o option you have to pass the full path

pacman -Fo /usr/bin/awk
usr/bin/awk is owned by core/gawk 4.1.3-1

As far as I understand, it's similar to 'pacman -Qo' but also works for packages that are not installed.

Offline

#7 2016-07-14 20:34:16

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: [SOLVED] How to use pacman --files?

pacman repo databases can contain an optional section listing the files in the package, but this greatly increases the size and therefore download speed -- which isn't nice when you just want to `pacman -Syu`.

If you check in /var/lib/pacman/sync/ you will see some *.db and *.files databases. The *.files database is the expanded database used by `pacman --files` and needs to be downloaded separately.

For the most part, `pacman --files` tries to keep the same options with the same meanings as `pacman --sync`.

...

Aside: Why, specifically, should awk be provided by an "awk" package? Many many many binaries do not share the same name as the package that installs them... but in this case, "awk" is is actually a compatibility symlink to "gawk" (also provided by the, you guessed it, GNU Awk package). wink


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#8 2016-07-14 21:07:06

pgoetz
Member
From: Austin, Texas
Registered: 2014-02-21
Posts: 341

Re: [SOLVED] How to use pacman --files?

Eschwartz wrote:

Aside: Why, specifically, should awk be provided by an "awk" package? Many many many binaries do not share the same name as the package that installs them... but in this case, "awk" is is actually a compatibility symlink to "gawk" (also provided by the, you guessed it, GNU Awk package). wink

Well, yes.  That's why I picked awk as my test example:  it's crusty oldness insured that some included file would be called awk, and I already knew that there was an awk package.  Any deviation from this would upset the guys with long grey beards wearing suspenders offering you a nickel to buy yourself a better computer.

Thanks for answering the question about the database files -- that was extremely helpful.

Offline

#9 2016-07-14 21:42:29

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: [SOLVED] How to use pacman --files?

So what *did* you mean by "I'm just finding it hard to believe that awk is not a file in the awk package"?


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#10 2016-07-15 12:03:46

pgoetz
Member
From: Austin, Texas
Registered: 2014-02-21
Posts: 341

Re: [SOLVED] How to use pacman --files?

Eschwartz wrote:

So what *did* you mean by "I'm just finding it hard to believe that awk is not a file in the awk package"?

Because the command pacman -Fo awk wasn't coming back with anything.  But as mis pointed out, with the -Fo option you have to give the full path for it to work:

[pgoetz@frog mate]$ pacman -Fo awk
[pgoetz@frog mate]$ pacman -Fo /usr/bin/awk
usr/bin/awk is owned by core/gawk 4.1.3-1

Offline

#11 2016-10-12 00:43:06

NuSkool
Member
Registered: 2015-03-23
Posts: 141

Re: [SOLVED] How to use pacman --files?

WorMzy wrote:

See the pacman man page:

FILE OPTIONS
       -y, --refresh

Download fresh package databases from the server. Use twice to force a refresh even if
           databases are up to date.

alphaniner wrote:

The not-exactly-spoken and not-exactly-documented fact is that -F uses different databases than -S. All things considered I shouldn't be surprised as pkgfile requires its own dbs as well, but I see nothing in pacman(8) suggesting it's not clear from pacman(8) that this is the case for -F.

Performing a pacman -Fy was not obvious to me at all, as the package database update y option did not seem to fit for a file database update. I did not try it though, and that would have saved me much time. I did run a -Syy before I assumed it used a different database. It seems I'm not the only one?

After searching high and low, I did manage to find the obscure requirement to a functional pacman -F. Pacman man, man pacman.conf, https://wiki.archlinux.org/index.php/pacman, https://wiki.archlinux.org/index.php/Pa … and_tricks, nothing.

A Google search for pacman "database file for does not exist", nothing. Googling arch pacman5.0 lead me to Allyn's blog http://allanmcrae.com/2016/01/pacman-5-0-released/ with the secret -Fy trick.

Backtracking to see how I missed this, I Googled “pacman -Fy“ which led me here.

Question, what would be the best way to attempt to fix this? File a feature request on the Arch bug report asking the man page updated? Would this require a patch, that I would not know how to do? Try to contact Allyn via an email?

Does anyone know if this is in the works, in which case I'd just let it go.

Offline

#12 2016-10-12 00:48:58

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [SOLVED] How to use pacman --files?

Fix what? What would your proposed patch look like?

For me, the man page is pretty clear. But I prefer pkgfile anyway...


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#13 2016-10-12 01:53:35

NuSkool
Member
Registered: 2015-03-23
Posts: 141

Re: [SOLVED] How to use pacman --files?

Well, going back to reread the man pacman page, its perfectly clear now. lol

I guess the following would make it more clear. So the info in the error matched whats in the man page.

The error:

toad:~~$ pacman --files awk
warning: database file for 'core' does not exist
warning: database file for 'extra' does not exist
warning: database file for 'community' does not exist


Original man pacman:

FILE OPTIONS
       -y, --refresh
           Download fresh package databases from the server. Use twice to force a refresh even if databases are up to date.


Proposed change to pacman man:

FILE OPTIONS
       -y, --refresh
           Download fresh database files from the server. Use twice to force a refresh even if databases are up to date.

OR

FILE OPTIONS
       -y, --refresh
           Download fresh file databases from the server. Use twice to force a refresh even if databases are up to date.

As I said though, I don't have the skills required to supply a proper patch yet. And it is perfectly clear to me now.

Offline

Board footer

Powered by FluxBB