Sign up ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

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

share|improve this question

5 Answers 5

up vote 23 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>.


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

mac9416@lizzy:~$ apt-cache showpkg liferea
Package: liferea
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 "", "ubuntu", "lucid", and "main".

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

deb 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
apt-cache policy <package name> (from: – franzlorenzon Aug 1 '13 at 14:47
Do apt-cache {showpkg,policy} actually show where an installed package was installed from, or just where it would be installed from at the time it is queried? – Croad Langshan Feb 21 at 11:36
The latter. If I generally use Ubuntu trusty package sources, then temporarily add utopic to my sources.list in order to install version 1.20ubuntu3 of init-system-helpers and then remove the repo again from my sources.list, apt-cache showpkg init-system-helpers will just lie about the original package list and apt-cache policy init-system-helpers will just state the obvious. – blubberdiblub Jul 4 at 1:22

Use following command. It has better output:

apt-cache policy <Package Name>
share|improve this answer
This is the correct answer! The commands in the answer by mac9416 need tedious interpretation + guessing based on their output. For more information about apt-cache policy see also – pabouk Nov 23 at 9:45
sudo grep *packagename* /var/lib/apt/lists/* | grep "Filename:"


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

This is a little more accurate:

apt-cache show <packagename> | grep "Version:"

The newest version will typically be installed unless you have set apt-pinning or explicitly install a particular version.

share|improve this answer

Your Answer


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.