Comment 3 for bug 1957013

Revision history for this message
Bryce Harrington (bryce) wrote : Re: package mysql-server-8.0 8.0.27-0ubuntu0.20.04.1 failed to install/upgrade: installed mysql-server-8.0 package post-installation script subprocess returned error exit status 1

21:31:13 Server upgrade from '80025' to '80027' started.
21:37:55 Server upgrade from '80025' to '80027' completed.

Notice the upgrade took >5 min to complete.
We have a number of bugs similar to this, like LP: #1901830, #1928493, #1929314, and maybe #1929430.

The postinst has this code:

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
}

If I read this right it suggests that it waits only 1 minute for the old server to shut down before considering it failed. Increasing the timeout to 10 minutes would seem excessive but from the logs it appears that would work around the problem...

Of course, if we expect a shutdown within a minute but it takes 7-10 minutes in practice sometimes, then that suggests examining why it sometimes takes so long.