Ubuntu: Upgrade all packages except MySQL, via aptitude



Question:

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.

Update

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-*  


Solution: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


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »