mysql-server-5.7.postinst is influenced by $HOME, causing installation hangs

Bug #1567695 reported by Robie Basak on 2016-04-07
This bug affects 1 person
Affects Status Importance Assigned to Milestone
mysql-5.7 (Ubuntu)

Bug Description

Related bug: bug 1567696. This bug is to track that we are influenced by $HOME, not specifically .my.cnf.

mysql-server-5.7 version: 5.7.11-0ubuntu4

Steps to reproduce:

As normal user:

cat > ~/.my.cnf <<EOT
user = root
password = foo

sudo apt-get install -y mysql-server-5.7

Every time (three times) it prompts for a root password, just press Enter (ie. set a blank password).

Expected behaviour: apt-get finishes.

Actual behaviour:

mysql-server-5.7.postinst hangs on:

update-alternatives: using /etc/mysql/mysql.cnf to provide /etc/mysql/my.cnf (my.cnf) in auto mode

/var/log/mysql/error.log reports:

2016-04-07T23:12:37.299093Z 0 [Note] Execution of init_file '/var/lib/mysql-files/tmp.LTuPIaNrV0' started.
2016-04-07T23:12:37.299499Z 1 [ERROR] 1524 Plugin 'auth_socket' is not loaded
2016-04-07T23:12:37.299577Z 0 [Note] Execution of init_file '/var/lib/mysql-files/tmp.LTuPIaNrV0' ended.
2016-04-07T23:12:37.299631Z 0 [Note] mysqld: ready for connections.
Version: '5.7.11-0ubuntu5' socket: '/tmp/tmp.FFBBqKBiRF/mysqld.sock' port: 3306 (Ubuntu)


unset HOME in the postinst fixes it.


There may be a second bug here, which is that the postinst is influenced by a ~/.my.cnf. What happens if ~root/.my.cnf does something similar?

Robie Basak (racb) on 2016-04-07
tags: added: mysql-5.7-transition
Changed in mysql-5.7 (Ubuntu):
milestone: none → ubuntu-16.04
description: updated
Lars Tangvald (lars-tangvald) wrote :

Adding the --no-defaults option seems to fix this, but there are cases where it will read custom configs even with that option:
so this may not fully fix the issue.

Lars Tangvald (lars-tangvald) wrote :

I couldn't replicate the issue with mysqld, but we might consider also setting --no-defaults for usages of it.
This also doesn't affect commands that specify --defaults-file such as when running mysql_upgrade, so should only be the single lise we need to change.

The attachment "0001-Client-commands-in-postinst-should-ignore-custom-con.patch" seems to be a debdiff. The ubuntu-sponsors team has been subscribed to the bug report so that they can review and hopefully sponsor the debdiff. If the attachment isn't a patch, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are member of the ~ubuntu-sponsors, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issue please contact him.]

tags: added: patch
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package mysql-5.7 - 5.7.11-0ubuntu6

mysql-5.7 (5.7.11-0ubuntu6) xenial; urgency=medium

  [ Lars Tangvald ]
  * Added patch for exporting my_make_scrambled_password to fix
    pure-ftpd FTBFS.
  * Client commands in d/postinst will ignore custom config (LP:
  * Enable changing root password on install if previous db had empty
    (LP: #1567098)

  [ Robie Basak ]
  * d/mysql-server-5.7.postinst: quote "$rootpw" correctly.
  * d/control: add libnuma-dev and libaio-dev to libmysqld-dev
    dependencies, since these are required according to "mysql_config
    --libmysqld-libs". This fixes FTBFS of packages that use

 -- Robie Basak <email address hidden> Wed, 13 Apr 2016 17:34:08 +0100

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

Other bug subscribers