Details
-
Bug
-
Status: Confirmed (View Workflow)
-
Minor
-
Resolution: Unresolved
-
10.6.20, 11.4.4
-
Linux systems with systemd >= v254; as e.g. present in Ubuntu 24.04 "Noble"
Only tested this with 10.6 and 11.4, but should be the same for all other major releases, too ...
Description
Starting with v254 systemD services complain about unset variables, leading to
mariadb.service: Referenced but unset environment variable evaluates to an empty string: MYSQLD_OPTS, _WSREP_NEW_CLUSTER
|
warnings.
This was caused by this systemD changeset:
https://github.com/systemd/systemd-stable/commit/f331434d13488425ccd8485327085d15f8f92aea
The general recommendation to prevent this seems to be to just set such variables to an empty value up front in the service file, e.g.:
Environment=MYSQLD_OPTS=''
|
If a variable is then later set by an additional service configuration file, e.g.:
/etc/systemd/system/mariadb.service.d/override.conf
|
created via `systemctl edit mariadb.service`, then everything is fine and the custom value is used.
But when setting an environment variable via `systemctl set-environment`, as e.g. used by the `galera_new_cluster` script to set `_WSREP_NEW_CLUSTER`, this does NOT seem to work and an empty assignment in the `[Service]` section takes precedence over the value set via `systemctl set-environment`.
So right now I don't see a good way to set an environment variable conditionally within a systemD service file ...
Attachments
Issue Links
- relates to
-
MDEV-19210 use environment file in systemd units for _WSREP_*
-
- Closed
-
11.6+ includes the non-env method of
MDEV-19210for galera_new_cluster so given its stability backporting that along with the env changes.Hence 11.6+ also applies for the env variable _WSREP_NEW_CLUSTER.