Ubuntu: Why `dpkg -S /var/lib/dpkg` shows “base-files, dpkg”?



Question:

I'm curious to know which package provides the /var/lib/dpkg directory, so i run this command

$ dpkg -S /var/lib/dpkg  base-files, dpkg: /var/lib/dpkg  

The resulted output displays the package which provides /var/lib/dpkg along with base-files string like the above.

$ dpkg -S /var/lib/aptitude  aptitude: /var/lib/aptitude  $ dpkg -S /var/lib/apt  apt: /var/lib/apt  

But i didn't see any base-files string on the above output. Ofcourse files inside /var/lib/apt directory is also essential for an Ubuntu system to run.

So Why dpkg -S /var/lib/dpkg command shows "base-files," string ? Why it isn't displayed on the others?


Solution:1

You are searching for a directory, not a specific file/binary, so any package can install files inside a directory:

➜  ~  dpkg -L dpkg | grep '/var/lib/dpkg'  /var/lib/dpkg  /var/lib/dpkg/info  /var/lib/dpkg/updates  /var/lib/dpkg/parts  /var/lib/dpkg/alternatives  ➜  ~  dpkg -L base-files | grep '/var/lib/dpkg'  /var/lib/dpkg  ➜  ~    

As you can see, base-files also creates the /var/lib/dpkg directory (exact reason why, I ignore it, maybe there were some files now deleted, but the changelog doesn't give any obvious hint) and the dpkg package which apart of being owner of the /var/lib/dpkg directory, installed files inside it.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »