I'm trying to figure out why a package was not upgraded unattended, and I have turned my eyes to the Allowed-Origins configuration. However, I do not know how to check the origin and archive of packages in the apt cache. How do I do so?

link|improve this question

71% accept rate
feedback

2 Answers

Ok, I found a way that's enough for my immediate purpose, even though it isn't general enough. I'll leave the answer here, but I will not accept it.

When running unattended-upgrade -d, it will log information about the packages with upgrades available. This information contains origin and archive. For example:

2010-10-27 13:21:28,734 DEBUG Checking: postgresql-8.4 (["component: 'main' archive: 'lenny-backports' origin: 'Debian Backports' label: 'Debian Backports' site 'backports.debian.org' isTrusted: 'True'"])

The script unattended-upgrade itself is Python, and uses python-apt, an interface to libapt-pkg, to get that information.

link|improve this answer
feedback

The following command lists all the versions of a given package available from all sources configured in your sources.list:

apt-cache policy <packagename>

EDIT

Here is sample output from a system with multiple sources in sources.list.

# apt-cache policy nano
nano:
  Installed: 2.0.7-5
  Candidate: 2.2.5-1
  Version table:
     2.2.5-1 0
        500 http://mirrors.kernel.org sid/main Packages
     2.2.4-1 0
        500 http://mirrors.kernel.org squeeze/main Packages
 *** 2.0.7-5 0
        500 http://mirrors.kernel.org lenny/main Packages
        100 /var/lib/dpkg/status

The version table shows the available package versions, priorities, archive URLs, and suites.

link|improve this answer
Version is neither origin nor archive, so why would I care? – Daniel C. Sobral Oct 27 '10 at 15:22
The information shown does not contain origin (either release or actual origin), nor archive. Type, for instance apt-cache policy, and try to find lenny/main or squeeze/main. Instead, you'll see o=Debian,a=testing or o=Debian,a=stable, which is what actually matters when defining pin or using unattended-upgrade. – Daniel C. Sobral Oct 27 '10 at 18:02
As an addendum, you can get the archive and version by cross-referencing the output of apt-cache policy and apt-cache policy package. – Daniel C. Sobral Oct 27 '10 at 18:04
feedback

Your Answer

 
or
required, but never shown

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