[MDEV-15526] SysV init service deployed file '/etc/init.d/mysql' prevents systemctl disable command to work correctly (mariadb|mysql naming support) (debian/ubuntu) Created: 2018-03-09 Updated: 2021-01-28 Resolved: 2019-06-17 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Packaging |
| Affects Version/s: | 10.1.36, 10.2.13, 10.3.10 |
| Fix Version/s: | 10.4.6 |
| Type: | Bug | Priority: | Critical |
| Reporter: | Claudio Nanni | Assignee: | Sergei Golubchik |
| Resolution: | Fixed | Votes: | 2 |
| Labels: | packaging, systemd | ||
| Environment: |
Linux - Debian and Ubuntu |
||
| Attachments: |
|
||||||||||||||||||||||||
| Issue Links: |
|
||||||||||||||||||||||||
| Description |
|
Latest packages still install /etc/init.d/mysql scripts, this can lead to race conditions in the service. |
| Comments |
| Comment by Elena Stepanova [ 2018-03-12 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
claudio.nanni, so, what's the request – to stop providing the scripts? I don't know if we can do it in 10.2, it will probably break things for those who uses them. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Claudio Nanni [ 2018-03-29 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Elena, on systemd the init scripts should not be installed even less enabled, moreover on a systemd distribution the package is a dedicated one so maybe it's possible to exclude them completely from such packages.
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2018-03-29 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
> Elena, on systemd the init scripts should not be installed even less enabled, moreover on a systemd distribution the package is a dedicated one so maybe it's possible to exclude them completely from such packages. As a user, I would disagree. Even if I happen to have systemd on the system, it doesn't yet mean I want to be forced to change all my routines to use it, and it only. > The race condition happens because even if you disable the systemd service you can still start it manually, and in any case you don't usually expect init to start a service if you are on a systemd system. It's not really a race condition, it's a human error. Same way you could say that even without systemd a user can have the server started by init script automatically and then also start it manually, by running mysqld_safe or mysqld or what not. In any case, I'll leave it to svoj as an author of MariaDB systemd to decide. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergey Vojtovich [ 2018-03-29 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
cvicentiu kindly offered help on systemd, so reassigning to him. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Claudio Nanni [ 2018-04-09 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
>>Claudio: Elena, on systemd the init scripts should not be installed even less enabled, moreover on a systemd distribution the package is a dedicated one so maybe it's possible to exclude them completely from such packages. >Elena: As a user, I would disagree. Even if I happen to have systemd on the system, it doesn't yet mean I want to be forced to change all my routines to use it, and it only. Claudio: It's not that you happen to have systemd on the system, the whole distribution is either based on SysV init or SystemD, if you upgrade to a distro based on Systemd then the norm is to use that. >>Claudio: The race condition happens because even if you disable the systemd service you can still start it manually, and in any case you don't usually expect init to start a service if you are on a systemd system. >Elena: It's not really a race condition, it's a human error. Same way you could say that even without systemd a user can have the server started by init script automatically and then also start it manually, by running mysqld_safe or mysqld or what not. Claudio: I find just wrong to have init start MariaDB on a Systemd distro, why would you want init to start MariaDB on a systemd system? | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Hartmut Holzgraefe [ 2018-04-09 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
The problem right now is that both mechanisms are enabled by default. So after installing we have the systemd service enabled, and mysqld (without mysqld_safe) is running, and is restarted on reboot, as expected. The sysV init file is also enabled, but only processed after the systemd service, so it just sees that the pid file already exists and a mysqld process is running under that pid, so it does not take startup actions. Now when you disable the systemd service with "systemctl disable mariadb.service" on the next restart the sysV init file will now not see a running mysqld process, and will start one with the help of mysqld_safe. So the problem is not so much that both files are installed, but that both are enabled.
IMHO the sysV init file should be installed, but the service completely disabled by default, when installing on distribution release that uses SystemD by default. So these lines in the init file would need to be changed to empty
and users who want to use the sysV script instead of the systemd service would have to enable it explicitly with chkconfig (RedHat/CentOS) or update-rc.d (Debian/Ubuntu) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Faustin Lammler [ 2018-10-30 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Hi hholzgra, Keep providing both version (systemd/sysV init) with the following condition (and version): The second condition seems pretty difficult test IMO but I have not yet looked into it, maybe not. And of course we should document how to enable sysv init script for users that are willing to use them. And finally, I totally agree with elenst, this is not our decision to force users to switch to systemd and as long as sysv init script can be used we have to keep providing sysv init script. So this is what I think but I am leaving this to cvicentiu and to discussion. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Faustin Lammler [ 2018-10-30 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Ok, this affects all versions and can easily be reproduced, it also affects the official Debian package (10.1.26-MariaDB-0+deb9u1). Install any version from the official mariadb repo (https://downloads.mariadb.org/mariadb/repositories/) or official Debian stable version;
So this is indeed critical as users will not understand why mariadb server is reactivated "magically" after reboot. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Faustin Lammler [ 2018-11-09 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Ok the problem comes from the naming (mariadb/mysql). Normally when disabling a service, the following script is used `/lib/systemd/systemd-sysv-install` in order to synchronize systemd disabled/enabled services with SysV service script. 1/ So with mysql it works because there is a `/etc/init.d/mysql` script:
2/ But with mariadb, it is not working since there is no `/etc/init.d/mariadb` script (not calling /lib/systemd/systemd-sysv-install):
For the moment, I can not propose a clean solution to this. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Faustin Lammler [ 2018-11-10 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Ok, I posted on systemd-devel ML and I get good information from Michael: He updated the Debian wiki: I will try this on upstream 10.1 release. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Faustin Lammler [ 2018-11-11 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
This seems to be working fine. Please find attached a bash script that I developed quickly to be able to reproduce this and test this quickly:
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Otto Kekäläinen [ 2019-01-11 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Please update the bug report title to match the problem and solution in the conclusion. This seems to be like rather risky business so I suggest that you apply this on 10.4 (current development version) first and only later backport to production versions when you are 100 % sure this is the correct thing to do. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Faustin Lammler [ 2019-01-11 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I have renamed the title and created a branch on my fork with the fix (48358cca9f6) https://github.com/fauust/mariadb/tree/fix-MDEV-15526-10.4. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Daniel Black [ 2019-01-16 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
What functionality does providing symlinks provide explicitly? Looks to be just adding to a mess to me. It would seem to break starting mariadb.service and mysqld.service at the same time (as might happen if both are listed as service dependences), as nothing will really be aware of the relationship between them. Both would start, one would fail, hopefully without impact (likely duplicate process detection is quite mature). If a user on a systemd distro wants a sysv init script they can disable the mariadb@service take it out of /usr/share somewhere and install it themselves. Installing both just causes problems as There is no such thing as a disabled /etc/init.d/mysql|mariadb service. The existence this file on a systemd system has some active status, changing `Default-Start/Stop: ` lines isn't sufficient as systemd and some init systems doesn't read them. Install it in /usr/share/... for the users that want to create a mess of their system, but please, keep it clean for everyone else. The assumption that there are users consciously aware and appreciative of the broken packaging provided seems odd. Sure fix 10.4 first, but don't forget the backport. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Christian Hesse [ 2019-02-05 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
We do something similar for Arch Linux: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Faustin Lammler [ 2019-02-06 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Thanks a lot eworm for you input, indeed this looks pretty similar. Are you at Arch Linux deploying sysv init script? I saw this but I would appreciate an explanation of your policy regarding sysv init support if systemd is the default init system. There seems to be a consensus regarding not using Aliases, now we should confirm that using symlink is the right thing to do. danblack, these symlinks have no other utility than permitting the usage of the 2 names (mariadb or mysql) with systemctl commands (even if it also seems to resolve the disable issue that hholzgra reported and that seems to be caused by sysv init script presence). This for instance, should behave exactly equal :
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Christian Hesse [ 2019-02-06 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
We do not ship any sysvinit scripts with Arch Linux. Using symlinks is the right thing to do. In fact the Alias= makes systemd create symlinks in /etc/systemd/system/... But these are available after enabling the service only. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Daniel Black [ 2019-02-06 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Tested symlinks, seems to be exhibiting the right behaviour, for now.
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Faustin Lammler [ 2019-02-07 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Thanks danblack, can you also check the disable|enable command?
And the same with mysql (but mariadb is more significant since there is no /etc/init.d/mariadb init script). I will propose a PR for theses modifications from my branch https://github.com/fauust/mariadb/tree/fix-MDEV-15526-10.4. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Faustin Lammler [ 2019-02-11 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
PR submitted https://github.com/MariaDB/server/pull/1172 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Daniel Black [ 2019-02-13 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Another user stuffed around by the existence of /etc/init.d/mysql Please stop installing it on systemd systems. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Faustin Lammler [ 2019-02-13 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
danblack this problem is resolved by removing aliases and creating symlinks (I have just tested it again on last 10.4 official version): As discussed, the move of not providing "old" sysv init files is not easy to do IMHO because I know a lot of sysadmin (on Debian at least) that are still using sysv init scripts and I still agree with elenst. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Claudio Nanni [ 2019-02-13 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I think that this report renaming from " Latest packages on Systemd still install SysV init service file /etc/init.d/mysql" to "Systemd unit files naming and installation (alias in unit are not recommended, create symlink)" does not help people with this problem in finding this MDEV. Most people report(and so research) what they observe, not the underlying technical reasons for some observed behaviour. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Faustin Lammler [ 2019-02-13 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Good point claudio.nanni, I will find a better title (but naming problem is also important IMO in that title). | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Daniel Black [ 2019-02-13 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I appreciate that there are people that want to use sysv init scripts. I'm all for a sysv init script continuing to exist for people that are using those. The rest of the users either don't know/care which init system is there, or want to use the existing system (like distros are mean to do in providing packages). In these cases they want packages that can be updated (without breaking in the middle of installation), and to be able to disable mariadb as a service. Currently this isn't the case. serg even suggested to install it in a @sharedir@. To help get to some resolution, would it help if we break this up into a couple of usage scenarios for systemd enabled systems:
Yes this is going to get complicated. Yes some automated testing probably should be done to (or at least documented process). This is the 12th most watched open bug, like
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Daniel Black [ 2019-03-13 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
faust Stop ignoring this problem and considering it too hard. Please engage in a discussion of what could be an acceptable solution for elenst, your sysv users and all the users who use systemd, want upgrades to work and want mariadb to be packaged professionally. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2019-03-13 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
danblack, I provided my opinion as a user only. I'm not going to argue against any decision from a position of MariaDB engineering member, neither do I have the authority to forbid the change even if I wanted to. However, to my understanding of the policies, if the script is going to be removed, it must be done before GA (or even before RC, I'm not quite sure which). | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Daniel Black [ 2019-04-03 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Although not clearly stated in this issue, this was the Debian packaging side and as such is unresolved. debian/rules -> override_dh_installinit-arch also needs fixing as it installs init.d script and systemd script of different names, causing problems exactly like the RPM packaging and is inconsistent with Debians packaging standards (written because of the problems described here): | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Otto Kekäläinen [ 2019-04-04 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
For refrence, a comparison of current Debian mariadb-10.3 rules snippet to the left, and upstream mariadb-10.4 rules file to the right. I am not an expert on systemd and since Docker does not support systemd if don't have any easily available testing setup to check which one works better, but knowing the alternative implementation might be useful. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Daniel Black [ 2019-04-05 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Taking an interest in the dominate system manager, on the dominate OS that MariaDB supports, in which packaging pays a critical role, would be useful with bugs like this (which attract watchers while nothing is resolved). I understand the buildbot is docker based which has a complicated relationship with systemd however there is https://hub.docker.com/r/centos/systemd and https://hub.docker.com/r/jrei/systemd-debian (which might not be official, but has the same principle as the Centos Dockerfile) and these could start to form the basis of docker systemd tests, and at the same time, giving you the systemd skills needed to maintain Debian packages. The notes about having a init script having the same name as the service file where there on the above wiki page in 2013 and is not recommended, which mariadb and debian does. I suggest /etc/init.d/mysql -> /etc/init.d/mariadb as the first move perhaps? Summarising a vagrant conversation with colleague that could be used for full VM tests (and galera):
Vagrant implementation as a result of this was these files: https://git.samba.org/?p=autocluster.git;a=tree;f=vagrant;hb=HEAD, tests aren't in this repository. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2019-04-07 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
https://github.com/MariaDB/server/pull/593#issuecomment-479338028 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Faustin Lammler [ 2019-04-10 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Thank you danblack for your suggestion on how we could implement our systemd tests. teodor do you think this is doable on buildbot? I have looked at https://hub.docker.com/r/jrei/systemd-debian/dockerfile and I if I am understanding correctly, BB worker/runner should be a VM or a host and should share `/sys/fs/cgroup` with the container. Then I would be happy to implement the first basic tests:
And maybe Daniel will give us some good test suggestions. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Daniel Black [ 2019-04-10 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
faust all assumptions correct. Regarding /sys/fs/cgroup, I think, not sure by any means, that each container should have a different host subdirectory off this mounted though to give each container a different path in the cgroup hierarchy so /sys/fs/cgroup/testX -> /sys/fs/cgroup. While container based systemd tests will be quite effective for some basic things, eventually some vm/vagrant infrastructure will be needed to effectively test selinux (there is no separation from container host in a selinux context), and would make galera based packaging tests more realistic. Happy to provide other suggestions however lets put that in a new issue. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Teodor Mircea Ionita (Inactive) [ 2019-04-16 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
faust I'm not too knowledgeable of systemd internals and workings. One question though from Buildbot's perspective, does mounting /sys/fs/cgroup from host to guests breach the security and isolation contracts that Docker provides? Remember that these builders will run on Github pull requests too and we don't want a mere opening of a PR to be able to compromise our worker machines. In a sense, Docker is Systemd for containers, as it uses the same kernel tools (cgroups, namespaces) to limit, isolate, control and cleanup the user namespace (apart from zombie processes). | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Otto Kekäläinen [ 2019-04-16 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
In a Debian upgrade bug report I now used the systemd-debian images to test and the steps are outlined in https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=926231#58 in case somebody wants to replicate that. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Faustin Lammler [ 2019-04-16 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
teodor this is a very good question and consideration. I have just found yesterday this documentation that I did not had time to read with calm. And thanks otto I will look at your link too. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2019-04-16 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
axel, there's a long discussion here, but the only important part is this comment. I've merged https://github.com/MariaDB/server/commit/74c9872a9aae825ca6ab73feff048ff2ccb4beb8 but danblack noted that it only fixes RPM, so Debian still needs to be fixed. This is why this issue is not closed yet, it's waiting for a Debian-specific fix. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Daniel Black [ 2019-06-18 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
serg thanks for the fix. does debian/rules -> override_dh_installinit-arch: need to remove dh_installinit --name=mysql – defaults 19 21? It looks odd since the mysql.init is now in /usr/share. teodor I see you haven't made much progress with systemd docker configs or scripts in the last few months, I did mention that I'd help in a new issue. https://developers.redhat.com/blog/2019/04/24/how-to-run-systemd-in-a-container/ is quite new as a blog on non-priviledged docker container without cgroup hacks. Hope it works for you. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2019-08-26 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
danblack, yes, I suppose it should go, thanks | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Faustin Lammler [ 2019-09-18 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Hi!
This https://github.com/MariaDB/server/pull/1172 resolves it by removing dynamically created symlinks (via aliases) and by creating those symlinks on postinst (so symlinks are never removed and synchronization between sysvinit and systemd is working). Then, I think that we should remove symlink postinst creation in 10.5 branch next release (and communicate that systemctl commands does not support mysql naming anymore). That would be the cleanest situation for the future IMO. If you think that this concerns only Debian, I will fix this downstream only. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Otto Kekäläinen [ 2020-04-10 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
After a lot of research into this: Root problem: There is no /etc/init.d/mariadb so disabling mariadb in systemd with `systemctl disable mariadb` does not trigger /lib/systemd/systemd-sysv-install for service name 'mysql' and thus disabling the sysvinit service mysql service stays enabled: Same problem applies for running `systemctl disable mysqld`. The systemd itself supports running `systemd-sysv-install` only if the sysvinit=systemd name. Neither service alias= or service symlinks are supported by this feature. The problem only applies for systems with systemd. On other systems the command `systemctl disable mariadb` would fail because there is no sysvinit file with that name (note that the command `systemctl` may work on systems that lack systemd but have a systemctl-shim installed. Correct solution here is to:
Code changes:
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Otto Kekäläinen [ 2020-04-10 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
A similar example is package openssh-server in Debian. It has only /etc/init.d/ssh but both /lib/systemd/system/ssh.service with alias=sshd. There is also a symlink `/etc/systemd/system/sshd.service -> /lib/systemd/system/ssh.service`. There is a related upstream bug report in https://github.com/systemd/systemd/issues/7874 but this exact problem "systemctl disable does not disable sysvinit with alias names" apparently has never been filed upstream, so I filed it now: https://github.com/systemd/systemd/issues/15394 systemd code where it tires to detect if there is a sysvinit file with identical name: https://github.com/systemd/systemd/blob/4c39820562e562b98c2fd269ad3a4f84949d6059/src/systemctl/systemctl.c#L6680 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Faustin Lammler [ 2020-04-10 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
otto thanks for looking deeply into this! I agree with most your solution proposal. But I believe this one is not totally correct: Aliases is not the best solution to increase compatibility with mysql. Instead, "shipping a (static) symlink in the package is the second best thing you can do to align the sysv init script name and the service name, The best you can do (obviously) is to use the same name for the sysv init script and the service file.", I am quoting M. Biebl, see: https://github.com/MariaDB/server/pull/1172#discussion_r305863850 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Otto Kekäläinen [ 2020-04-10 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
They are called aliases also when they are implemented via symlinks. I have been testing with a recent Debian Sid environment and I am actually at the moment unable to reproduce the original bug. Seems like the `/lib/lsb/init-functions` which ends up calling `/lib/lsb/init-functions.d/40-systemd` handles this correctly already. Sources at https://sources.debian.org/src/systemd/245.4-4/debian/extra/init-functions.d/40-systemd/ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Otto Kekäläinen [ 2020-05-17 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
faust Just to be sure, can you please test that latest 10.5 surely does not suffer from this issue anymore? And if there is some corner case where it does suffer, then document how to reproduce that. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Faustin Lammler [ 2020-05-21 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Hi otto! The unique "not so sane" but not problematic scenario is the following (change on /etc are tracked with etckeeper):
Systemd is starting mariadb even if sysv runlevel files were not synchronized by systemctl enable mysql. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Otto Kekäläinen [ 2020-05-21 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Thanks for verifying we are all good now. Since in systemd the 'mysql' is a alias for 'mariadb', it is correct that 'sudo systemctl enable mysql' will enable MariaDB and MariaDB will be running after the next reboot. It does not matter what state the rcXd./XXmariadb files are in, since if the system has systemd (and systemctl), it will do what systemd says ignoring rcXd./XXmariadb status. |