Do pacman's -S and -F operations use different databases?

At first, I assumed that both operations use the database files stored at /var/lib/pacman/sync/ but it appears that my assumption is wrong.

When I ran:

sudo pacman -Syu

And then:

pacman -F some-file-name

It results in a warning that says my database files don’t exist:

warning: database file for 'core' does not exist (use '-Fy' to download)
warning: database file for 'extra' does not exist (use '-Fy' to download)
warning: database file for 'community' does not exist (use '-Fy' to download)
warning: database file for 'multilib' does not exist (use '-Fy' to download)

If both use different databases, it should be fine to run sudo pacman -Fy, right? It won’t be the same as running a sudo pacman -Sy without updating the whole system? I went through the archwiki page for pacman, and I don’t think there was a warning there about using the -Fy option.

If both indeed use different databases, then why? Why use two sets of databases?

1 Like

You would need to ask this question the pacman/libalpm developers.

Both “databases” are stored in /var/lib/pacman/sync/ . You will see the normal package database and the files databases. Since the files databases are quite bigger, maybe it was because of speed to download and go thru.

2 Likes

Short answer: Yes.

Sligtly longer answer: The -S database is mainly about package information, like name, version, maintainer etc.
The -F databases are focused on what files belong to each package. So this database is much larger than the other one, but comes in handy if you need a library, but don’t know what package contains it. Then you can query the Files database with pacman -F <filename> and it will list the packages that has it.

7 Likes

I just ran a sudo pacman -Fy
And yes, I do see two sets of database files. The -Sy version have a .db extension each; while the -Fy version have a .files extension

I didn’t dare to run a sudo pacman -Fy before this because I was worried it would be the same as sudo pacman -Sy

I guess that make sense. Both databases stores different data.

Thanks for the answer.

But when pacman downloads all the .files, it does so based on the .db files, right? Because the database includes only the list of files belonging to locally installed packages? Is this understanding correct?

No. The files in the Files database, are for all packages in the repo that database handles. It does not care if it’s installed or not.

So essentially, pacman -Fy is merely the “local” version of pacman -Qo

Is that correct?

No. The other way around.

pacman -Qo is the local version of pacman -F.

2 Likes

pacman -Qo use local database - pkgs installed (not pacman -FY .files)
we have always local filenames database
as pacman -Qs is only local
local:

ls -l /var/lib/pacman/local/linux*/files
pacman -Qo file_in_package_installed
pacman -Ql package_name_installed

pacman -F use pacman database (all pkgs, installed or not)
Sync filenames database is an option with pacman (but we have always with pamac)
as pacman -Ss is for all (Sync database)

ls -l /var/lib/pacman/sync/*.files
pacman -F filename
pacman -Fx "in path or filename"
pamac search -f file (as pacman -Fx)
5 Likes

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.