[Bug 1478849] [NEW] infinite loop in /usr/share/mysql/mysql-systemd-start causes non-interactive installations to fail/hang

2015-07-28 Thread Elias Probst
Public bug reported:

# lsb_release -rd
Description:Ubuntu 15.04
Release:15.04

# apt-cache policy mysql-server-5.6
mysql-server-5.6:
  Installed: 5.6.24-0ubuntu2
  Candidate: 5.6.24-0ubuntu2
  Version table:
 *** 5.6.24-0ubuntu2 0
500 http://archive.ubuntu.com/ubuntu/ vivid/main amd64 Packages
100 /var/lib/dpkg/status

# Problem description

When installing mysql-server-5.6 with DEBIAN_FRONTEND=noninteractive
(which is done e.g. by Puppet, SaltStack and other config management
tools), the installation will fail as not only files will be deployed to
the filesystem, but also an attempt to start the (unconfigured) service
is made.

Running the following command can be used to reproduce the issue on
Ubuntu 15.04 here:

DEBIAN_FRONTEND=noninteractive apt-get -q -y -o DPkg::Options::=--force-
confold -o DPkg::Options::=--force-confdef install mysql-server-5.6

The result is that the service start (run as StartExecPost=) hangs for
quite a while in the endless loop in /usr/share/mysql/mysql-systemd-
start:

pinger () {
  while /bin/true ; do
sleep 1
mysqladmin ping /dev/null 21  break
  done
}

After a while of nothing happening, systemd decides it had enough of it,
kills the script and reports a service startup failure.

The full output of 'apt-get install …' is pasted below:

Reading package lists...
Building dependency tree...
Reading state information...
The following extra packages will be installed:
  libaio1 libalgorithm-c3-perl libarchive-extract-perl libcgi-fast-perl 
libcgi-pm-perl libclass-c3-perl libclass-c3-xs-perl libcpan-meta-perl 
libdata-optlist-perl libdata-section-perl libdbd-mysql-perl libdbi-perl libedit2
  libfcgi-perl libgdbm3 libhtml-template-perl liblog-message-perl 
liblog-message-simple-perl libmodule-build-perl libmodule-pluggable-perl 
libmodule-signature-perl libmro-compat-perl libmysqlclient18 
libpackage-constants-perl
  libparams-util-perl libpod-latex-perl libpod-readme-perl 
libregexp-common-perl libsoftware-license-perl libsub-exporter-perl 
libsub-install-perl libterm-readkey-perl libterm-ui-perl libtext-soundex-perl
  libtext-template-perl libwrap0 mysql-client-5.6 mysql-client-core-5.6 
mysql-common mysql-server-core-5.6 perl perl-modules psmisc rename tcpd
Suggested packages:
  libclone-perl libmldbm-perl libnet-daemon-perl libsql-statement-perl 
libipc-sharedcache-perl mailx tinyca perl-doc libterm-readline-gnu-perl 
libterm-readline-perl-perl make libb-lint-perl libcpanplus-dist-build-perl
  libcpanplus-perl libfile-checktree-perl libobject-accessor-perl
Recommended packages:
  libarchive-tar-perl
The following NEW packages will be installed:
  libaio1 libalgorithm-c3-perl libarchive-extract-perl libcgi-fast-perl 
libcgi-pm-perl libclass-c3-perl libclass-c3-xs-perl libcpan-meta-perl 
libdata-optlist-perl libdata-section-perl libdbd-mysql-perl libdbi-perl libedit2
  libfcgi-perl libgdbm3 libhtml-template-perl liblog-message-perl 
liblog-message-simple-perl libmodule-build-perl libmodule-pluggable-perl 
libmodule-signature-perl libmro-compat-perl libmysqlclient18 
libpackage-constants-perl
  libparams-util-perl libpod-latex-perl libpod-readme-perl 
libregexp-common-perl libsoftware-license-perl libsub-exporter-perl 
libsub-install-perl libterm-readkey-perl libterm-ui-perl libtext-soundex-perl
  libtext-template-perl libwrap0 mysql-client-5.6 mysql-client-core-5.6 
