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?
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.
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.
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
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?
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)