From 810dbf2ed2b995b800284aebac5cea59abc40398 Mon Sep 17 00:00:00 2001 From: Michal Schorm Date: Wed, 7 May 2025 13:17:08 +0200 Subject: [PATCH] PARTIAL REVERT of "[packaging fix for containers] Drop usage of tmpfiles.d" This PARTIALLY REVERTS commit 9f34c645431d3d3308369071e4a7948d1979032f. -- My assumption in the original commit was incorrect. It's true we're creating the `/run/mariadb` directory at the RPM level. However, the `/run` directory is tmpfs, which means it's non-persistent and gets cleaned after reboot. The tmpfile.d configuration was making sure that after reboot, the `/run/mariadb` directory is recreated. But after it has been dropped, at the time of reboot, the `/run/mariadb` dir is removed and not recreated, thus causing this issue. -- Resolves: rhbz#2364619 --- mariadb-scripts.patch | 3 ++- mariadb.tmpfiles.d.in | 3 +++ mariadb10.11.spec | 19 ++++++++++++++----- 3 files changed, 19 insertions(+), 6 deletions(-) create mode 100644 mariadb.tmpfiles.d.in diff --git a/mariadb-scripts.patch b/mariadb-scripts.patch index ceb6a5d..3b6dc16 100644 --- a/mariadb-scripts.patch +++ b/mariadb-scripts.patch @@ -4,13 +4,14 @@ be expanded by cmake. Cmake needs to know about them, so adding them manually. # Install libgcc as mylibgcc.a --- mariadb-10.5.5/scripts/CMakeLists.txt.old 2020-09-24 10:13:35.272589689 +0200 +++ mariadb-10.5.5/scripts/CMakeLists.txt 2020-09-24 10:17:31.428985798 +0200 -@@ -377,6 +377,33 @@ +@@ -377,6 +377,34 @@ INSTALL_LINK(${file} ${binname} ${INSTALL_BINDIR} ${${file}_COMPONENT}) ENDIF() ENDFOREACH() + + # files for systemd + SET(SYSTEMD_SCRIPTS ++ mariadb.tmpfiles.d + mysql.service + mysql@.service + mariadb-prepare-db-dir diff --git a/mariadb.tmpfiles.d.in b/mariadb.tmpfiles.d.in new file mode 100644 index 0000000..9e6b6e8 --- /dev/null +++ b/mariadb.tmpfiles.d.in @@ -0,0 +1,3 @@ +# Do not edit this file. +# To override this, put /etc/tmpfiles.d/mariadb.conf instead. +d @PID_FILE_DIR@ 0755 mysql mysql - diff --git a/mariadb10.11.spec b/mariadb10.11.spec index 2cf25c0..995be0f 100644 --- a/mariadb10.11.spec +++ b/mariadb10.11.spec @@ -165,6 +165,7 @@ Source4: https://github.com/PCRE2Project/pcre2/releases/download/pcre2- %endif Source6: README.mariadb-docs Source8: README.wsrep_sst_rsync_tunnel +Source10: mariadb.tmpfiles.d.in Source11: mysql.service.in Source12: mariadb-prepare-db-dir.sh Source14: mariadb-check-socket.sh @@ -534,10 +535,10 @@ Requires: (mysql-selinux >= 1.0.10 if selinux-policy-targeted) %endif Requires: coreutils - -# 'Recommends' instead of 'Requires' for systems without systemd - e.g. containers -Recommends: systemd - +# We require this to be present for %%{_tmpfilesdir} +Requires: systemd +# Make sure it's there when scriptlets run, too +%{?systemd_requires} # RHBZ#1496131; use 'iproute' instead of 'net-tools' Requires: iproute @@ -879,7 +880,7 @@ cat %{SOURCE52} | tee -a mysql-test/unstable-tests cat %{SOURCE53} | tee -a mysql-test/unstable-tests %endif -cp %{SOURCE2} %{SOURCE3} %{SOURCE11} %{SOURCE12} \ +cp %{SOURCE2} %{SOURCE3} %{SOURCE10} %{SOURCE11} %{SOURCE12} \ %{SOURCE14} %{SOURCE15} %{SOURCE16} %{SOURCE18} %{SOURCE70} %{SOURCE73} scripts # Create a sysusers.d config file @@ -1067,6 +1068,9 @@ chmod 0750 %{buildroot}%{logfiledir} touch %{buildroot}%{logfile} # PID file directory +# current setting in my.cnf is to use /var/run/mariadb for creating pid file, +# however since my.cnf is not updated by RPM if changed, we need to create mysqld +# as well because users can have odd settings in their /etc/my.cnf mkdir -p %{buildroot}%{pidfiledir} # DB datadir @@ -1100,6 +1104,10 @@ install -p -m 755 %{_vpath_builddir}/scripts/mariadb-check-socket %{buildroot}%{ install -p -m 755 %{_vpath_builddir}/scripts/mariadb-check-upgrade %{buildroot}%{_libexecdir}/mariadb-check-upgrade install -p -m 644 %{_vpath_builddir}/scripts/mariadb-scripts-common %{buildroot}%{_libexecdir}/mariadb-scripts-common +# Install downstream version of tmpfiles +install -D -p -m 0644 %{_vpath_builddir}/scripts/mariadb.tmpfiles.d %{buildroot}%{_tmpfilesdir}/%{majorname}.conf +echo "d %{pidfiledir} 0755 mysql mysql -" >>%{buildroot}%{_tmpfilesdir}/%{majorname}.conf + # Install downstream version of sysusers.d config install -m0644 -D support-files/%{name}.sysusers.conf %{buildroot}%{_sysusersdir}/%{name}.conf @@ -1661,6 +1669,7 @@ fi %attr(0660,mysql,mysql) %config %ghost %verify(not md5 size mtime) %{logfile} %config(noreplace) %{logrotateddir}/%{daemon_name} +%{_tmpfilesdir}/%{majorname}.conf %{_sysusersdir}/%{name}.conf %if %{with cracklib}