2

I ran into an odd situation where installing a package via apt-get caused running (production!) instances of mysqld to restart on some 16.04 Linux servers.

We ran sudo apt-get install -y iotop on four servers. On three of the servers the installation failed stating [ERROR] unknown variable 'rpl_semi_sync_slave_enabled=1'. This variable was only set on these three servers. At this point the mysql service we were running shut down!

The fourth server did not have an identical mysql configuration. Notably, the variable rpl_semi_sync_slave_enabled was not present. Apt was able to install iotop but interestingly our mysql service did not restart or shut down.

So it seems that some packages, on failing to install, will kill running processes that seem tangential to the installation! This has me very wary about installing further packages on our production servers running processes that we don't like to restart whenever. How can I know whether a package install will restart these processes and why is it happening in the first place?

5

It's very unlikely that packages failing to install kills anything afterwards or because of failure – related or not. Furthermore, the [ERROR] unknown variable 'rpl_semi_sync_slave_enabled = 1; doesn't seem like an error of apt, but of MySQL, during its startup.

It's perfectly possible that MySQL was restarted on all the servers, but only failed to start on one, causing the installation to fail – not vice versa.

Why would installing iotop cause MySQL to restart? In distributions (like your Ubuntu) we have this thing called dependency tree: packages can depend on other packages that depends on other packages, that can be mutually needed by yet other packages. Sometimes a package depends on certain version of another package, causing already installed package to be upgraded when installed.

In this case, iotop depends on python. Then, e.g. python-mysqldb depends on python and libmysqlclient18 that depends on mysql-common... you probably got the picture why MySQL may have been upgraded alongside seemingly unrelated iotop.

How to know which packages gets installed and upgraded during apt-get install?

-y, --yes, --assume-yes

Automatic yes to prompts. Assume yes as answer to all prompts and run non-interactively. If an undesirable situation, such as changing a held package or removing an essential package, occurs then apt-get will abort.

Do not use -y if you aren't absolutely sure what will happen. By default you will get a list of all packages that gets installed, upgraded or even removed. You voluntarily choose to ignore this all.

  • 1
    This is correct in so many ways. It is/was a known MySQL bug, turns out. Dependencies were indeed causing the upgrade/restart partly due to a weird half-installed state of a newer version that's beyond the scope of this question. And I very much agree with the -y advice. Thank you. – BlackVegetable May 22 '17 at 20:03
  • 1
    This is why you don't let the package manager touch your MySQL Server. Install it from the tarballs. Your database is too important to trust anybody, including the package maintainers, to mess with its installation or upgrades. – Michael - sqlbot May 23 '17 at 2:35

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.