You are not logged in.

#1 2013-05-22 18:52:14

tixetsal
Member
Registered: 2013-05-22
Posts: 2

ejabberd starts via "ejabberdctl start" not "systemctl start ejabberd"

**EDITED** You can ignore most of the wall-o-text below, as I think that I've found the most important fact in this problem, but I still can't figure out what the cause is.

I can start ejabberd with

ejabberdctl start

but NOT with

systemctl start ejabberd

Spawning the process via systemctl only starts the "empd -daemon process". Does anyone ny ideas why that would be the case?

**END OF EDIT**

Hi, folks.

I've been using linux for the last 5 years or so, and I've just made the decision to migrate my home server from Ubuntu 10.04 to Arch, so I'm setting up things that I've previously setup on Ubuntu (and other distros) on Arch. So far, I'm really enjoying how lean Arch is.

I've configured ejabberd similarly to how I had it running on Ubuntu, and everything works great when I start ejabberd (as root) via "ejabberdctl live". Chat works great and ps shows that processes are running:

[user@brpc ~]$ ps aux | grep -i jabber
ejabberd   349  0.0  0.0   7348   312 ?        S    18:00   0:00 /usr/lib/erlang/erts-5.10.1/bin/epmd -daemon
root       738  0.0  0.0  11788  1592 pts/0    S+   18:16   0:00 /bin/sh /usr/sbin/ejabberdctl live
root       764 12.0  1.1 292424 40012 pts/0    Sl+  18:16   0:01 /usr/lib/erlang/erts-5.10.1/bin/beam -K true -P 250000 -- -root /usr/lib/erlang -progname erl -- -home /var/lib/ejabberd -- -sname ejabberd@localhost -pa /usr/lib/ejabberd/ebin -mnesia dir "/var/lib/ejabberd" -kernel inet_dist_use_interface {127,0,0,1} -s ejabberd -smp auto live

So, thinking that everything was grand since live mode worked, I ran "systemctl enable ejabberd" and rebooted the machine to test the service, but when it came back up, chat was not working, /var/log/ejabberd/ was devoid of new log output, and I didn't see the "beam" process running. Ejabberd is not being started for some reason, although the empd process is running:

[root@brpc etc]# ps aux | grep -i jabber
ejabberd   349  0.0  0.0   7348   312 ?        S    18:00   0:00 /usr/lib/erlang/erts-5.10.1/bin/epmd -daemon

Does anyone have any idea why the service is not being fired-up upon boot? I configured ejabberd with the info from this guide https://wiki.archlinux.de/title/Ejabberd combined with the knowledge that I already had from running ejabberd on Ubuntu.

My best guess would be that there's a permissions issue, since everything works well when spawned as root, but I'm not sure what the permissions problem is, due to there being no ejabberd logs.

These are the permissions of /etc/ejabberd:

drwxr-x--- 2 root ejabberd   4096 May 22 17:51 ejabberd

Running "systemctl start ejabberd" does not produce any output, but it does start this process:

ejabberd   490  0.0  0.0   7348   316 ?        S    18:38   0:00 /usr/lib/erlang/erts-5.10.1/bin/epmd -daemon

and then "systemctl status ejabberd" shows:

ejabberd.service - A distributed, fault-tolerant Jabber/XMPP server
   Loaded: loaded (/usr/lib/systemd/system/ejabberd.service; disabled)
   Active: active (running) since Wed 2013-05-22 18:38:14 UTC; 45s ago
  Process: 482 ExecStart=/usr/bin/erl -pa /usr/lib/ejabberd/ebin -sname ejabberd -s ejabberd -ejabberd config "/etc/ejabberd/ejabberd.cfg" log_path "/var/log/ejabberd/ejabberd.log" -sasl sasl_error_logger \{file,"/var/log/ejabberd/sasl.log"\} -mnesia dir "/var/lib/ejabberd" -detached -kernel inetrc "/etc/ejabberd/inetrc" (code=exited, status=0/SUCCESS)
   CGroup: name=systemd:/system/ejabberd.service
           └─490 /usr/lib/erlang/erts-5.10.1/bin/epmd -daemon

May 22 18:38:14 brpc systemd[1]: Started A distributed, fault-tolerant Jabber/XMPP server.

But no TCP ports are opened on the machine. If I run "ejabberdctl live", everything works as expected.

I've been troubleshooting this for a few hours, and I'm stumped. I'd be happy to provide more information if anyone has any ideas.

