Skip to content

Conversation

grooverdan
Copy link
Member

@grooverdan grooverdan commented Oct 1, 2025

  • The Jira issue number for this PR is: MDEV-35904/MDEV-37726/MDEV-15502

Description

MDEV-35904 is backporting the MDEV-19210 as uninitialised systemd environment variables are now warnings in later systemd versions.

MDEV-37726, originally submitted as #4316, moves the galera information files of MDEV-35904 to /run/mariadb so that selinux doesn't complain.

With those in place, MDEV-15502, the tmpfiles for Debian becomes easy. Which incidently resolves MDEV-13985.

Release Notes

Per MDEVs

How can this PR be tested?

selinux changes covered by external manual testing in #4316.
environment usage of systemd galera previously tested as this is in 10.11+.
buildbot install/upgrade tests cover this adequtely (except the galera bit).

Basing the PR against the correct MariaDB version

  • This is a new feature or a refactoring, and the PR is based against the main branch.
  • This is a bug fix, and the PR is based against the earliest maintained branch in which the bug can be reproduced.

PR quality check

  • I checked the CODING_STANDARDS.md file and my PR conforms to this where appropriate.
  • For any trivial modifications to the PR, I am ok with the reviewer making the changes themselves.

Closes #4316.

eworm-de and others added 3 commits October 1, 2025 15:37
…EP_START_POSITION

MDEV-35904 - backport MDEV-19210 to 10.11 as referenced
by unset environment variables become warnings.

We used to run `systemctl set-environment` to pass
_WSREP_START_POSITION. This is bad because:

* it clutter systemd's environment (yes, pid 1)
* it requires root privileges
* options (like LimitNOFILE=) are not applied

Let's just create an environment file in ExecStartPre=, that is read
before ExecStart= kicks in. We have _WSREP_START_POSITION around for the
main process without any downsides.
…ory with wrong selinux permissions

After moving the systemd service to using environment files
instead of `systemctl set-environment` in 11.6 (MDEV-19210),
they (wsrep-new-cluster and wsrep-start-position) are located
in /var/lib/mysql along with the socket file in
Fedora/RHEL-based distros. This causes them to have incorrect
selinux permissions and therefore be not readable by systemd.

A solution is to generate these files in the run directory,
instead, which already has correct selinux label mysqld_var_run_t
mysql-selinux-1.0.12. Dissociating these files and the socket
in CMake configs can also prove useful for other things.

This also corrects some of the duplicate code in the build
scripts and made INSTALL_RUNDATADIR into a proper location
and used this for the tmpfiles where the temporary files
are created.

Moved Debian's location from the /run/mysqld/ (previously
based on INSTALL_UNIX_ADDRDIR), to /run/mariadb as its
a temporary location controlled by tmpfiles.
With PermissionsStartOnly deprecated, remove this from the
system service file.

Replace Debian's ExecStartPre "install -d" with a tmpfile
configuration directive creating the directory with this.

Debian's ExecStartPost of the mariadb upgrade uses the !
special executable prefix added in systemd v231.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
MariaDB Foundation Pull requests created by MariaDB Foundation
Development

Successfully merging this pull request may close these issues.

2 participants