mysql-common mysql-server-5.6 mysql-server-core-5.6 perl perl-modules psmisc 
rename tcpd
0 upgraded, 46 newly installed, 0 to remove and 0 not upgraded.
Need to get 28.1 MB of archives.
After this operation, 194 MB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu/ vivid/main libedit2 amd64 
3.1-20140620-2 [81.4 kB]
Get:2 http://archive.ubuntu.com/ubuntu/ vivid/main libgdbm3 amd64 1.8.3-13.1 
[16.9 kB]
Get:3 http://archive.ubuntu.com/ubuntu/ vivid/main libaio1 amd64 0.3.110-1 
[6454 B]
Get:4 http://archive.ubuntu.com/ubuntu/ vivid/main mysql-common all 
5.6.24-0ubuntu2 [15.8 kB]
Get:5 http://archive.ubuntu.com/ubuntu/ vivid/main libmysqlclient18 amd64 
5.6.24-0ubuntu2 [690 kB]
Get:6 http://archive.ubuntu.com/ubuntu/ vivid/main libwrap0 amd64 7.6.q-25 
[46.2 kB]
Get:7 http://archive.ubuntu.com/ubuntu/ vivid/main perl-modules all 5.20.2-2 
[2502 kB]
Get:8 http://archive.ubuntu.com/ubuntu/ vivid/main perl amd64 5.20.2-2 [2629 kB]
Get:9 http://archive.ubuntu.com/ubuntu/ vivid/main libdbi-perl amd64 
1.631-3build1 [770 kB]
Get:10 http://archive.ubuntu.com/ubuntu/ vivid/main libdbd-mysql-perl amd64 
4.028-2 [88.6 kB]
Get:11 http://archive.ubuntu.com/ubuntu/ vivid/main libterm-readkey-perl amd64 
2.32-1build1 [25.0 kB]
Get:12 http://archive.ubuntu.com/ubuntu/ vivid/main mysql-client-core-5.6 amd64 
5.6.24-0ubuntu2 [4248 kB]
Get:13 http://archive.ubuntu.com/ubuntu/ vivid/main mysql-client-5.6 amd64 
5.6.24-0ubuntu2 [5321 kB]
Get:14 http://archive.ubuntu.com/ubuntu/ vivid/main mysql-server-core-5.6 amd64 
5.6.24-0ubuntu2 [4583 kB]
Get:15 

[Bug 1478849] [NEW] infinite loop in /usr/share/mysql/mysql-systemd-start causes non-interactive installations to fail/hang

2015-07-28 Thread Elias Probst
Public bug reported:

# lsb_release -rd
Description:Ubuntu 15.04
Release:15.04

# apt-cache policy mysql-server-5.6
mysql-server-5.6:
  Installed: 5.6.24-0ubuntu2
  Candidate: 5.6.24-0ubuntu2
  Version table:
 *** 5.6.24-0ubuntu2 0
500 http://archive.ubuntu.com/ubuntu/ vivid/main amd64 Packages
100 /var/lib/dpkg/status

# Problem description

When installing mysql-server-5.6 with DEBIAN_FRONTEND=noninteractive
(which is done e.g. by Puppet, SaltStack and other config management
tools), the installation will fail as not only files will be deployed to
the filesystem, but also an attempt to start the (unconfigured) service
is made.

Running the following command can be used to reproduce the issue on
Ubuntu 15.04 here:

DEBIAN_FRONTEND=noninteractive apt-get -q -y -o DPkg::Options::=--force-
confold -o DPkg::Options::=--force-confdef install mysql-server-5.6

The result is that the service start (run as StartExecPost=) hangs for
quite a while in the endless loop in /usr/share/mysql/mysql-systemd-
start:

pinger () {
  while /bin/true ; do
sleep 1
mysqladmin ping /dev/null 21  break
  done
}

After a while of nothing happening, systemd decides it had enough of it,
kills the script and reports a service startup failure.

The full output of 'apt-get install …' is pasted below:

Reading package lists...
Building dependency tree...
Reading state information...
The following extra packages will be installed:
  libaio1 libalgorithm-c3-perl libarchive-extract-perl libcgi-fast-perl 
libcgi-pm-perl libclass-c3-perl libclass-c3-xs-perl libcpan-meta-perl 
libdata-optlist-perl libdata-section-perl libdbd-mysql-perl libdbi-perl libedit2
  libfcgi-perl libgdbm3 libhtml-template-perl liblog-message-perl 
