So, doing an
apt-get upgrade on a Debian or Ubuntu machine sometimes
does more than you want at once.
See this upgrade example I encountered just now:
# apt-get upgrade ... The following packages will be upgraded: curl dpkg ifupdown iproute libcurl3 libcurl3-gnutls libgnutls26 libmysqlclient18 libsnmp-base libsnmp15 libssl1.0.0 libxml2 linux-firmware linux-generic-lts-quantal mysql-client-5.5 mysql-client-core-5.5 mysql-common mysql-server mysql-server-5.5 mysql-server-core-5.5 openssh-client openssh-server openssl tzdata update-manager-core whoopsie 26 upgraded, 0 newly installed, 0 to remove and 2 not upgraded. Need to get 63.0 MB/63.0 MB of archives.
I do want to upgrade the mysql, but I don't want to combine that with the other upgrades. Why? Because of the install cycle:
During the prepare cycle, some daemons are stopped and they are first started during the setup cycle. That means that the mysql server may be down for a longer period of time than necessary.
To mitigate that, we can attempt to upgrade only the mysql-server package:
# apt-get install mysql-server ... The following packages will be upgraded: mysql-server
However, that includes only the mysql-server package and not the related packages (libs, core, mysql-client). That would be a bad idea.
So, how do we force it to install only mysql-server and the related packages?
Here, aptitude comes to the rescue:
# echo `aptitude search -F%p '?reverse-depends(mysql-server) ?installed'` adduser debconf libc6 libdbi-perl libstdc++6 libwrap0 lsb-base mysql-client-5.5 mysql-common mysql-server-5.5 mysql-server-core-5.5 passwd perl psmisc upstart zlib1g
Or, better yet:
# echo `aptitude search -F%p '?reverse-depends(mysql-server) ?upgradable'` mysql-client-5.5 mysql-common mysql-server-5.5 mysql-server-core-5.5
That's a much nicer list. Fire away:
# aptitude install '?reverse-depends(mysql-server) ?upgradable' The following packages will be upgraded: mysql-client-5.5 mysql-common mysql-server mysql-server-5.5 mysql-server-core-5.5 5 packages upgraded, 0 newly installed, 0 to remove and 23 not upgraded. ...