[MDEV-15525] ExecStartPre=/usr/bin/mysql_install_db -u mysql option does not work, wrong permissions Created: 2018-03-09  Updated: 2018-04-30  Resolved: 2018-04-30

Status: Closed
Project: MariaDB Server
Component/s: Server
Affects Version/s: 10.2.13
Fix Version/s: N/A

Type: Bug Priority: Minor
Reporter: Claudio Nanni Assignee: Unassigned
Resolution: Incomplete Votes: 0
Labels: need_feedback
Environment:

Linux



 Description   

On Systemd, if you rely on the option:

ExecStartPre=/usr/bin/mysql_install_db -u mysql

In the MariaDB systemd unit file it won't work.

The datadir is created owned by root:

$ journalctl -xe
...
...
-- The result is failed.
Feb 13 01:35:37 centos71 mysql_install_db[1590]: Installation of system tables failed!  Examine the logs in
Feb 13 01:35:37 centos71 mysql_install_db[1590]: /var/lib/mysql for more information.

# ls -al /var/lib/mysql
total 4
drwx------.  4 root root   29 Feb 13 01:35 .
drwxr-xr-x. 66 root root 4096 Feb 13 01:35 ..
drwx------.  2 root root    6 Feb 13 01:35 mysql
drwx------.  2 root root    6 Feb 13 01:35 test



 Comments   
Comment by Daniel Black [ 2018-04-01 ]

Was this an install or upgrade? Was it an RPM or bintar?

If RPM and install should of created the directory with the correct ownership https://github.com/MariaDB/server/blob/10.2/support-files/rpm/server-postin.sh#L66.

Is it possible that something happened between installation and service start?

In MDEV-14707 I was hoping on removing the need to have root permissions in the pre/post scripts of the service file. Do we create a mini pre-requisites service file that ensures the right directories exist? Its sounding a touch excessive.

If /var/lib/mysql is created owned by root in a normal installation process, sure we should correct it, but how much checking/fixing should be the responsibility of a service script?

Generated at Thu Feb 08 08:21:58 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.