I am using the Apt module (https://forge.puppetlabs.com/puppetlabs/apt) and have added an entry for the Debian wheezy backports repository:

apt::source { 'wheezy-backports':
    location    => 'http://ftp.de.debian.org/debian',
    release     => 'wheezy-backports',
    repos       => 'main',
    include_deb => true,
    include_src => true,
    notify      => Exec['apt-get-update'],

I can successfully install packages that are available in wheezy-backports but not in the default repository, so I think that the configuration itself is correct. Manually installing from backports using apt-get install git -t wheezy-backports works too.

But how do I force Puppet to retrieve a package from wheezy-backports instead of the default repository? Specifically, I want to install git-1.9.1-1 which is in wheezy backports but

package { "git": ensure => "1:1.9.1-1~bpo70+2", }


package { "git": ensure => "latest", }

will only install the latest version from the default repository but not the newer backport version.

Please advise how to force Puppet to retrieve a specific package from the wheezy-backports repository.

1 Answer 1


From the Debian backports documentation, you need to manually specify the repository when you install via the CLI, because backported packages are pinned with a higher priority than default packages.

As per this ServerFault answer, you will need to pin either the entire repository or individual packages to use backports.

With the Puppetlabs apt module, you can do this do this using the apt::backports class, which will both add the backports repository and drop a pin file:

class { 'apt::backports':
  location => 'http://ftp.de.debian.org/debian',
  release  => 'wheezy-backports',
  repos    => 'main',
  pin      => 500,

If you don't want to pin the entire repository, you can pin individual packages using apt::pin (the below is an example, you may need to tweak it):

apt::pin { 'backports_git':
  packages => 'git',
  priority => 500,
  release  => 'main',

More documentation is here: https://forge.puppetlabs.com/puppetlabs/apt#pin-a-specific-release

  • 1
    To make it work I had to change 'main' to the backports release (here 'wheezy-backports') in the apt::pin resource Mar 1, 2017 at 9:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .