[MDEV-17961] SystemD "Alias=mysql" considered harmful Created: 2018-12-10  Updated: 2020-08-25  Resolved: 2019-04-02

Status: Closed
Project: MariaDB Server
Component/s: Packaging, Platform RedHat
Affects Version/s: 10.2
Fix Version/s: 10.4.4

Type: Bug Priority: Major
Reporter: Hartmut Holzgraefe Assignee: Sergei Golubchik
Resolution: Fixed Votes: 1
Labels: None
Environment:

RHEL7


Issue Links:
Blocks
is blocked by MDEV-10797 RPM includes init script and a system... Closed

 Description   

Our SystemD service file contains an "Alias=mysql.service" entry, so that things like

systemctl stop mysql

still work when using "mysql" instead of "mariadb".

We also still install a "mysql" SysV/LSB init script in /etc/init.d.

Now the problem is: the "mysql.service" alias only exists when the "mariadb" service is enabled, when it is disabled the mysql.service symlinks are removed.

So when the "mariadb" service is enabled systemctl start mysql is an alias for systemctl start mariadb, when the "mariadb" service is disabled it will fall back to the old SysV script in /etc/init.d/mysql, which still gets installed, but behaves differently than the SystemD service (eg. still uses mysqld_safe).

In my opinion the symlink from mariadb.service to mysql.service should be created permanently by the RPM install scriptlet, instead of relying on an Alias= entry in the service file.

The alias only being available at some times is already confusing, and in combination with the still distributed SysV init script by the same base name it really becomes harmful.



 Comments   
Comment by Daniel Black [ 2019-01-16 ]

Not convinced a symlink provides a safe alternative (https://jira.mariadb.org/browse/MDEV-15526?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=121830#comment-121830).

Suggest documentation around overwriting the dependency directives for those service that depend on mysql{,d}.service. The overrides are a simple file dropin as the kb systemd indicates.

Comment by Sergei Golubchik [ 2019-01-28 ]

I think that the Alias is a standard systemd approach and we shouldn't hack around it with manual symlinks. The problem is that systemd falls back to the SysV script /etc/init.d/mysql. And it will be fixed in MDEV-10797.

Comment by Daniel Black [ 2019-03-13 ]

> And it will be fixed in MDEV-10797.

Not anytime soon . MDEV-10797 has been critical for 1 year to the day, open for 2.5 years, and like MDEV-15526 there is every attempt to treat /etc/init.d/mysql as a feature providing compatibility even though its is really broken on systemd systems. But when those that want /etc/init.d/mysql there aren't willing to consider the lots of watchers on these bugs that hit upgrade bugs because having both is fundamentally incompatible. Attempts to consider what options exist fall into silence and shrug their hands at not understanding systemd, little packaging tests exists, and somehow its all too hard and nothing happens.

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