5

I'm used to using dpkg -S /path/to/file to figure out where something came from on Debian. The ~new "everything-in-usr" AKA usrmerge policy often breaks this. For just on example:

> dpkg -S /bin/systemd
systemd: /bin/systemd
> readlink -f /bin/systemd
/usr/lib/systemd/systemd
> dpkg -S /usr/lib/systemd/systemd
dpkg-query: no path found matching pattern /usr/lib/systemd/systemd

This sucks because the actual executable running is /usr/lib/systemd/systemd so I'm much more likely to want to know what package that came from in any given usage of dpkg -S. Is there another usrmerge aware substitute for dpkg -S I could used to easily and reliably track an executable back to its package?

spinkus
  • 491

1 Answers1

6

I’m not aware of any /usr-merge-aware equivalent to dpkg -S, but there is a way to avoid this problem: dpkg -S doesn’t need a full path, so

dpkg -S lib/systemd/systemd

and

dpkg -S bin/systemd

will give you the answer(s) you’re looking for. If you want to avoid listing all files matching the given patterns as substrings, add a *:

dpkg -S '*lib/systemd/systemd' '*bin/systemd'

See also dpkg-query: no path found matching pattern /usr/bin/bash, and this description of the /usr merge (written by the dpkg maintainer) which explains some of the constraints involved, and lists a number of dpkg features which are broken by the usrmerge package’s approach (including dpkg -S).

Stephen Kitt
  • 434,908