Basically, I want to schedule upgrading ~100 workstations regularly. I only really need specific packages upgraded automatically (the rest can be done manually as required) but because the machines have never been on a standard update cycle they all have different version and dependencies, I cannot just apt-get upgrade package-x package-y package-z.

I was thinking apt-get -y dist-upgrade as a cron job would work, but I am afraid of upgrading to broken versions of a few specific other packages (such as systemd). I could use apt-mark hold package-a to prevent it from being upgraded, but I was told dist-upgrade overrides all holding marks.

What is the best way to upgrade certain packages across multiple machines that have different dependencies, while avoiding upgrading certain other packages?


I don't think dist-upgrade overrides holds...

Anyway, to upgrade only packages you care about, install them:

apt-get install package-a package-b ...

This will upgrade the named packages to whatever is the candidate version given your settings (normally the latest version in your release), and any required dependencies as necessary. Despite the command's name it works for both installations and upgrades.

If you're tracking a stable release I wouldn't worry about ignoring updates though, you should just upgrade everything. unattended-upgrades is designed to take care of that for you (for security upgrades by default, but you can configure it to pull in stable updates automatically).


The apt-mark hold should prevent the needed package from being upgraded .

There are many ways to prevent some packages to be upgraded (2 examples):

1) Add the package to your /etc/apt/preferences with a pin priority <0 :

Package: package_name_here
Pin: release o=Debian
Pin-Priority: -1

2) Using Synaptic package manager , select the needed packages then from the menu option, choose Lock Version and save

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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