From bdf88f920bc58bdc9b43ee02209c32882c43a9b9 Mon Sep 17 00:00:00 2001 From: Nikola Davidova Date: Tue, 4 Nov 2025 13:32:39 +0000 Subject: [PATCH] Extend tmpfiles.d rules for ImageMode After switching to a container image with bootc switch, systemd failed to start mysqld because required runtime directories were missing or had wrong permissions. Adding tmpfiles entries with correct ownership ensures systemd creates the necessary directories at boot and gives them correct permissions, allowing the mysql daemon to start. "In a container build, you can write to '/var'. However, this will have a semantic similar to a Dockerfile VOLUME instruction; the content from the container image is only copied at initial install time. Any subsequent system updates will not by default see new changes. It's recommended instead to use e.g. systemd tmpfiles.d as a way to ensure that newly added state "reconciles" across upgrades as desired." https://docs.fedoraproject.org/en-US/bootc/filesystem/#_filesystem_bind_mount_var This covers all the files in /var sicne we only ship these as can be seen here: find | grep /var/ ./mysql8.4-server-8.4.5-1.fc43.x86_64.rpm/var/lib ./mysql8.4-server-8.4.5-1.fc43.x86_64.rpm/var/lib/mysql ./mysql8.4-server-8.4.5-1.fc43.x86_64.rpm/var/lib/mysql-files ./mysql8.4-server-8.4.5-1.fc43.x86_64.rpm/var/lib/mysql-keyring ./mysql8.4-server-8.4.5-1.fc43.x86_64.rpm/var/log ./mysql8.4-server-8.4.5-1.fc43.x86_64.rpm/var/log/mysql The '/usr' directory is not persistent therefore this change does not affect it and the '/etc' directory is merged in a different way and also not under the 'mysql:mysql' user --- mysql.tmpfiles.d.in | 7 +++++++ mysql8.4.spec | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/mysql.tmpfiles.d.in b/mysql.tmpfiles.d.in index d2c4b31..d22e348 100644 --- a/mysql.tmpfiles.d.in +++ b/mysql.tmpfiles.d.in @@ -1 +1,8 @@ d @PID_FILE_DIR@ 0755 mysql mysql - + +Rules for ephemeral file systems (ImageMode) +/var/lib/mysql 0755 mysql mysql - +/var/log/mysql 0750 mysql mysql - +/var/log/mysql/mysql.log 0640 mysql mysql - +/var/lib/mysql-files 0750 mysql mysql - +/var/lib/mysql-keyring 0700 mysql mysql - diff --git a/mysql8.4.spec b/mysql8.4.spec index bf1d932..8e3c0d5 100644 --- a/mysql8.4.spec +++ b/mysql8.4.spec @@ -1000,11 +1000,15 @@ popd %{_libexecdir}/mysql-scripts-common %{_tmpfilesdir}/%{daemon_name}.conf +%{_sysusersdir}/%{name}.conf + +# Remember to also update the mysql.tmpfiles.d.in file when updating these permissions %attr(0755,mysql,mysql) %dir %{dbdatadir} %attr(0750,mysql,mysql) %dir %{_localstatedir}/lib/mysql-files %attr(0700,mysql,mysql) %dir %{_localstatedir}/lib/mysql-keyring %attr(0755,mysql,mysql) %dir %{pidfiledir} %attr(0750,mysql,mysql) %dir %{logfiledir} + %config(noreplace) %{logrotateddir}/%{daemon_name} %if %{with devel}