18

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

puppet-server-2.7.19-1
puppet-2.7.19-1

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?

2
  • 2
    sudo apt-mark hold <package name> works for me (it holds the package at the current version) May 27, 2017 at 9:28
  • Simplest answer is the one in Janakas comment.
    – herm
    Jan 12, 2021 at 16:30

2 Answers 2

27

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
  • Note if there is no star at the end of the pin version, it will go for latest! . Or you have to find the exact ubuntu numenclature, something like 2.7.1-00.
    – NicoKowe
    Aug 31, 2022 at 13:51
6

You can try this:

aptitude hold puppet-server puppet
echo "puppet-server hold" | dpkg --set-selections
echo "puppet hold" | dpkg --set-selections
1
  • 2
    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, 2012 at 11:33

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