Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Is there a method or command which can tell from which repository a package is coming from?

share|improve this question

4 Answers 4

up vote 18 down vote accepted

Commands Needed:

  • dpkg -s <package> - allows you to find the version of that you have installed. (source)
  • apt-cache showpkg <package> - will show a list of Versions of the package available. For each version, the source of the package, in the form of an index file name, will be given.

If you want to find the source of the package that's currently installed, you'll need the output of dpkg -s <package>. Otherwise, you can simply look at the newest version output by apt-cache showpkg <package>.

Example:

mac9416@lizzy:~$ dpkg -s liferea
Package: liferea
Status: install ok installed
Priority: optional
Section: web
Installed-Size: 760
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Architecture: i386
Version: 1.6.2-1ubuntu6
...

mac9416@lizzy:~$ apt-cache showpkg liferea
Package: liferea
Versions: 
1.6.2-1ubuntu6.1 (/var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_lucid-updates_main_binary-i386_Packages)
 Description Language: 
                 File: /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_lucid-updates_main_binary-i386_Packages
                  MD5: 557b0b803b7ed864e6d14df4b02e3d26

1.6.2-1ubuntu6 (/var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_lucid_main_binary-i386_Packages) (/var/lib/dpkg/status)
 Description Language: 
                 File: /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_lucid_main_binary-i386_Packages
                  MD5: 557b0b803b7ed864e6d14df4b02e3d26
...

From the first command, I can see that Liferea version 1.6.2-1ubuntu6 is installed. From the second command, I can see that that version is listed in /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_lucid_main_binary-i386_Packages.

Without too much effort, I can deduce that the source line contains "archive.ubuntu.com", "ubuntu", "lucid", and "main".

And, sure enough, my /etc/apt/sources.list contains the following line.

deb http://archive.ubuntu.com/ubuntu lucid main universe restricted multiverse

share|improve this answer
    
mac, thanks for your detailed answer! Unfortunately it doesn't help me with my initial issue of an unmet dependency problem :-( I'm trying to install libqt4-opengl and it says: The following packages have unmet dependencies: libqt4-opengl: Depends: libqtcore4 (= 4:4.6.2-0ubuntu5.1) but 4:4.7.0~beta1+git20100522-0ubuntu1~lucid1~ppa1+appmenu20100624 is to be installed Depends: libqtgui4 (= 4:4.6.2-0ubuntu5.1) but 4:4.7.0~beta1+git20100522-0ubuntu1~lucid1~ppa1+appmenu20100624 is to be installed –  dfme Oct 20 '10 at 22:23
    
It's difficult to see from that just what the problem is. You should open a new question so you can provide full details. If you do, leave a link in a comment. :-) –  mac9416 Oct 21 '10 at 13:10
1  
apt-cache policy <package name> (from: superuser.com/a/236605/37279) –  franzlorenzon Aug 1 '13 at 14:47
sudo grep *packagename* /var/lib/apt/lists/* | grep "Filename:"

source

share|improve this answer

Use following command. It has better output:

apt-cache policy <Package Name>
share|improve this answer

Sadly, this information is not recorded during package installation. You can make a decent guess if the repository is still in the source list and the repository still has the package:

grep -l PKG /var/lib/apt/lists/*

Even synaptic cannot tell if you disable the repository and update.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.