In many cases, you may need to preserve the current version of a package in Debian or Ubuntu Linux. For example, your production environment may use an older version of a package and, in your development environment (perhaps on a Vagrant virtual machine), you want to make sure you use the same version. The apt package manager provides functionality to “lock” (or, as it’s called in Debian/Ubuntu, to “hold”) the version of a package. The command is simple:

sudo apt-mark hold package_name

where package_name is the name of the package, such as grub-pc. You can include multiple package names on the command line by separating each with a space.