I occasionally need to make minor source modifications to standard Ubuntu packages for use on a collection of servers that I manage. I would like to publish these on a PPA (such as launchpad.net) so that I can install and keep them up to date through all of the usual mechanisms (unattended-upgrades, e.g.). What is the proper way to guarantee that a given package on my PPA will supersede any official release? This does not appear to be a job for holding or pinning, as I essentially want to branch the release sequence, not include or exclude specific versions. With my limited knowledge, I can speculate on a few possible directions.

  1. The most correct option would be to somehow instruct apt to ignore a particular package in the official repositories, as if it never existed. I haven't found this kind of fine-grained control in apt.

  2. Option two is to manipulate the version number such that my package is guaranteed to have a higher version than any official release. Would this be possible--at least with a very high probability--by abusing the epoch component of the version number? And how much private shame would I have to endure?

  3. The least appealing option is to rename existing packages with a private suffix (libfoo-mycompany) to make them completely independent. Due to the strong naming conventions used by the Debian package manager, this can be a trying exercise for non-trivial packages. This is what I'm trying to avoid.

  4. Option four is the obvious solution that I completely overlooked, even after hours of searching through documentation, and which someone here is dying to point out.



Apt pinning should actually be what you want; you'll just need to set the priority over a thousand in order for your versions to always take precedence, even over a higher version numbered package from the main repo.

Put this in /etc/apt/preferences. If you host your own repo built with something like reprepro, then you can target your hostname:

Package: *
Pin: origin your.repo.hostname
Pin-Priority: 1001

Or with a Launchpad PPA, you can target the release properties:

Package: *
Pin: release o=LP-PPA-your-ppa-name
Pin-Priority: 1001
  • 4 it is. Somehow all of the descriptions of pinning left me with the impression that it was only for official repositories (stable/unstable, etc.). Thanks for setting me straight. – psagers Feb 3 '12 at 1:52

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.