Bug 1373006 - MariaDB does not start after reboot: Can't create/write to file '/var/run/mariadb/mariadb.pid'
Summary: MariaDB does not start after reboot: Can't create/write to file '/var/run/mar...
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: mariadb
Version: rawhide
Hardware: All
OS: Linux
unspecified
high
Target Milestone: ---
Assignee: Jakub Dorňák
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-09-04 18:02 UTC by Randy Barlow
Modified: 2023-05-28 23:37 UTC (History)
16 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-10-18 15:37:14 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Randy Barlow 2016-09-04 18:02:53 UTC
Description of problem:
When I restart my Rawhide box, the mariadb service will not start, due to /var/run/mariadb not existing.


Version-Release number of selected component (if applicable):
# rpm -q mariadb-server
mariadb-server-10.1.16-2.fc26.x86_64


How reproducible:
Every time.


Steps to Reproduce:
1. Install MariaDB on Rawhide.
2. Set it to be enabled on boot.
3. Reboot.


Actual results:
MariaDB isn't running, and you can't start it manually:

$ sudo systemctl start mariadb
Job for mariadb.service failed because the control process exited with error code.
See "systemctl status mariadb.service" and "journalctl -xe" for details.
# tail -n 2 /var/log/mariadb/mariadb.log 
2016-09-04 13:57:45 140308468599552 [ERROR] mysqld: Can't create/write to file '/var/run/mariadb/mariadb.pid' (Errcode: 2 "No such file or directory")
2016-09-04 13:57:45 140308468599552 [ERROR] Can't start server: can't create PID file: No such file or directory


Expected results:
MariaDB should start during boot when enabled, and should also start when systemctl start mariadb is run.


Additional info:
I can fix this by creating the missing folder in the tmpfs and setting permission to mariadb:

# install -dpm770 -o mysql -g mysql /var/run/mariadb
# systemctl start mariadb  # Success!

Comment 1 Randy Barlow 2016-10-18 15:37:14 UTC
This issue appears to be resolved after a dnf upgrade I performed on the machine that was experiencing it. I'm not sure which package resolved the problem, but I am thankful that it is fixed!

Comment 2 Dima Ryazanov 2017-12-21 23:05:56 UTC
This is happening to me in Fedora 27. I'm fully updated, so that hasn't helped. Creating the "/run/mariadb/" directory lets me start MariaDB - however, the directory does not persist across reboots.

Comment 3 Rich Fellinger 2018-01-24 02:35:19 UTC
I am having this problem after updating Fedora 26.  The directory /run/mariadb is not being created.  By adding custom configuration for mariadb.service I was able to get the /run/mariadb directory created at boot:

In /etc/systemd/system/mariadb.service.d/ create a file, tempfs.conf, containing the following:

[Service]
PermissionsStartOnly=true
ExecStartPre=/usr/bin/install -dpm770 -o mysql -g mysql /run/mariadb

Comment 4 John Pilkington 2018-01-24 20:23:28 UTC
Also seen today in Fedora 26.  I posted on the Fedora-users and mythtv-users lists and have a report that in Rawhide 

/usr/lib/tmpfiles.d/mariadb.conf 

looks like this:

# Do not edit this file.
# To override this, put /etc/tmpfiles.d/mariadb.conf instead.
d /run/mariadb 0755 mysql mysql -
d /run/mariadb 0755 mysql mysql -

In F26 I downgraded to 10.1.21-5, which is now running.

The last two lines there refer to /var/run/mariadb

Comment 5 John Pilkington 2018-01-25 15:23:39 UTC
It seems worth saying that the instructions here, from Scientific Linux 7.4, are very much clearer and easier to understand - although I suppose they may soon need an update too.

/usr/lib/tmpfiles.d/mariadb.conf 

# Do not edit this file; it will be overwritten on upgrades.
# If you want to override the settings here, you can copy this file
# to /etc/tmpfiles.d/mariadb.conf and make your changes there.

d /var/run/mariadb 0755 mysql mysql -

Comment 6 Michal Schorm 2018-01-25 16:06:58 UTC
Can you, guys, please refer to bug:
https://bugzilla.redhat.com/show_bug.cgi?id=1538066

I'm working on it there and I already made fix and put it into testing repository.

Comment 7 Claude Frantz 2018-01-27 07:27:20 UTC
Using Fedora 26, I was able to make mariadb running again, when creating the file /etc/systemd/system/mariadb.service containing:

.include /usr/lib/systemd/system/mariadb.service

[Service]
RuntimeDirectory=mariadb

Comment 8 Stuart James 2018-09-26 07:20:16 UTC
Still an issue on Centos 7 latest and MariaDB 10.2 and 10.3.9-1.el7 from mariadb repository.

comment #5 fixed it for me

Comment 9 Michal Schorm 2018-09-26 11:37:28 UTC
(In reply to Stuart James from comment #8)
> Still an issue on Centos 7 latest and MariaDB 10.2 and 10.3.9-1.el7 from
> mariadb repository.
> 
> comment #5 fixed it for me

For CentOS please refer to CentOS own bug tracker.
I made an entry there for you:
https://bugs.centos.org/view.php?id=15326

Comment 10 adovbos 2021-06-09 10:22:02 UTC
Fedora 34 (clean install)
Mariadb Version: 10.5.10

Issue is [ERROR] mariadbd: Can't create/write to file '/run/mariadb/mariadb.pid' (Errcode: 2 "No such file or directory")

Checking settings that was proposed in comment #5

cat /usr/lib/tmpfiles.d/mariadb.conf 
# Do not edit this file.
# To override this, put /etc/tmpfiles.d/mariadb.conf instead.
d /run/mariadb 0755 mysql mysql -
d /run/mariadb 0755 mysql mysql -

Looks like it has duplicate
 
What helped me fix this issue:

# vim /etc/tmpfiles.d/mariadb.conf

d /run/mariadb 0755 mysql mysql -

:wq

# systemctl start mariadb

Works

Comment 11 Michael 2021-07-16 22:38:38 UTC
I had this problem, resolved updating to mariadb-3:10.5.11-1.fc34.x86_64

Regards.

Comment 12 shara hall 2022-10-03 01:34:45 UTC Comment hidden (spam)
Comment 13 xuezia 2022-10-12 16:16:38 UTC Comment hidden (spam)
Comment 14 andreeoren 2022-12-14 09:12:02 UTC Comment hidden (spam)
Comment 15 orborne 2022-12-17 08:49:35 UTC Comment hidden (spam)
Comment 16 rosydam 2023-04-20 09:33:30 UTC Comment hidden (spam)
Comment 17 zehenna 2023-05-27 04:23:05 UTC Comment hidden (spam)

Note You need to log in before you can comment on or make changes to this bug.