liblog-message-simple-perl libmodule-build-perl libmodule-pluggable-perl 
libmodule-signature-perl libmro-compat-perl libmysqlclient18 
libpackage-constants-perl
  libparams-util-perl libpod-latex-perl libpod-readme-perl 
libregexp-common-perl libsoftware-license-perl libsub-exporter-perl 
libsub-install-perl libterm-readkey-perl libterm-ui-perl libtext-soundex-perl
  libtext-template-perl libwrap0 mysql-client-5.6 mysql-client-core-5.6 
mysql-common mysql-server-core-5.6 perl perl-modules psmisc rename tcpd
Suggested packages:
  libclone-perl libmldbm-perl libnet-daemon-perl libsql-statement-perl 
libipc-sharedcache-perl mailx tinyca perl-doc libterm-readline-gnu-perl 
libterm-readline-perl-perl make libb-lint-perl libcpanplus-dist-build-perl
  libcpanplus-perl libfile-checktree-perl libobject-accessor-perl
Recommended packages:
  libarchive-tar-perl
The following NEW packages will be installed:
  libaio1 libalgorithm-c3-perl libarchive-extract-perl libcgi-fast-perl 
libcgi-pm-perl libclass-c3-perl libclass-c3-xs-perl libcpan-meta-perl 
libdata-optlist-perl libdata-section-perl libdbd-mysql-perl libdbi-perl libedit2
  libfcgi-perl libgdbm3 libhtml-template-perl liblog-message-perl 
liblog-message-simple-perl libmodule-build-perl libmodule-pluggable-perl 
libmodule-signature-perl libmro-compat-perl libmysqlclient18 
libpackage-constants-perl
  libparams-util-perl libpod-latex-perl libpod-readme-perl 
libregexp-common-perl libsoftware-license-perl libsub-exporter-perl 
libsub-install-perl libterm-readkey-perl libterm-ui-perl libtext-soundex-perl
  libtext-template-perl libwrap0 mysql-client-5.6 mysql-client-core-5.6 
mysql-common mysql-server-5.6 mysql-server-core-5.6 perl perl-modules psmisc 
rename tcpd
0 upgraded, 46 newly installed, 0 to remove and 0 not upgraded.
Need to get 28.1 MB of archives.
After this operation, 194 MB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu/ vivid/main libedit2 amd64 
3.1-20140620-2 [81.4 kB]
Get:2 http://archive.ubuntu.com/ubuntu/ vivid/main libgdbm3 amd64 1.8.3-13.1 
[16.9 kB]
Get:3 http://archive.ubuntu.com/ubuntu/ vivid/main libaio1 amd64 0.3.110-1 
[6454 B]
Get:4 http://archive.ubuntu.com/ubuntu/ vivid/main mysql-common all 
5.6.24-0ubuntu2 [15.8 kB]
Get:5 http://archive.ubuntu.com/ubuntu/ vivid/main libmysqlclient18 amd64 
5.6.24-0ubuntu2 [690 kB]
Get:6 http://archive.ubuntu.com/ubuntu/ vivid/main libwrap0 amd64 7.6.q-25 
[46.2 kB]
Get:7 http://archive.ubuntu.com/ubuntu/ vivid/main perl-modules all 5.20.2-2 
[2502 kB]
Get:8 http://archive.ubuntu.com/ubuntu/ vivid/main perl amd64 5.20.2-2 [2629 kB]
Get:9 http://archive.ubuntu.com/ubuntu/ vivid/main libdbi-perl amd64 
1.631-3build1 [770 kB]
Get:10 http://archive.ubuntu.com/ubuntu/ vivid/main libdbd-mysql-perl amd64 
4.028-2 [88.6 kB]
Get:11 http://archive.ubuntu.com/ubuntu/ vivid/main libterm-readkey-perl amd64 
2.32-1build1 [25.0 kB]
Get:12 http://archive.ubuntu.com/ubuntu/ vivid/main mysql-client-core-5.6 amd64 
5.6.24-0ubuntu2 [4248 kB]
Get:13 http://archive.ubuntu.com/ubuntu/ vivid/main mysql-client-5.6 amd64 
5.6.24-0ubuntu2 [5321 kB]
Get:14 http://archive.ubuntu.com/ubuntu/ vivid/main mysql-server-core-5.6 amd64 
5.6.24-0ubuntu2 [4583 kB]
Get:15