2

I have a python script running on Ubuntu. Script gets all installed apt packages with

apt_cache = apt.cache.Cache()

I want to get repository names of each installed package. While I expect to see xenial/main, xenial/universe, xenial-updates/main etc. some of the packages have now/now for repository name.

('linux-headers-generic', [<Origin component:'now' archive:'now' origin:'' label:'' site:'' isTrusted:False>])

Most other packages are like:

('zip', [<Origin component:'main' archive:'xenial' origin:'Ubuntu' label:'Ubuntu' site:'de.archive.ubuntu.com' isTrusted:True>, <Origin component:'now' archive:'now' origin:'' label:'' site:'' isTrusted:False>])

What is the meaining of now here?

0

Poking around the source code, the values become now when the version is from the dpkg status file, which does not include where the package originally came from. Thus, you will see a version with archive now for any package that is currently installed. You can also see this in the output of apt-cache policy:

$ apt-cache policy
Package files:
 100 /var/lib/dpkg/status
     release a=now
...

For example:

$  apt-cache policy apt
apt:
  Installed: 1.2.25
  Candidate: 1.2.25
  Version table:
 *** 1.2.25 500
        500 http://jp.archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages
        100 /var/lib/dpkg/status

And the installed version will have these origins in the API:

<Origin component:'main' archive:'xenial-updates' origin:'Ubuntu' label:'Ubuntu' site:'jp.archive.ubuntu.com' isTrusted:True>
<Origin component:'now' archive:'now' origin:'' label:'' site:'' isTrusted:False>

However, if you get a version with now as the only origin, that means apt could not locate it in any source. This could happen for:

  • an installed version that is no longer in any source (time to update!)
  • a package installed using a deb file, with no corresponding package in the repositories
  • a package installed from a source that was subsequently disabled

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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