mariadb11.8/mariadb.tmpfiles.d.in
Nikola Davidova 7b4bc1f73f [tmpfiles.d] Extend tmpfiles.d rules for ImageMode
After switching to a container image with bootc switch, systemd failed to start
MariaDB 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
MariaDB 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/
./mariadb11.8-server-11.8.2-3.fc43.x86_64.rpm/var/lib
./mariadb11.8-server-11.8.2-3.fc43.x86_64.rpm/var/lib/mysql
./mariadb11.8-server-11.8.2-3.fc43.x86_64.rpm/var/log
./mariadb11.8-server-11.8.2-3.fc43.x86_64.rpm/var/log/mariadb

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.
2025-11-04 12:05:11 +01:00

9 lines
295 B
D

# Do not edit this file.
# To override this, put /etc/tmpfiles.d/mariadb.conf instead.
d @PID_FILE_DIR@ 0755 mysql mysql -
# Rules for ephemeral file systems (ImageMode)
d /var/lib/mysql 0755 mysql mysql -
d /var/log/mariadb 0750 mysql mysql -
f /var/log/mariadb/mariadb.log 0660 mysql mysql -