I'm trying to find the package that installs libnss_mdns4_minimal.so.2
using dpkg -S
. The output says no path found
when the file path begins with /usr/lib/
but succeeds when it begins with /lib/
.
I'm using Ubuntu 22.04 Server.
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04.4 LTS
Release: 22.04
Codename: jammy
To find the location of the file, I ran the following commands:
$ sudo updatedb
$ locate mdns4_minimal
/usr/lib/x86_64-linux-gnu/libnss_mdns4_minimal.so.2
Next, I used dpkg -S
to find the package that installed libnss_mdns4_minimal.so.2
. The output states: no path found matching pattern
.
$ dpkg -S /usr/lib/x86_64-linux-gnu/libnss_mdns4_minimal.so.2
dpkg-query: no path found matching pattern /usr/lib/x86_64-linux-gnu/libnss_mdns4_minimal.so.2
However, the following succeeds:
$ dpkg -S /lib/x86_64-linux-gnu/libnss_mdns4_minimal.so.2
libnss-mdns:amd64: /lib/x86_64-linux-gnu/libnss_mdns4_minimal.so.2
I notice that /lib
is a symlink to /usr/lib
:
$ ls -l /lib
lrwxrwxrwx 1 root root 7 Mar 19 2023 /lib -> usr/lib
I don't understand why no path was found
when using the full path /usr/lib/x86_64-linux-gnu/libnss_mdns4_minimal.so.2
, yet succeeds when using /lib/x86_64-linux-gnu/libnss_mdns4_minimal.so.2
. Isn't the file the same no matter whether I'm referencing via the direct path or the via the symlink?
Can someone explain?
dpkg -S
merely matches the input against the list of paths specified in its database of packages.It's not looking at actual paths or files on your system.
In this case, the relevant deb package specifies a path of
/lib/x86_64-linux-gnu/libnss_mdns4_minimal.so.2
, so that's whatdpkg
uses for installs, removals, ...and searches.