Dnf query for file ownership sometimes fails to find association

There are times when I want to find out what package owns a file for a package that is not currently installed and I use

dnf rq -f /usr/bin/zsh
Last metadata expiration check: 0:21:07 ago on Tue 14 May 2024 11:03:45 PM UTC.
zsh-0:5.9-13.fc40.x86_64

There are multiple packages that this does not work for

dnf rq -f /usr/share/wayland-sessions/weston.desktop 
Last metadata expiration check: 0:23:46 ago on Tue 14 May 2024 11:03:45 PM UTC.

But the file is owned by a package

dnf rq -ql weston-session
/usr/share/wayland-sessions/weston.desktop

Now weston-session is a subpackage of weston but it does own the file.

After the package is installed rpm does match ownership

rpm -qf /usr/share/wayland-sessions/weston.desktop 
weston-session-13.0.0-5.fc40.noarch

How do I find ownership of not-yet-installed files a better way?

2 Likes

I’m not sure. I always use dnf whatprovides <file spec>, which does work in this case:

$ sudo dnf whatprovides "/usr/share/wayland-sessions/weston.desktop"
Last metadata expiration check: 0:02:29 ago on Wed 15 May 2024 09:53:10 BST.
weston-session-13.0.0-5.fc40.noarch : Weston desktop session
Repo        : fedora
Matched from:
Filename    : /usr/share/wayland-sessions/weston.desktop

I’d file it as a bug because the man page suggests that repoquery should also work, unless there’s a nuance there that we’re missing :thinking:

2 Likes

Removed wayland

The weston-session subpackage is new to f40 so looking at a subpackage that has been around longer

dnf rq -f /usr/lib/systemd/system/systemd-networkd.service
Last metadata expiration check: 0:22:05 ago on Wed 15 May 2024 10:08:11 AM UTC.
dnf provides /usr/lib/systemd/system/systemd-networkd.service
Last metadata expiration check: 0:22:48 ago on Wed 15 May 2024 10:08:11 AM UTC.
systemd-networkd-255.4-1.fc40.x86_64 : System daemon that manages network configurations
Repo        : fedora
Matched from:
Filename    : /usr/lib/systemd/system/systemd-networkd.service

systemd-networkd-255.6-1.fc40.x86_64 : System daemon that manages network configurations
Repo        : updates
Matched from:
Filename    : /usr/lib/systemd/system/systemd-networkd.service

I am happy to learn something and change my practices to use dnf provides rather than dnf repoquery.

2 Likes