Recently I encountered a package issue in Bacula-server package on FreeBSD 10. The package from pkg system was compiled to use Postgresql while I still use mysqld (I know, I know, I should migrate to pgsql or at least MariaDB). Of course I can recompile it with the necessary flags using the ports system, but out of curiosity I decided to see if there is a way to avoid updating the package using pkg for the time being. I don't recommend not applying patches to your system but in some use cases it is necessary to stop a package from breaking your 'pkg upgrade' command or to freeze it at a certain version.

Turns out there is a 'lock' feature in pkg that lets you lock a package in certain state to stop pkg from modifying or updating it. To lock a package run:

sudo pkg lock <package name>

To unlock a package, run the following:

sudo pkg unlock <package name>

That's all there is to it. When a package is locked, you can safely upgrade your system except for that one package.


comments powered by Disqus