I have installed a particular program via apt
. It originates from a 3rd party repo, and I have 100% confidence the file was installed & updated via apt
not some other path (per data I list below)
I have stripped the specific package name because I would like to know (A) do I understand dpkg --search
capabilities correctly, and (B) faced with an unknown-to-dpkg
file, how do I definitively figure out where it came from?
$ which -a foobaz
/usr/bin/foobaz
/bin/foobaz
These^ are distinct but identical:
- files exist
- neither are symlinks (
test -L $file
fails) OR hardlinkes (stat -c %h -- $file
prints1
) - have the same
ctime
andmtime
- note the package has been updated recently, all the times^ look correct to me.
- have identical
sha1sum
hashes
but dpkg only seems to know about the first one?
$ dpkg --get-selections | grep -i foobaz
foobaz install
$ dpkg-query -S /usr/bin/foobaz
foobaz: /usr/bin/foobaz
dpkg-query -S /bin/foobaz
dpkg-query: no path found matching pattern /bin/foobaz
Shouldn't dpkg -S <file>
always know about the files added by the debs/apt? How should I approach this issue to determine where some 'unknown' file originated when I know with high confidence it was installed with apt
?
/bin
is symlinked to/usr/bin
- see for example why there is two identical bash? – steeldriver Aug 21 '23 at 18:18test -L
andls -al
... unless I'm running those checks incorrectly. – some bits flipped Aug 21 '23 at 18:23ls -ld /bin
) – steeldriver Aug 21 '23 at 18:34dpkg -S /path/to/foobaz
will indeed know about any installed packages that provide that file. However, that number of packages is usually 1. More than one package that provides the same file must be accounted for in the control file, or apt will throw a terminating error: "Package X is attempting to overwrite File A, which is also provided by already-installed Package Y." Debian worked all this out over 20 years ago. – user535733 Aug 21 '23 at 18:35/bin -> usr/bin/
is somewhat obvious, but is there a way to ask inbash
"do these files resolve to the same inode|blocks|etc? – some bits flipped Aug 22 '23 at 01:31