GoogleContainerTools / kaniko

Build Container Images In Kubernetes
Apache License 2.0
14.23k stars 1.4k forks source link

Ubuntu/mysql-server-8.0 builds fail - "Error: Unable to shut down server" due to zombie process #3224

Open heapdavid opened 6 days ago

heapdavid commented 6 days ago

Actual behavior Hi, when using docker build the below Dockerfile builds and installs mysql-server-8.0 correctly. When using Kaniko it hangs and eventually errors out when trying to establish if the mysqld process has exited during post installation configuration

FROM docker.io/library/ubuntu:24.04

RUN apt update -y \
    && DEBIAN_FRONTEND=noninteractive apt install --no-install-recommends -y mysql-server-8.0
mysqld will log errors to /var/log/mysql/error.log
mysqld is running as pid 631
Error: Unable to shut down server with process id 631
dpkg: error processing package mysql-server-8.0 (--configure):
 installed mysql-server-8.0 package post-installation script subprocess returned error exit status 1

Looks like the postinst script starts and then kills the mysqld process, and needs to detect its absence before continuing:

https://git.launchpad.net/ubuntu/+source/mysql-8.0/tree/debian/mysql-server-8.0.postinst#n46

mysqld becomes a zombie rather than exiting fully so the script fails

ps in the kaniko container before exit:

  631 mysql     0:00 mysqld --user=mysql --daemonize --socket=/tmp/tmp.sMzJEwPE5f/mysqld.sock --pid-file=/tmp/tmp.sMzJEwPE5f/mysqld.pid --skip-networking

ps in the kaniko container after exit:

  631 mysql     0:00 [mysqld]

ps on the host after exit:

     101  300396  0.2  0.0      0     0 ?        Z    13:56   0:00 [mysqld] <defunct>

Expected behavior The mysqld process to exit cleanly as it does in docker (and podman) build

To Reproduce Steps to reproduce the behavior:

  1. Use the Dockerfile provided to build a container

Additional Information