Last edited by tixetsal (2013-05-22 19:26:53)

Offline

#2 2013-05-30 20:30:59

AshXan
Member
Registered: 2012-09-08
Posts: 1

Re: ejabberd starts via "ejabberdctl start" not "systemctl start ejabberd"

Offline

#3 2013-06-09 03:29:57

tixetsal
Member
Registered: 2013-05-22
Posts: 2

Re: ejabberd starts via "ejabberdctl start" not "systemctl start ejabberd"

AshXan wrote:

Hi, thanks for your response. Unfortunately, changing that ExecStart line didn't properly start ejabberd and open TCP ports on my machine, but it did give me a nudge in a helpful direction... I had to change the User and the ExecStart values in /etc/systemd/system/multi-user.target.wants/ejabberd.service to read:

[Unit]
Description=A distributed, fault-tolerant Jabber/XMPP server
After=network.target

[Service]
Type=forking
User=root
LimitNOFILE=16000
RestartSec=5
ExecStart=/usr/bin/erl -pa /usr/lib/ejabberd/ebin -sname ejabberd@localhost -s ejabberd -ejabberd config \"/etc/ejabberd/ejabberd.cfg\" log_path \"/var/log/ejabberd/ejabberd.log\" -sasl sasl_error_logger \{file,\"/var/log/ejabberd/sasl.log\"\} -mnesia dir \"/var/lib/ejabberd\" -detached -kernel inetrc \"/etc/ejabberd/inetrc\"

[Install]
WantedBy=multi-user.target

I really don't like running as root, but this gets chat up and running until I can figure out what is wrong with permissions.

Offline

#4 2014-09-04 14:30:48

arteme
Member
Registered: 2014-09-04
Posts: 1

Re: ejabberd starts via "ejabberdctl start" not "systemctl start ejabberd"

I am hitting this same problem. From a quick look, systemd is running "ejabberdctl start" as user "ejabberd". If I run "ejabberdctl live" as user "ejabberd", I get the following:

 Eshell V6.1  (abort with ^G)
(ejabberd@localhost)1> 18:29:11.279 [error] Failed to open log file /var/log/ejabberd/ejabberd.log with error permission denied
(ejabberd@localhost)1> 18:29:11.279 [error] Failed to open log file /var/log/ejabberd/error.log with error permission denied
(ejabberd@localhost)1> 18:29:11.465 [info] Application lager started on node ejabberd@localhost
(ejabberd@localhost)1> 18:29:11.475 [info] Application sasl started on node ejabberd@localhost
(ejabberd@localhost)1> 18:29:11.482 [info] Application crypto started on node ejabberd@localhost
(ejabberd@localhost)1> 18:29:11.491 [info] Application asn1 started on node ejabberd@localhost
(ejabberd@localhost)1> 18:29:11.491 [info] Application public_key started on node ejabberd@localhost
(ejabberd@localhost)1> 18:29:11.500 [info] Application ssl started on node ejabberd@localhost
(ejabberd@localhost)1> 18:29:11.503 [info] Application p1_yaml started on node ejabberd@localhost
(ejabberd@localhost)1> 18:29:11.509 [info] Application p1_tls started on node ejabberd@localhost
(ejabberd@localhost)1> 18:29:11.513 [info] Application p1_xml started on node ejabberd@localhost
(ejabberd@localhost)1> 18:29:11.515 [info] Application p1_stringprep started on node ejabberd@localhost
(ejabberd@localhost)1> 18:29:11.517 [info] Application p1_zlib started on node ejabberd@localhost
(ejabberd@localhost)1> 18:29:11.519 [info] Application p1_cache_tab started on node ejabberd@localhost
(ejabberd@localhost)1> 18:29:11.564 [error] CRASH REPORT Process <0.39.0> with 0 neighbours exited with reason: {aborted,{"Cannot read schema","/var/lib/ejabberd/schema.DAT",{error,{file_error,"/var/lib/ejabberd/schema.DAT",eacces}}}} in application_master:init/4 line 133
(ejabberd@localhost)1> 18:29:11.564 [info] Application ejabberd exited with reason: {aborted,{"Cannot read schema","/var/lib/ejabberd/schema.DAT",{error,{file_error,"/var/lib/ejabberd/schema.DAT",eacces}}}}
(ejabberd@localhost)1> 18:29:11.774 [error] Failed to open crash log file /var/log/ejabberd/crash.log with error: permission denied

look like some "chmod" action is in order...

Offline

Board footer

Powered by FluxBB