Keep a specific debian package version

Posted on Friday 20 June 2008

In Debian / Ubuntu, sometimes you want to keep a package at a specific version, and not upgrade it. For instance, the Perl module DateTime::Timezone in Ubuntu Dapper lists its version as 1:0.37-1, when the version is actually 0.37. This makes it difficult if I build a new package of the perl module at version 0.7701, because though I can force install that version, if I run an apt-get upgrade later, it’s going to install the former, because it sees it as version 1, which is greater than 0.77.

Fortunately, the fix is easy: put the package on hold. This prevents it from being upgraded, though that also means you won’t get updates to it from the main repositories. If you built it yourself, then that might not be such a bad thing. To put a package on hold, you do:


echo packagename hold | sudo dpkg --set-selections

Replace packagename above with the name of your package (for instance, I would put libdatetime-timezone-perl). Did it work? Let’s see!


$ sudo apt-get upgrade
Reading package lists... Done
Building dependency tree... Done
The following packages have been kept back:
libdatetime-timezone-perl
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
$

Looks good to me!

Reference

2 Comments for 'Keep a specific debian package version'

  1.  
    name
    June 22, 2008 | 6:25 am
     

    Another solution (I prefer it on my debian computers) is a apt-pining…

  2.  
    ebzao
    June 22, 2008 | 6:53 am
     

    Or you can also just type easily:
    aptitude hold packagename
    (and aptitude unhold packagename to release the hold on your package).

Leave a comment

(required)

(required)


Information for comment users
Line and paragraph breaks are implemented automatically. Your e-mail address is never displayed. Please consider what you're posting.

Use the buttons below to customise your comment.


RSS feed for comments on this post | TrackBack URI