[MDEV-10797] RPM includes init script and a systemd unit Created: 2016-09-12 Updated: 2022-06-08 Resolved: 2019-04-02 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Packaging |
| Affects Version/s: | 10.1.17 |
| Fix Version/s: | 10.4.4 |
| Type: | Bug | Priority: | Critical |
| Reporter: | Jonathan Gazeley | Assignee: | Sergei Golubchik |
| Resolution: | Fixed | Votes: | 3 |
| Labels: | contribution, foundation, patch | ||
| Environment: |
CentOS 7 |
||
| Issue Links: |
|
||||||||||||||||||||||||||||||||||||||||||||
| Sprint: | 10.1.30 | ||||||||||||||||||||||||||||||||||||||||||||
| Description |
|
MariaDB 10.1.17 and other recent releases still include an init script as well as a systemd unit. The init script ships with chkconfig on and this causes a race condition as to which version of the daemon starts first. This has caused us significant problems with RPM updates and system reboots.
|
| Comments |
| Comment by Elena Stepanova [ 2016-09-19 ] | |||||||||||||||||||||||||||||||
|
We need the init script to maintain backward compatibility with whatever setups users have. The script is supposed to redirect to systemd. | |||||||||||||||||||||||||||||||
| Comment by Jonathan Gazeley [ 2016-09-19 ] | |||||||||||||||||||||||||||||||
|
I disagree. This RPM is targeted specifically at RHEL7, which has chosen systemd as its primary service control facility. Init scripts are only supported in RHEL7 as a legacy measure to support applications that don't support systemd yet. MariaDB does support systemd, so that should be the only method necessary to package for RHEL7. If you really need to provide an init script on RHEL7 for backwards compatibility, it should be packaged as a separate RPM like MariaDB-init so sysadmins who don't want legacy init scripts can avoid it. This has caused me problems because the redirection is not reliable, and the systemd unit has multiple aliases. In some circumstances this causes the daemon to not start properly because the init script and systemd unit are not identical (e.g. in terms of SELinux context) and has caused a database outage at my site. | |||||||||||||||||||||||||||||||
| Comment by Daniel Black [ 2017-04-27 ] | |||||||||||||||||||||||||||||||
|
I agree with the removal of /etc/init.d/mysql. Its old, clunky and inconsistent with the init.d free nature of Centos/RHEL7. It also needs specific selinux rules to deal with mysqld_safe. Its time to let it go. From a Centos-7.3 system with MariaDB-server-10.2 installed;
| |||||||||||||||||||||||||||||||
| Comment by Jonathan Gazeley [ 2017-11-29 ] | |||||||||||||||||||||||||||||||
|
Has there been any movement on this? This is still an issue for me... my systems got 10.2.11 overnight but the process that restarts the daemon after the update does so using the init script, so the systemd unit can't control the process. To regain control I have to do sudo /etc/init.d/mysql stop && sudo systemctl start mariadb. I don't mean to be rude but it is pretty shameful that such an obvious and trivial bug still persists. | |||||||||||||||||||||||||||||||
| Comment by Sergey Vojtovich [ 2017-11-29 ] | |||||||||||||||||||||||||||||||
|
There were a few attempts to remove init script, which didn't succeed. Mainly because MariaDB RPM scripts (e.g. preun and postun) reference it. We should probably strive for fixing this race condition first. Then we can try removing init script, not in GA version though. elenst, I wonder if you or alice could try reproducing this race condition on our side? | |||||||||||||||||||||||||||||||
| Comment by Daniel Black [ 2017-11-30 ] | |||||||||||||||||||||||||||||||
|
You can remove the init script, because its a bug. It is a complete anti-feature in the release that is still causing problems and never belonged there. Sure the pre/post things needs fixing. Still. | |||||||||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2017-12-09 ] | |||||||||||||||||||||||||||||||
|
svoj what about fixing pre/post scriptlets first? Then packagers will be able to exclude mysql.init script at their discretion. And in our packages we could, perhaps, move it to @sharedir@ (on systemd based distributions) instead of deleting it completely. | |||||||||||||||||||||||||||||||
| Comment by Sergey Vojtovich [ 2017-12-09 ] | |||||||||||||||||||||||||||||||
|
serg, that should work as well. I just thought that fixing race condition might be simpler and safer for 10.1. | |||||||||||||||||||||||||||||||
| Comment by Daniel Black [ 2018-02-10 ] | |||||||||||||||||||||||||||||||
|
PR #593 submitted to reflect this design. | |||||||||||||||||||||||||||||||
| Comment by Philippe PETIT [ 2018-02-15 ] | |||||||||||||||||||||||||||||||
|
Version 10.2 is affected : /etc/cron.daily/0yum-daily.cron: Shutting down MariaDB..[ OK ] Résumé de la transaction ------------ But the init script has priority over the systemd script... One of the solutions when updating packages is creating a postaction script in yum, this is bad but it's work ... cat /etc/yum/post-actions/mysql.action MariaDB*:update:/usr/bin/systemctl daemon-reload && for i in `/usr/bin/ps auxf|/usr/bin/grep mysqld|/usr/bin/grep "grep" -v|/usr/bin/awk ' {print $2}'`; do /usr/bin/kill -9 $i; done && rm -f /etc/init.d/mysql && /usr/bin/systemctl restart mysql | |||||||||||||||||||||||||||||||
| Comment by Sergey Vojtovich [ 2018-03-13 ] | |||||||||||||||||||||||||||||||
|
Overdue PR. |