If apt-get upgrade is run on mysql server when the server is disabled, the upgrade fails.

Bug #1745185 reported by Don C Stokes
18
This bug affects 3 people
Affects Status Importance Assigned to Milestone
mysql-5.7 (Ubuntu)
Invalid
Undecided
Unassigned
Xenial
Won't Fix
Medium
Unassigned

Bug Description

Since I only use the mysql server for development, I tend to keep the server disabled with systemctl. If mysql server is upgraded while the service is disabled, apt-get fails. To remedy this, I must run "systemctl enable mysqld" before "apt-get upgrade". Since I found a work around, it isn't a big deal, but a less experienced user may have trouble diagnosing this. Possible solutions are:
1) Better error message
2) If the server must be running for upgrade, the upgrade could start it. Maybe prompting first.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in mysql-5.5 (Ubuntu):
status: New → Confirmed
Revision history for this message
Anders Hall (a.hall) wrote :

This occurs with all mysql versions when upgrading, also on cloud instances. Can confirm that the solution works for mysql 5.6 and 5.7 as well. Other affected users discussing the solution can be found here: https://askubuntu.com/a/762775/762848

Joshua Powers (powersj)
Changed in mysql-5.5 (Ubuntu):
importance: Undecided → High
Revision history for this message
Andreas Hasenack (ahasenack) wrote :

This is what I used to test:
- disable updates and security in /etc/apt/sources.list
- install mysql-server-5.7 (or whatever version is shipped in that release of ubuntu)
- use mysql command line to connect and create a test database
- stop mysql: sudo systemctl stop mysql
- disable mysql: sudo systemctl disable mysql
- re-enable updates and security in sources.list
- apt dist-upgrade

In bionic, the above worked. During the pkg upgrade, mysql was started up a few times, but at the end of the dist-upgrade command mysql was stopped and no errors were reported.

In xenial, it failed:
Setting up mysql-server-5.7 (5.7.24-0ubuntu0.16.04.1) ...
Installing new version of config file /etc/mysql/debian-start ...
Renaming removed key_buffer and myisam-recover options (if present)
insserv: warning: current start runlevel(s) (empty) of script `mysql' overrides LSB defaults (2 3 4 5).
insserv: warning: current stop runlevel(s) (0 1 2 3 4 5 6) of script `mysql' overrides LSB defaults (0 1 6).
mysql_upgrade: Got error: 2002: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) while connecting to the MySQL server
Upgrade process encountered error and will not continue.
mysql_upgrade failed with exit status 11
dpkg: error processing package mysql-server-5.7 (--configure):
 subprocess installed post-installation script returned error exit status 1
Setting up distro-info-data (0.28ubuntu0.9) ...
Setting up libcurl3-gnutls:amd64 (7.47.0-1ubuntu2.11) ...
Setting up curl (7.47.0-1ubuntu2.11) ...
Processing triggers for libc-bin (2.23-0ubuntu10) ...
Errors were encountered while processing:
 mysql-server-5.7
E: Sub-process /usr/bin/dpkg returned an error code (1)

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Trusty doesn't have systemd, but upstart. There the steps were:
- disable updates and security in /etc/apt/sources.list
- install mysql-server-5.5
- use mysql command line to connect and create a test database
- stop mysql: stop mysql
- disable mysql: echo manual | sudo tee /etc/init/mysql.override
- reboot to confirm mysql won't start automatically (yes)
- re-enable updates and security in sources.list
- apt dist-upgrade

It worked just fine.

For now, this bug is confirmed in xenial only.

affects: mysql-5.5 (Ubuntu) → mysql-5.7 (Ubuntu)
Changed in mysql-5.7 (Ubuntu):
status: Confirmed → Invalid
Revision history for this message
Robie Basak (racb) wrote :

The Xenial failure sounds very much like bug 1592669, which looks like it was fixed post-Xenial and hasn't had a fix backported (it's somewhat invasive but probably SRU-able if done with care).

Revision history for this message
Robie Basak (racb) wrote :

https://salsa.debian.org/mariadb-team/mysql/commit/7fae702b6c3b6347008ec9b73a92cba6804111bc is a possible fix but I think there might be other commits needed as well.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in mysql-5.7 (Ubuntu Xenial):
status: New → Confirmed
Changed in mysql-5.7 (Ubuntu):
importance: High → Undecided
Changed in mysql-5.7 (Ubuntu Xenial):
importance: Undecided → Medium
Paride Legovini (paride)
Changed in mysql-5.7 (Ubuntu Xenial):
status: Confirmed → Triaged
Revision history for this message
Sergio Durigan Junior (sergiodj) wrote :

Xenial has reached its end of standard support.

Changed in mysql-5.7 (Ubuntu Xenial):
status: Triaged → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.