[Bug 1752705] Re: When run from systemd-nspawn, installation of mysql-server fails because postinst fails to shut down server

Matt Coleman mcoleman at datto.com
Fri Mar 2 15:25:46 UTC 2018


It behaves differently (the installation succeeds) if you install mysql-
server from a bash prompt inside the container. Running the installation
as a parameter to `systemd-nspawn` will fail. I have tested this on a
16.04.3 system and an 18.04 system.

I just noticed something especially weird: if I add `dpkg --configure
-a` to the end of the `systemd-nspawn` command, then the `apt install`
command will reliably finish.

Prepare a base container to be used for the tests:
1. debootstrap bionic bionic
2. rm bionic/etc/resolv.conf

This will always fail:
sudo rm -rf testmysql && sudo cp -a bionic testmysql && sudo systemd-nspawn -D testmysql bash -c 'apt update && apt install mysql-server'

This will always succeed:
sudo rm -rf testmysql && sudo cp -a bionic testmysql && sudo systemd-nspawn -D testmysql bash -c 'apt update && apt install mysql-server; dpkg --configure -a'

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to systemd in Ubuntu.
https://bugs.launchpad.net/bugs/1752705

Title:
  When run from systemd-nspawn, installation of mysql-server fails
  because postinst fails to shut down server

Status in mysql-5.7 package in Ubuntu:
  New
Status in systemd package in Ubuntu:
  New

Bug description:
  Creating a fresh Bionic directory with `debootstrap` and then
  attempting to install `mysql-server` inside a `systemd-nspawn`
  container fails with the following message:

  Setting up mysql-server-5.7 (5.7.21-1ubuntu1) ...
  invoke-rc.d: could not determine current runlevel
   * Stopping MySQL database server mysqld                                 [ OK ]
  update-alternatives: using /etc/mysql/mysql.cnf to provide /etc/mysql/my.cnf (my.cnf) in auto mode
  Renaming removed key_buffer and myisam-recover options (if present)
  Error: Unable to shut down server with process id 532
  dpkg: error processing package mysql-server-5.7 (--configure):
   installed mysql-server-5.7 package post-installation script subprocess returned error exit status 1

  
  Steps to reproduce:
  1. debootstrap bionic testmysql
  2. rm testmysql/etc/resolv.conf
  2. systemd-nspawn -D testmyql --bind /etc/resolv.conf /bin/bash -c 'apt update && apt install mysql-server'

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/mysql-5.7/+bug/1752705/+subscriptions



More information about the foundations-bugs mailing list