jabber-at/ejabberd

Incorrect behaviour of initscript on systemd

Closed this issue · 10 comments

While using an initscript from ejabberd tarball I have noticed effects as systemd considering ejabberd startup failure, and failing to property restart ejabberd.
To fix this I suggest shipping either ejabberd's systemd service or initscript from Debian's official ejabberd package.

Something like that (also removes 'cp' which is not recommended):

--- a/debian/rules
+++ b/debian/rules
@@ -30,8 +30,9 @@
 override_dh_auto_install:
    dh_auto_install
    rm $(DESTDIR)/etc/ejabberd/ejabberd.yml
-   mkdir $(DESTDIR)/etc/init.d $(DESTDIR)/etc/default
-   cp ejabberd.init $(DESTDIR)/etc/init.d/ejabberd
+   install -Dm 0644 ejabberd.service $(DESTDIR)/lib/systemd/system/ejabberd.service
+   install -Dm 0644 ejabberd.init $(DESTDIR)/etc/init.d/ejabberd
+   mkdir -p $(DESTDIR)/etc/default/
    mv $(DESTDIR)/etc/ejabberd/ejabberdctl.cfg $(DESTDIR)/etc/default/ejabberd
    ln -s ../default/ejabberd $(DESTDIR)/etc/ejabberd/ejabberdctl.cfg
    rm -r $(DESTDIR)/var/lock

As far as I can tell, the only functional difference is the install -Dm 0644 ejabberd.service ... line - right?

I just published a package that installs the systemd script.

I have only added that single line, because I try to stay as close to the upstream package as possible.

@mathiasertl You did something wrong with new package. I have Debian 8 and I have error when I try to upgrade ejabberd from Your repo:

Setting up ejabberd (1:15.04-3~afa80) ...
update-rc.d: error: initscript does not exist: /etc/init.d/ejabberd
dpkg: error processing package ejabberd (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 ejabberd
E: Sub-process /usr/bin/dpkg returned an error code (1)

I don't have this file because I have systemd script :)

Why don't you have this file? It's installed by the package:

$ dpkg -c jabberd_15.04-3~afa80_amd64.deb | grep etc/init.d/ejabberd
-rwxr-xr-x root/root      2208 2015-06-06 23:29 ./etc/init.d/ejabberd

PS: Please don't comment on an already closed issue on a different subject, please file a new issue instead (others with the same problem might find it and comment, this won't happen here).

I reopened the issue now until this is solved.

I do not see the problem either: file is there and so update-rc.d should see it.
Also postinst works just fine for me (on systemd).

@XRevan86 thanks for the feedback!

@mathiasertl I don't know why I don't have this file but your package don't install it.

Okay, I unpacked .deb file to get /etc/init.d/ejabberd, I reinstalled ejabberd and now seem to be ok.