Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-35904

Warnings about undefined variables with systemd starting with version v254

    XMLWordPrintable

Details

    • Bug
    • Status: Confirmed (View Workflow)
    • Minor
    • Resolution: Unresolved
    • 10.6.20, 11.4.4
    • 10.6, 11.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 ...
    • Q3/2025 Maintenance

    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

          Activity

            People

              danblack Daniel Black
              hholzgra Hartmut Holzgraefe
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.