I'm going to use ejabberd under FreeBSD in my organization. Some time ago I've succesfully installed from ports and ran version 0.7.5, then upgraded to 0.9.0 (but! I didn't stop old ejabberd before upgrading). After upgrade I didn't change config file. Now I just cannot start the server:
=============================================================
myserv:pb#55/12:25>su ejabberd -c "/usr/local/bin/ejabberdctl ejabberd@myserv status"
{error_logger,{{2005,5,24},{12,57,53}},'Failed to create cookie file',[]}
.................................................
{"Kernel pid terminated",application_controller,shutdown}
Crash dump was written to: erl_crash.dump
Kernel pid terminated (application_controller) (shutdown)
==============================================================
What's wrong? There is file /var/run/ejabberd/.erlang.cookie:
-rw------- 1 ejabberd ejabberd 20 24 May 00:00 .erlang.cookie
It seems the user that runs
It seems the user that runs ejabberdctl cannot create the file.
myserv:p3#61/10:46>finger
myserv:p3#61/10:46>finger ejabberd
Login: ejabberd Name: ejabberd pseudo user
Directory: /var/run/ejabberd Shell: /bin/sh
Never logged in.
I've specified -setcookie, it doesn't help, it says:
Can't get node ejabberd@asbase status: nodedown
Any other ideas?
now check the node name and cookie content
It DOES help: you don't receive the same error than before.
So your new error deals with the node name (it may not be 'ejabberd@asbase') or with the cookie (it must be the same on the ejabberd server and on ejabberdctl).
But let me ask you: what's exactly your problem? You don't need ejabberdctl to start the server, right? Why are you interested in ejabberdctl?
Cannot start ejabberd 0.9.0
My problem is written in subject. You're right, I don't need ejabberdctl at all. I'll be glad to never know that it exists.
In FreeBSD there's starting script called /usr/local/etc/rc.d/ejabberd.sh. At the start of this script it's calling ejabberdctl to determine status of ... I don't know of what, 'cause I don't know erlang at all. If ejabberdctl returns not 0, then ejabberd.sh tries to start ejabberd. But in my case it returns 0, and ejabberd.sh says:
Starting ejabberd: already running.
That is why I'm asking about ejabberdctl.
I've wrote node name correctly, in script it's ejabberd@`hostname -s`, I've checked (it worked on 0.7.5).
I tried to put -setcookie in /usr/local/bin/ejabberd and /usr/local/bin/ejabberdctl, but no effect.
But! when I tried to run
su ejabberd -c "/usr/local/bin/ejabberd -noshell -detached"
ejabberd started! Still I cannot shutdown it correctly ('cause ejabberd.sh calls ejabberdctl for this task). How can I manage ejabberdctl to work correctly?
At the start of this script
Probably ejabberd.sh uses ejabberdctl to check that ejabberd is not running before starting it. And even if you tweak ejabberd.sh to not check server status on startup, you are right when you say that ejabberdctl is required to stop it. So let's try to solve the problem the right way :)
Since there are no changes on ejabberd 0.7.5 -> 0.9.1 on this subject, this may be a problem in the FreeBSD package. Anyway, once you finally solve it, please tell us what was the reason.
From my experience, reasons for ejabberdctl to not connect to ejabberd (you already checked some of them):
Cannot start ejabberd 0.9.0
I've made tests that you proposed:
-the cookies in ejabberdctl and ejabberd are the same (even more, it's equal to the one in ~ejabberd/.erlang_cookie);
-the node name is correct;
-ejabberd starts erl with -sname ejabberd, and ejabberdctl starts erl with -sname ejabberdctl (no -name in both);
-system user is the same for ejabberd and ejabberdctl;
-ejabberdctl writes nothing to log files, ejabberd when tweaked writes in sasl.log:
=INFO REPORT==== 2005-05-31 11:50:33 ===
I(<0.212.0>:ejabberd_listener:90): (#Port<0.288>) Accepted connection {{127,0,0,1},53273} -> {{127,0,0,1},5555}
P.S. I've changed -sname to ejabberd in file ejabberdctl. Now I can start ejabberd (in process table appears a process), but ejabberdctl status gives me:
Node ejabberd@myserv is starting. Status: started
I get this line when process is running. But if there are no such process, ejabberdctl starts it and says the same! "Ejabberdctl stop" does nothing at all (no messages on console and no stopping server process).
This is what I get with
This is what I get with ejabberd 0.9.1 and Erlang/OTP R10B-5. 'adeja.sh' is a little script that just calls erl, ejabberdctl, etc:
On 'sasl.log':
Things to check:
Cannot start ejabberd 0.9.0
-The process that appears is epmd, it consumes 1,5 MB;
-When I try to run "ejabberd.sh start" no message appears in sasl.log and no message in ejabberd.log;
-No, ejabberd doesn't work correctly for everything else, it just listens on tcp port 4369.
By the way, I'm using 0.9.0, maybe I should upgrade to 0.9.1?
epmd is a little program
epmd is a little program that is automatically started with Erlang. You are not starting ejabberd correctly, or something prevents ejabberd from starting correctly.
Cannot start ejabberd 0.9.0
So, as I see, nothing could be done. Ok, I'm giving up with ejabberd, gonna try jabberd2.