my nspawn failed to reproduce this (probably too old on xenial), but
doing the same in a chroot instead of systemd-nspawn works fine.

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)
Cannot open /proc/net/unix: No such file or directory
Cannot open /proc/mounts
Created symlink /etc/systemd/system/multi-user.target.wants/mysql.service → 
/lib/systemd/system/mysql.service.

So it seems to be something special to nspawn.

The code in the postinst that does this looks like that.

stop_server(){
  local tmpdir=$1
  # Send kill signal
  server_pid=$(cat "$tmpdir/mysqld.pid")
  kill "$server_pid"

  for i in $(seq 1 60); do
    sleep 0.1 # A full second is too long, but we need to give the server 
_some_ time.
    if ! $(ps $server_pid >/dev/null 2>&1); then
      return 0
    fi
    sleep 1
  done
  # The server hasn't shut down in a timely manner
  echo "Error: Unable to shut down server with process id $server_pid" >&2
  return 1
}


So it essentially is "just" a kill and waiting until the pid is gone

Knowing that a few questions:
1. if you run an interactive bash in nspawn and do the same install would that 
work
2. if (1) is the same, then after the fail what is going on with the pid it 
failed on
   2.1 any dmesg/syslog entries about it?
   2.2 if you send a kill manually what happens?
   2.3 is the process in any odd state (a full ps axlf from inside the nspawn 
might be useful)
   
Setting up a bionic to check the nspawn there ...

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

Title:
  installation of mysql-server fails because postinst fails to shut down
  server

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

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to