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

Distributed mariadb.service Systed service file prevents start with default datadir

Details

    Description

      When using our -systemd- binary tarballs the distributed mysqld.service systemd service file has

      ProtectSystem=full
      

      set since MDEV-10298. As this leads to everything under /usr being read-only, but the binary tarball builds having the data dir set up under /usr/local/mariadb-.../data by default.

      So trying to bring the MariaDB server up using default settings, according to our instructions in

      https://mariadb.com/kb/en/installing-mariadb-binary-tarball

      leads to "funny" errors like:

      2021-08-06 10:44:49 0 [ERROR] mysqld: File '/usr/local/mariadb-10.4.18-linux-systemd-x86_64/data/aria_log_control' not found (Errcode: 30 "Read-only file system")
      

      while starting the server manually works just fine.

      So I'd suggest to add

      ReadWritePaths=/usr/local/mysql/data
      

      to the bundled mariadb.service file. As /usr/local/mysql/data is a symlink, and SystemD resolves this link to the actual data directory, this should work across all releases without requiring per-release adjustments.

      A more complete fix would be to allow both the symlink and the actual versioned path, like e.g.:

      ReadWritePaths=/usr/local/mysql/data /usr/local/mariadb-10.4.18-linux-systemd-x86_64/data/
      

      Attachments

        Issue Links

          Activity

            hholzgra Hartmut Holzgraefe created issue -
            hholzgra Hartmut Holzgraefe made changes -
            Field Original Value New Value

            Unfortunately the ReadWritePaths approach only works with CentOS 8, not with CentOS 7 ...

            hholzgra Hartmut Holzgraefe added a comment - Unfortunately the ReadWritePaths approach only works with CentOS 8, not with CentOS 7 ...
            hholzgra Hartmut Holzgraefe added a comment - - edited

            pre Systemd 231 the setting name is ReadWriteDirectories, not ReadWritePaths

            As CentOS 7 / RHEL 7 come with SystenD 219 the older ReadWriteDirectories is needed there

            hholzgra Hartmut Holzgraefe added a comment - - edited pre Systemd 231 the setting name is ReadWriteDirectories, not ReadWritePaths As CentOS 7 / RHEL 7 come with SystenD 219 the older ReadWriteDirectories is needed there
            danblack Daniel Black made changes -
            Assignee Tuukka Pasanen [ JIRAUSER49166 ]
            illuusio Tuukka Pasanen made changes -

            hholzgra did I understand correctly that you are using binary tar-ball not DEB or RPM installation with read-only /usr and you use MariaDB-systemd to launch you instance?

            illuusio Tuukka Pasanen added a comment - hholzgra did I understand correctly that you are using binary tar-ball not DEB or RPM installation with read-only /usr and you use MariaDB-systemd to launch you instance?
            danblack Daniel Black added a comment -

            > using binary tar-ball not DEB or RPM installation

            yes.

            > with read-only /usr

            No, ProtectSystem=full makes /usr read only.

            > and you use MariaDB-systemd to launch you instance?

            Yes the systemd service file is used to start the service.

            danblack Daniel Black added a comment - > using binary tar-ball not DEB or RPM installation yes. > with read-only /usr No, ProtectSystem=full makes /usr read only. > and you use MariaDB-systemd to launch you instance? Yes the systemd service file is used to start the service.
            serg Sergei Golubchik made changes -
            Fix Version/s 10.2 [ 14601 ]
            Fix Version/s 10.3 [ 22126 ]
            Fix Version/s 10.4 [ 22408 ]
            Fix Version/s 10.5 [ 23123 ]
            Fix Version/s 10.6 [ 24028 ]
            danblack Daniel Black made changes -
            Assignee Tuukka Pasanen [ JIRAUSER49166 ] Daniel Black [ danblack ]

            hholzgra Could you test Pull Request does it work around this problem?

            illuusio Tuukka Pasanen added a comment - hholzgra Could you test Pull Request does it work around this problem?
            serg Sergei Golubchik made changes -
            Workflow MariaDB v3 [ 124141 ] MariaDB v4 [ 143071 ]

            This PR has been merged

            illuusio Tuukka Pasanen added a comment - This PR has been merged
            illuusio Tuukka Pasanen made changes -
            Component/s Packaging [ 10700 ]
            Fix Version/s N/A [ 14700 ]
            Fix Version/s 10.2 [ 14601 ]
            Fix Version/s 10.3 [ 22126 ]
            Fix Version/s 10.4 [ 22408 ]
            Fix Version/s 10.5 [ 23123 ]
            Fix Version/s 10.6 [ 24028 ]
            Resolution Fixed [ 1 ]
            Status Open [ 1 ] Closed [ 6 ]

            illuusio The PR https://github.com/MariaDB/server/pull/1949 is still open. Where exactly has this been merged? What branch?

            Also, when fixing a bug in a version (say 10.3), the Fix Version you need to fill out in JIRA is 10.[34567].<next-upcoming-point-release>. Basically, you need to mark which upcoming versions will have the bug fixed, so that it's easy to figure out which version has it.

            cvicentiu Vicențiu Ciorbaru added a comment - illuusio The PR https://github.com/MariaDB/server/pull/1949 is still open. Where exactly has this been merged? What branch? Also, when fixing a bug in a version (say 10.3), the Fix Version you need to fill out in JIRA is 10. [34567] .<next-upcoming-point-release>. Basically, you need to mark which upcoming versions will have the bug fixed, so that it's easy to figure out which version has it.

            cvicentiu I tried but it just said that it doesn't fit in to regex..

            illuusio Tuukka Pasanen added a comment - cvicentiu I tried but it just said that it doesn't fit in to regex..

            doesn't seem to be merged anywhere

            serg Sergei Golubchik added a comment - doesn't seem to be merged anywhere

            serg Sorry my bad.. I just looked GIthub very straigly it was approved not merged!.. I re-open if I can

            illuusio Tuukka Pasanen added a comment - serg Sorry my bad.. I just looked GIthub very straigly it was approved not merged!.. I re-open if I can
            illuusio Tuukka Pasanen made changes -
            Fix Version/s 10.3 [ 22126 ]
            Fix Version/s 10.4 [ 22408 ]
            Fix Version/s 10.5 [ 23123 ]
            Fix Version/s 10.6 [ 24028 ]
            Fix Version/s 10.7 [ 24805 ]
            Fix Version/s N/A [ 14700 ]

            This just Approved not merged.

            illuusio Tuukka Pasanen added a comment - This just Approved not merged.
            illuusio Tuukka Pasanen made changes -
            Resolution Fixed [ 1 ]
            Status Closed [ 6 ] Stalled [ 10000 ]
            danblack Daniel Black made changes -
            Fix Version/s 10.3.33 [ 26805 ]
            Fix Version/s 10.4.23 [ 26807 ]
            Fix Version/s 10.5.14 [ 26809 ]
            Fix Version/s 10.6.6 [ 26811 ]
            Fix Version/s 10.7.2 [ 26813 ]
            Fix Version/s 10.3 [ 22126 ]
            Fix Version/s 10.4 [ 22408 ]
            Fix Version/s 10.5 [ 23123 ]
            Fix Version/s 10.6 [ 24028 ]
            Fix Version/s 10.7 [ 24805 ]
            Resolution Fixed [ 1 ]
            Status Stalled [ 10000 ] Closed [ 6 ]
            danblack Daniel Black made changes -
            danblack Daniel Black made changes -

            Just by coincidence I ran into the same yesterday (didn't even really remember I had encountered it before, and especially not that I created this ticked), and for now updated the KB entries on tarball installation and on systemD to mention this problem and how to deal with it with a simple extra systemd service include file:

            https://mariadb.com/kb/en/installing-mariadb-binary-tarballs/#auto-start-of-mysqld

            https://mariadb.com/kb/en/systemd/#configuring-the-data-directory

            hholzgra Hartmut Holzgraefe added a comment - Just by coincidence I ran into the same yesterday (didn't even really remember I had encountered it before, and especially not that I created this ticked), and for now updated the KB entries on tarball installation and on systemD to mention this problem and how to deal with it with a simple extra systemd service include file: https://mariadb.com/kb/en/installing-mariadb-binary-tarballs/#auto-start-of-mysqld https://mariadb.com/kb/en/systemd/#configuring-the-data-directory
            serg Sergei Golubchik made changes -
            Description When using our -systemd- binary tarballs the distributed mysqld.service systemd service file has

            {noformat}
            ProtectSystem=full
            {noformat}

            set since MDEV-10298. As this leads to everything under /usr being read-only, but the binary tarball builds having the data dir set up under /usr/local/mariadb-.../data by default.

            So trying to bring the MariaDB server up using default settings, according to our instructions in

            https://mariadb.com/kb/en/installing-mariadb-binary-tarball

            leads to "funny" errors like:

            {noformat}
            2021-08-06 10:44:49 0 [ERROR] mysqld: File '/usr/local/mariadb-10.4.18-linux-systemd-x86_64/data/aria_log_control' not found (Errcode: 30 "Read-only file system")
            {noformat}

            while starting the server manually works just fine.

            So I'd suggest to add

            {noformat}
            ReadWritePaths=/usr/local/mysql/data
            {noformat}

            to the bundled mariadb.service file. As /usr/local/mysql/data is a symlink, and SystemD resolves this link to the actual data directory, this should work across all releases without requiring per-release adjustments.

            A more complete fix would be to allow both the symlink and the actual versioned path, like e.g.:

            {noformat}
            ReadWritePaths=/usr/local/mysql/data /usr/local/mariadb-10.4.18-linux-systemd-x86_64/data/
            {noformat}

            When using our \-systemd- binary tarballs the distributed mysqld.service systemd service file has

            {noformat}
            ProtectSystem=full
            {noformat}

            set since MDEV-10298. As this leads to everything under /usr being read-only, but the binary tarball builds having the data dir set up under /usr/local/mariadb-.../data by default.

            So trying to bring the MariaDB server up using default settings, according to our instructions in

            https://mariadb.com/kb/en/installing-mariadb-binary-tarball

            leads to "funny" errors like:

            {noformat}
            2021-08-06 10:44:49 0 [ERROR] mysqld: File '/usr/local/mariadb-10.4.18-linux-systemd-x86_64/data/aria_log_control' not found (Errcode: 30 "Read-only file system")
            {noformat}

            while starting the server manually works just fine.

            So I'd suggest to add

            {noformat}
            ReadWritePaths=/usr/local/mysql/data
            {noformat}

            to the bundled mariadb.service file. As /usr/local/mysql/data is a symlink, and SystemD resolves this link to the actual data directory, this should work across all releases without requiring per-release adjustments.

            A more complete fix would be to allow both the symlink and the actual versioned path, like e.g.:

            {noformat}
            ReadWritePaths=/usr/local/mysql/data /usr/local/mariadb-10.4.18-linux-systemd-x86_64/data/
            {noformat}

            People

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

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

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