This question already has an answer here:

On CentOS exists the yum versionlock option, where you can lock a package to a specific version, so it is never upgraded past that.

I would like that


stays on 2.7, and never upgraded to 3.0. Puppet Labs have released 3.0 and put it into the stable repo, so 2.7 will get upgraded to 3.0, which is not backwards compatible.

Does Ubuntu have something similar to yum versionlock?

marked as duplicate by Magellan, Tim Brigham, Falcon Momot, dawud, Jenny D Oct 10 '13 at 12:55

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    sudo apt-mark hold <package name> works for me (it holds the package at the current version) – Janaka Bandara May 27 '17 at 9:28

You can create a file in /etc/apt/preferences and pin packages' version.

The format for the file would be somewhat like this:

Package: puppet-server
Pin: version 2.7*
Pin-Priority: 550

See also:

  • 1
    The Pin: 2.7* line should read Pin: version 2.7* – Choffee Nov 26 '12 at 11:41

You can try this:

aptitude hold puppet-server puppet
echo "puppet-server hold" | dpkg --set-selections
echo "puppet hold" | dpkg --set-selections
  • 1
    hold will keep the package at the current version, and not let it upgrade any further. I would like it to upgrade to any 2.7.x but not 3.x.x – Sandra Oct 5 '12 at 11:33

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