How can I know to which ubuntu package does a specified file (not on my fs) belongs?

Nils Kassube kassube at gmx.net
Thu Mar 31 07:20:27 UTC 2011


NoOp wrote:
> On 03/30/2011 02:02 PM, Nils Kassube wrote:
> > Kevin Wilson wrote:
> >> I want to know how can I find (with apt-get), to which ubuntu
> >> package does a certain file (which **does not** exist on my
> >> filesystem) belong.
> > 
> > AFAIK apt-get doesn't offer that option but you can install the
> > package "apt-file". Then run the command
> > 
> > sudo apt-file update
> > 
> > once and after that you can search for individual files with the
> > command
> > 
> > apt-file search filename
> 
> That doesn't seem to work even with installed package files:
> 
> $ apt-file search gnome-default-applications.xml

I don't think it depends on the state of the file because apt-file uses 
its own database of filenames and doesn't care about the database of 
installed files / packages. However the apt-file command probably 
doesn't know about files which are not directly included in any package 
but are written e.g. by a post-install script. As an example I can't 
find a package for /etc/passwd neither with apt-file nor with "dpkg -S".

Another problem could be your sources.list. If you search for a package 
in the universe repository, that repository should have been included in 
your /etc/apt/sources.list when you used the command "sudo apt-file 
update". However capplets-data (the package for gnome-default-
applications.xml) is in main, so it is unlikely this was the case here. 
Are you sure you used "sudo apt-file update" before you searched for the 
file? On my Lucid machine I get the expected result while the file in 
question isn't installed (I don't use Gnome). And even on a Ubuntu Lucid 
in a VM which does have the file installed, I get the expected result.


Nils




More information about the ubuntu-users mailing list