Trying to learn Ansible on Arch node I made a decision to purge Nginx configuration:

sudo systemctl stop nginx.servie
sudo pacman -Rnc nginx
sudo rm -rf /etc/nginx

Hoping that reinstalling nginx (or maybe nginx-mainline) would restore all files:

sudo pacman -S nginx
sudo systemctl start nginx.service

Unfortunately, starting nginx.service was no longer possible:

Job for nginx.service failed because the control process exited with error code.

Looking for possible cause in the system journal:

sudo journalctl -xeu nginx

Proved to be fruitful:

open() "/etc/nginx/mime.types" failed (2: No such file or directory) in
/etc/nginx/nginx.conf:18

Accepted solution on Unix Stack Exchange suggested grabbing mime.types from upstream source.

Package file ownership

The file /etc/nginx/mime.types had to come from somewhere, probing Nginx package:

pacman -Fl nginx | grep mime

Shown no such file owned by the package, yet fresh /etc/nginx/nginx.conf requires it:

...
http {
    include       mime.types;
    default_type  application/octet-stream;
...

Checking which package owns mime.types:

pacman -F /etc/nginx/mime.types

The file /etc/nginx/mime.types comes from the package mailcap.

Package relations

Why is file residing in /etc/nginx not coming from the mailcap package? Are they related?

pacman -Si nginx | grep -i mailcap

The output shows that Nginx Depends on mailcap, this is a relief. Reinstalling both:

sudo pacman -S nginx mailcap

Pacman confirms that missing mime.types file confuses it as well, restores the file:

:: Proceed with installation? [Y/n]
(2/2) checking keyring...
(2/2) checking package integrity...
(2/2) loading package files...
(2/2) checking for file conflicts...
(2/2) checking available disk space...
warning: could not get file information for etc/nginx/mime.types

The Nginx service starts now.

Cross verification

I decided to check if I other packages in /etc/nginx are owned by other packages:

ls /etc/nginx | xargs -I % sh -c 'pacman -F /etc/nginx/%; printf "\n"'

Looking around the somewhat human-readable output, shows only mime.types:

etc/nginx/fastcgi.conf is owned by extra/nginx 1.18.0-2
etc/nginx/fastcgi.conf is owned by community/nginx-mainline 1.19.6-2

etc/nginx/fastcgi_params is owned by extra/nginx 1.18.0-2
etc/nginx/fastcgi_params is owned by community/nginx-mainline 1.19.6-2

etc/nginx/koi-utf is owned by extra/nginx 1.18.0-2
etc/nginx/koi-utf is owned by community/nginx-mainline 1.19.6-2

etc/nginx/koi-win is owned by extra/nginx 1.18.0-2
etc/nginx/koi-win is owned by community/nginx-mainline 1.19.6-2

etc/nginx/mime.types is owned by extra/mailcap 2.1.49-1

etc/nginx/nginx.conf is owned by extra/nginx 1.18.0-2
etc/nginx/nginx.conf is owned by community/nginx-mainline 1.19.6-2

etc/nginx/scgi_params is owned by extra/nginx 1.18.0-2
etc/nginx/scgi_params is owned by community/nginx-mainline 1.19.6-2

etc/nginx/uwsgi_params is owned by extra/nginx 1.18.0-2
etc/nginx/uwsgi_params is owned by community/nginx-mainline 1.19.6-2

etc/nginx/win-utf is owned by extra/nginx 1.18.0-2
etc/nginx/win-utf is owned by community/nginx-mainline 1.19.6-2

And to be extra sure that there is just this one alien file:

ls /etc/nginx | xargs -I % pacman -F /etc/nginx/% | cut -d' ' -f5 | grep -v nginx

The above returns only extra/mailcap package.

In other packages

Having one package providing configuration file to the different config directory happens:

pacman -Fl syncthing | grep ufw

Package syncthing provides files into /etc/ufw/:

syncthing etc/ufw/
syncthing etc/ufw/applications.d/
syncthing etc/ufw/applications.d/ufw-syncthing

I have already hinted about this behavior in one of the previous posts.

This is a 34th post of #100daystooffload.