Saturday, September 24, 2016

apt - How do I find out which repository a package comes from?


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



Commands Needed:



  • dpkg -s - allows you to
    find the version of that
    you have installed. (source)

  • apt-cache showpkg - 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 . Otherwise, you can simply look at the newest version output by apt-cache showpkg .


Example:


$ 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
...
$ 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

No comments:

Post a Comment

11.10 - Can't boot from USB after installing Ubuntu

I bought a Samsung series 5 notebook and a very strange thing happened: I installed Ubuntu 11.10 from a usb pen drive but when I restarted (...