Before I upgrade my Linux distribution, I would like to upgrade all my packages - however, I want to stick to my current MySQL version (5.6).

I know there's the option to hold the package, like this:

sudo aptitude hold package_name

When I run sudo apt-get upgrade, I have the following MySQL packages listed:

mysql-client-5.6 mysql-client-core-5.6 mysql-common mysql-common-5.6 mysql-server-5.6 mysql-server-core-5.6

Can I pass them all to the hold command as arguments? Or is there an easier way to block my MySQL from upgrading?

Note: I'm working in a VM, so no GUI I could use, just the terminal.


OK, I tried it and YES, you can pass all of the packages to the hold command, and they will be kept out of the upgrade.

I'm still not sure whether it's enough to hold only these packages in order to prevent MySQL upgrade (maybe other MySQL-specific packages should be held out as well?). For example, the command below, will hold lots of packages with "mysql" in the name, and I have no idea whether they're relevant or not:

sudo aptitude mysql-*
  • Which linux distribution are you using?
    – Anwar
    Apr 27, 2017 at 16:13
  • Ubuntu 14.04.2 LTS
    – lesssugar
    Apr 27, 2017 at 16:15

1 Answer 1


Looks like you figured out the answer already. However you asked another with the edit.

I'm still not sure whether it's enough to hold only these packages in order to prevent MySQL upgrade (maybe other MySQL-specific packages should be held out as well?).

The answer is No. You don't need to hold every packages, given you hold the core package upon which other package depends. For example, mysql-server, mysql-client packages depends on mysql-common (as far as I know) so, only holding this package is sufficient.

And aptitude is more intelligent than apt generally and it should understand what you wanted by the hold.

Updated with verification

To verify the answer, I actually ran a test with libgtk-3-0 package which is the core package for almost all gtk-3 application. I had the version of 3.18 something. Then I enabled a repository which offers version 3.20. nautilus depends on this package and the repo also offers higher version of nautilus.

When tried with aptitude upgrade -s (-s for simulation), it lists the packages it was going to update. nautilus wasn't there, because libgtk-3-0 wasn't going to be updated which was required by new version.

Another option is pinning packages by creating files in /etc/apt/preferences.d directory which offers more options and flexibility. It's not needed in your simple case, but doesn't hurt knowing :) Apt Pinning Howto

  • That's perfect. And makes sense. I will let you guys know here in the post if anything goes south. Thanks.
    – lesssugar
    Apr 27, 2017 at 16:19
  • @lesssugar Nice! I hope your upgrade goes smooth. Waiting to hear updates :)
    – Anwar
    Apr 27, 2017 at 16:20
  • @lesssugar You can also try to pin packages. Just tested with pinning libgtk-3-0 package which is a core gtk package upon which relies many application. With a simulated aptitude upgrade, I didn't find nautilus on the upgradable list there, though I had higher version in the repo already. Because that higher version needs higher version of libgtk-3-0 which is pinned!
    – Anwar
    Apr 27, 2017 at 16:29

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.