Score:0

understanding why a package is installing a file that `dpkg --search` & `dpkg --listfiles ...` don't know about?

cn flag

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 prints 1)
  • have the same ctime and mtime
    • 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?

hr flag
*"These^ are distinct but identical"* likely `/bin` is symlinked to `/usr/bin` - see for example [why there is two identical bash?](https://askubuntu.com/questions/1408545/why-there-is-two-identical-bash)
some bits flipped avatar
cn flag
@steeldriver - no, they are **not** symlinks, as I specify in my question. `test -L` and `ls -al` ... unless I'm running those checks incorrectly.
hr flag
It is not the **files** that are symbolicly linked, it's the parent **directories** (look at the output of `ls -ld /bin`)
user535733 avatar
cn flag
`dpkg -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.
some bits flipped avatar
cn flag
Oh, OK @steeldriver, that would make sense. It would seem this is a red-herring then (I was stumped by this while poking around trying to understand https://askubuntu.com/questions/1483131/apt-cache-policy-lists-repos-not-shown-in-add-apt-repository-list?noredirect=1#comment2596954_1483131). If you add this as an answer I'll accept. If possible, please include any hints on how this would be easy to figure out in the general case - now that you point it out, `/bin -> usr/bin/` is somewhat obvious, but is there a way to ask in `bash` "do these files resolve to the same inode|blocks|etc?
some bits flipped avatar
cn flag
now seeing the **root** cause, I do agree that the root cause is shared with the "duplicates" linked - however, I'm this is not terribly helpful behavior to mark this as duplicate - the best way I can think to explain my viewpoint is an example: closing as Dup is the same as shutting down a student asking about some cellular traits they observe in lympphocytes, because the same phenomenon was explained elsewhere using erythrocytes as an example. Same root cause? Yes, absolutely. Same **question**? Not really, and certainly not from the perspective of the next person searching!
muru avatar
us flag
@somebitsflipped that's the entire point of duplicates - people asking about the same thing in different ways. That's precisely how closing questions as duplicates helps in searching - people search for X or Y, doesn't matter, they reach the correct place.
Artur Meinild avatar
vn flag
Does this answer your question? [why there is two identical bash?](https://askubuntu.com/questions/1408545/why-there-is-two-identical-bash)
BeastOfCaerbannog avatar
ca flag
Does this answer your question? [Why are /bin and /sbin now symlinks in Ubuntu 20.04?](https://askubuntu.com/questions/1242157/why-are-bin-and-sbin-now-symlinks-in-ubuntu-20-04)
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.