systemd: Wrong dependency for mysql on debain #2020

Closed
opened 2025-11-02 04:21:25 -06:00 by GiteaMirror · 4 comments
Owner

Originally created by @thomask77 on GitHub (Jul 6, 2018).

Hi!

The systemd example config does not work for Debian and MySQL:

In Debian, the service is named mysql not mysqld.

Also, I think

Requires=mysql.service
#Requires=postgresql.service
#Requires=memcached.service
#Requires=redis.service

Would be better, because After does not even issue a warning, if the service is not available.

best regards,
thomas

Originally created by @thomask77 on GitHub (Jul 6, 2018). Hi! The systemd example config does not work for Debian and MySQL: * https://github.com/go-gitea/gitea/blob/1675fc4301d4bff339a0831348fca76a9e394999/contrib/systemd/gitea.service#L5 In Debian, the service is named `mysql` not `mysqld`. Also, I think ``` Requires=mysql.service #Requires=postgresql.service #Requires=memcached.service #Requires=redis.service ``` Would be better, because `After` does not even issue a warning, if the service is not available. best regards, thomas
GiteaMirror added the type/docs label 2025-11-02 04:21:25 -06:00
Author
Owner

@lunny commented on GitHub (Jul 8, 2018):

mysqld.service is work form on Debian GNU/Linux 7 \n \l

@lunny commented on GitHub (Jul 8, 2018): mysqld.service is work form on `Debian GNU/Linux 7 \n \l`
Author
Owner

@thomask77 commented on GitHub (Jul 8, 2018):

Hmm, I don't think so.

Wheezy does not come with a systemd service file, but only contains a legacy /etc/init.d/mysql script:

#!/bin/bash
#
### BEGIN INIT INFO
# Provides:          mysql
...

The same holds true for debian 8 (jessie), see

Starting from debian 9 (stretch), mysql is substituded by mariadb:

The /etc/init.d file still Provides: mysql. But there's now also a mariadb.service file, which defines the alias names mysql and mysqld.

Note: The current gitea.service file does work by accident, regardless of the correct name because After is used instead of the correct Requires.

The bad thing is that gitea may start too early, and will be restarted by systemd multiple times until mysql is finally started. You should see this behavior in your journal.

@thomask77 commented on GitHub (Jul 8, 2018): Hmm, I don't think so. Wheezy does not come with a systemd service file, but only contains a legacy `/etc/init.d/mysql` script: * https://packages.debian.org/wheezy/amd64/mysql-server-5.5/download ``` #!/bin/bash # ### BEGIN INIT INFO # Provides: mysql ... ``` The same holds true for debian 8 (jessie), see * https://packages.debian.org/jessie/amd64/mysql-server-5.5/download Starting from debian 9 (stretch), mysql is substituded by mariadb: * https://packages.debian.org/stretch/amd64/mariadb-server-10.1/download The `/etc/init.d` file still `Provides: mysql`. *But* there's now also a `mariadb.service` file, which defines the alias names `mysql` and `mysqld`. Note: The current `gitea.service` file does work by accident, regardless of the correct name because `After` is used instead of the correct `Requires`. The bad thing is that gitea may start too early, and will be restarted by systemd multiple times until mysql is finally started. You should see this behavior in your journal.
Author
Owner

@thomask77 commented on GitHub (Jul 8, 2018):

Small addition: In CentOS 7, the service is just mariadb without any Aliases.

So a proposed patch would be:

#Requires=mysql.service
#Requires=mariadb.service
#Requires=postgresql.service
#Requires=memcached.service
#Requires=redis.service
@thomask77 commented on GitHub (Jul 8, 2018): Small addition: In CentOS 7, the service is just `mariadb` without any Aliases. * http://mirror.centos.org/centos/7/os/x86_64/Packages/mariadb-server-5.5.56-2.el7.x86_64.rpm So a proposed patch would be: ``` #Requires=mysql.service #Requires=mariadb.service #Requires=postgresql.service #Requires=memcached.service #Requires=redis.service ```
Author
Owner

@stale[bot] commented on GitHub (Jan 19, 2019):

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.

@stale[bot] commented on GitHub (Jan 19, 2019): This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#2020