Tuesday, 3 September 2013

What apt doesn't infer by itself when using backports

On a debian squeeze host I had to upgrade a package that pulls more than 40 dependencies.
The target version was provided by squeeze-backports.
I got sure that squeeze-backports was somewhere in /etc/apt/sources.list.d/, and so available.
Then I specified the backports candidate version:

sudo apt-get install package=bpo_version

No cigar.
Two of the pulled packages didn't exist in squeeze.
But why was apt trying to get them from squeeze, and not from squeeze-backports, to which package=bpo_version belongs?

The thing is that apt has been designed to do that.
The solution is to indicate explicitely the target release with the -t option:

sudo apt-get -t squeeze-backports install package=bpo_version

and that works smoothly.

Problem solved then? Yes, unless you're using Puppet, which doesn't allow you to specify the target release.
After spending some time with apt pinning, I've decided to script the update as an Exec in a manifest:
 

exec {'install_from_backport':
         command => '/usr/bin/apt-get -t squeeze-backports install package',
}


 package { "package":
         ensure => "bpo_version",
         require => [Exec['apt-get update'], Exec['install_from_backport']],
 }


Hope this saves some time to the reader, but feel free to indicate what you would have done instead.

No comments:

Post a Comment