[Bug 1213154] New: openSUSE/mariadb container stops with non-zero exit code when calling podman stop
https://bugzilla.suse.com/show_bug.cgi?id=1213154 Bug ID: 1213154 Summary: openSUSE/mariadb container stops with non-zero exit code when calling podman stop Classification: openSUSE Product: openSUSE Tumbleweed Version: Current Hardware: x86-64 OS: Other Status: NEW Severity: Normal Priority: P5 - None Component: Containers Assignee: containers-bugowner@suse.de Reporter: khanich.opensource@gmx.de QA Contact: qa-bugs@suse.de Target Milestone: --- Found By: --- Blocker: --- Steps to reproduce: 1. Start a container, for testing: podman run --detach --env MYSQL_ROOT_PASSWORD=p --name mariadb registry.opensuse.org/opensuse/mariadb:latest 2. wait until initialized 3. Stop the container: podman stop mariadb 4. Check the exit code: podman ls -a; Exited (143) 5. Look at logs: podman logs mariadb example output: -------------------------------------------------------------------------------- Session terminated, killing shell...2023-07-08 22:55:08 0 [Note] mysqld (initiated by: unknown): Normal shutdown 2023-07-08 22:55:08 0 [Note] InnoDB: FTS optimize thread exiting. 2023-07-08 22:55:08 0 [Note] InnoDB: Starting shutdown... 2023-07-08 22:55:08 0 [Note] InnoDB: Dumping buffer pool(s) to /var/lib/mysql/ib_buffer_pool 2023-07-08 22:55:08 0 [Note] InnoDB: Buffer pool(s) dump completed at 230708 22:55:08 2023-07-08 22:55:08 0 [Note] InnoDB: Removed temporary tablespace data file: "./ibtmp1" 2023-07-08 22:55:08 0 [Note] InnoDB: Shutdown completed; log sequence number 46456; transaction id 15 2023-07-08 22:55:08 0 [Note] mysqld: Shutdown complete ...killed. -------------------------------------------------------------------------------- This causes trouble when using the image with a systemd service unit since systemd is going to interpret this as a failed unit. The official image from Docker Hub does not experience this issue. -- You are receiving this mail because: You are on the CC list for the bug.
https://bugzilla.suse.com/show_bug.cgi?id=1213154 https://bugzilla.suse.com/show_bug.cgi?id=1213154#c1 Daniel Black <daniel@mariadb.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |daniel@mariadb.org --- Comment #1 from Daniel Black <daniel@mariadb.org> --- The problem if you run: $ podman run --replace --name opensusemariadb -e MARIADB_ROOT_PASSWORD=bob registry.opensuse.org/opensuse/mariadb 2024-08-07 22:48:56 0 [Note] Starting MariaDB 11.4.2-MariaDB source revision 3fca5ed772fb75e3e57c507edef2985f8eba5b12 as process 28 2024-08-07 22:48:56 0 [Note] InnoDB: Compressed tables use zlib 1.3.1 2024-08-07 22:48:56 0 [Note] InnoDB: Number of transaction pools: 1 2024-08-07 22:48:56 0 [Note] InnoDB: Using AVX512 instructions 2024-08-07 22:48:56 0 [Note] mariadbd: O_TMPFILE is not supported on /tmp (disabling future attempts) 2024-08-07 22:48:56 0 [Note] InnoDB: Using Linux native AIO 2024-08-07 22:48:56 0 [Note] InnoDB: Initializing buffer pool, total size = 128.000MiB, chunk size = 2.000MiB 2024-08-07 22:48:56 0 [Note] InnoDB: Completed initialization of buffer pool 2024-08-07 22:48:56 0 [Note] InnoDB: Buffered log writes (block size=512 bytes) 2024-08-07 22:48:56 0 [Note] InnoDB: End of log at LSN=47875 2024-08-07 22:48:56 0 [Note] InnoDB: Opened 3 undo tablespaces 2024-08-07 22:48:56 0 [Note] InnoDB: 128 rollback segments in 3 undo tablespaces are active. 2024-08-07 22:48:56 0 [Note] InnoDB: Setting file './ibtmp1' size to 12.000MiB. Physically writing the file full; Please wait ... 2024-08-07 22:48:56 0 [Note] InnoDB: File './ibtmp1' size is now 12.000MiB. 2024-08-07 22:48:56 0 [Note] InnoDB: log sequence number 47875; transaction id 15 2024-08-07 22:48:56 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool 2024-08-07 22:48:56 0 [Note] Plugin 'FEEDBACK' is disabled. 2024-08-07 22:48:56 0 [Note] Plugin 'wsrep-provider' is disabled. 2024-08-07 22:48:56 0 [Note] InnoDB: Buffer pool(s) load completed at 240807 22:48:56 2024-08-07 22:48:56 0 [Note] Server socket created on IP: '0.0.0.0'. 2024-08-07 22:48:56 0 [Note] Server socket created on IP: '::'. 2024-08-07 22:48:57 0 [Note] mariadbd: Event Scheduler: Loaded 0 events 2024-08-07 22:48:57 0 [Note] mariadbd: ready for connections. Version: '11.4.2-MariaDB' socket: '/run/mysql/mysql.sock' port: 3306 MariaDB package Notice mariadbd is running as process 28. Container runtime says the main process needs to be process 1 and this is the process that will be given the TERM signal. As the process list is like: $ podman exec opensusemariadb ps -ef UID PID PPID C STIME TTY TIME CMD root 1 0 0 22:48 ? 00:00:00 /bin/bash /usr/local/bin/gosu mysql /usr/local/bin/docker-entrypoint.sh mariadbd mysql 28 1 0 22:48 ? 00:00:00 mariadbd root 125 0 0 22:50 ? 00:00:00 ps -ef The bash gets terminated and doesn't pass a signal to the mariadbd. The cause of this is the gosu script https://build.opensuse.org/projects/openSUSE:Factory/packages/mariadb-image/... The last line needs to be: exec setpriv ... With this the process is substituted and the gosu script is replaced with the executed process as pid 1. /bin/bash here on this line also uneeded. For completeness the replaced gosu script is attached when shellcheck quoting changed too. When tested it results in pid 1: 2024-08-07 22:56:12 0 [Note] Starting MariaDB 11.4.2-MariaDB source revision 3fca5ed772fb75e3e57c507edef2985f8eba5b12 as process 1 .... -- You are receiving this mail because: You are on the CC list for the bug.
https://bugzilla.suse.com/show_bug.cgi?id=1213154 https://bugzilla.suse.com/show_bug.cgi?id=1213154#c2 --- Comment #2 from Daniel Black <daniel@mariadb.org> --- Created attachment 876541 --> https://bugzilla.suse.com/attachment.cgi?id=876541&action=edit gosu replacement -- You are receiving this mail because: You are on the CC list for the bug.
https://bugzilla.suse.com/show_bug.cgi?id=1213154 https://bugzilla.suse.com/show_bug.cgi?id=1213154#c3 --- Comment #3 from Daniel Black <daniel@mariadb.org> --- https://github.com/SUSE/BCI-dockerfile-generator/pull/1507 for the fix. -- You are receiving this mail because: You are on the CC list for the bug.
https://bugzilla.suse.com/show_bug.cgi?id=1213154 https://bugzilla.suse.com/show_bug.cgi?id=1213154#c4 --- Comment #4 from Daniel Black <daniel@mariadb.org> --- The fix for this has now been deployed. $ podman pull registry.opensuse.org/opensuse/mariadb Trying to pull registry.opensuse.org/opensuse/mariadb:latest... Getting image source signatures Copying blob 4450681c160a done | Copying blob f3f6883c7527 done | Copying config 2081d6e889 done | Writing manifest to image destination 2081d6e88935c6ade69d4061a0e25e12356f1ea90addeaf6f6fbcf7ca8daf6e2 $ podman run --rm registry.opensuse.org/opensuse/mariadb cat /usr/local/bin/gosu #!/bin/bash u=$1 shift if ! id -u "$u" > /dev/null 2>&1; then echo "Invalid user: $u" exit 1 fi exec setpriv --reuid="$u" --regid="$u" --clear-groups -- "$@" $ podman run -d --name opensusemariadb -e MARIADB_ROOT_PASSWORD=bob registry.opensuse.org/opensuse/mariadb beda755c5ef9386332b03bc6e153c572be5751865f66fcae149a36c603ee589c (base) $ podman exec opensusemariadb ps -ef UID PID PPID C STIME TTY TIME CMD mysql 1 0 1 01:29 ? 00:00:00 mariadbd root 124 0 0 01:29 ? 00:00:00 ps -ef -- You are receiving this mail because: You are on the CC list for the bug.
participants (1)
-
bugzilla_noreply@suse.com