Long Error Message: Unable to Start ejabberd

I've recently made the switch to ejabberd, but am unable to decipher this error message, which ejabberd gets whenever I run it:

{error_logger,{{2008,1,22},{16,3,39}},"Protocol: ~p: register error: ~p~n",["inet_tcp",{{badmatch,{error,duplicate_name}},[{inet_tcp_dist,listen,1},
{net_kernel,start_protos,4},{net_kernel,start_protos,3},
{net_kernel,init_node,2},{net_kernel,init,1},{gen_server,init_it,6},{proc_lib,init_p,5}]}]}
{error_logger,{{2008,1,22},{16,3,39}},crash_report,
  [[{pid,<0.21.0>},{registered_name,net_kernel},
  {error_info,{exit,{error,badarg},
   [{gen_server,init_it,6},{proc_lib,init_p,5}]}},
  {initial_call,{gen,init_it,[gen_server,<0.18.0>,<0.18.0>,
  {local,net_kernel},net_kernel,{ejabberd,shortnames,15000},[]]}},
  {ancestors,[net_sup,kernel_sup,<0.8.0>]},{messages,[]},{links,[#Port<0.7>,<0.18.0>]},
  {dictionary,[{longnames,false}]},{trap_exit,true},{status,running},
  {heap_size,610},{stack_size,23},{reductions,437}],[]]}
...
{error_logger,{{2008,1,22},{16,3,39}},std_info,
  [{application,kernel},{exited,{shutdown,{kernel,start,[normal,[]]}}},{type,permanent}]}
{"Kernel pid terminated",application_controller,"
  {application_start_failure,kernel,{shutdown,{kernel,start,[normal,[]]}}}"}

Crash dump was written to: erl_crash.dump
Kernel pid terminated (application_controller)
({application_start_failure,kernel,{shutdown,{kernel,start,[normal,[]]}}})

This is my ejabberd.cfg file with passwords replaced:

% $Id: ejabberd.cfg.example 577 2006-06-07 08:38:37Z mremond $
...
% End:

I'm trying to use PostgreSQL as my database backend, using ODBC (which is compiled into both ejabberd and Erlang). I've also bzcat'd the ejabberd schema into Postgres.

What does this error message mean? What can I do to fix it?

ejabberd already running?

takeshita_kenji wrote:

which ejabberd gets whenever I run it:

{error_logger,{{2008,1,22},{16,3,39}},"Protocol: ~p: register error: ~p~n",
["inet_tcp",{{badmatch,{error,duplicate_name}},[{inet_tcp_dist,listen,1},
...

What does this error message mean? What can I do to fix it?

Take a look at this page: error, duplicate_name, and let's hope it solves your problem.

takeshita_kenji wrote:

I'm trying to use PostgreSQL as my database backend, using ODBC (which is compiled into both ejabberd and Erlang).
I've also bzcat'd the ejabberd schema into Postgres.

I think this is not related.

Offtopic: if you use pgsql also for authentication, once you get ejabberd running maybe you find another problem: accounts are created in the Pgsql DB, but you are not allowed to login.
This bug is present in the pgsql Erlang driver from ejabberd-modules SVN, and also in the ejabberd-2.0.0-beta and -rc1 binary installers.

Tracked here: Authentication with pgsql driver is broken

A fixed version: http://tkabber.jabber.ru/files/badlop/pgsql_util.beam

It looks like the init

It looks like the init system was starting up ejabberd, which I stopped. There aren't any errors at the moment, but it looks like SSL isn't working, nor are TLS or even plaintext. I'm shooting for port 5223 SSL like I had with Jabberd2 until it started getting segfaults whenever I ran it. This is just to register a user, too:

# grep -E '(ssl|tls)' -A2 -B2 /etc/jabber/ejabberd.cfg
[{5222, ejabberd_c2s,     [{access, c2s}, {shaper, c2s_shaper},
    {max_stanza_size, 65536},
    starttls, {certfile, "/etc/jabber/kenji-m.zapto.org.pem"}]},
  {5223, ejabberd_c2s,     [{access, c2s},
    {max_stanza_size, 65536},
    tls, {certfile, "/etc/jabber/kenji-m.zapto.org"}]},
  % Use these two lines instead if TLS support is not compiled
  %{5222, ejabberd_c2s,     [{access, c2s}, {shaper, c2s_shaper}]},
  %{5223, ejabberd_c2s,     [{access, c2s}, ssl, {certfile, "/etc/jabber/kenji-m.zapto.org.pem"}]},
  {5269, ejabberd_s2s_in,  [{shaper, s2s_shaper},
    {max_stanza_size, 131072}
--

% Use STARTTLS+Dialback for S2S connections
{s2s_use_starttls, false}.
%{s2s_use_starttls, true}.
%{s2s_certfile, "./ssl.pem"}.
%{domain_certfile, "example.org", "./example_org.pem"}.
%{domain_certfile, "example.com", "./example_com.pem"}.

Test for auth and connection

takeshita_kenji wrote:

There aren't any errors at the moment, but it looks like SSL isn't working, nor are TLS or even plaintext. I'm shooting for port 5223 SSL like I had with Jabberd2

I plan to write a guide 'Best practices to explain a problem'. I'll probably use most of the text here. So, some of my response is not explicitely for you.

The purpose of this test is to check which type of client connections work correctly in your Jabber server.

  1. Stop ejabberd. Make sure it is stopped.
  2. Start ejabberd.
  3. Check the log files (ejabberd.log and sasl.log), is there any error message?
    • If there are errors, show here in a comment.
    • If no errors, then continue:
      1. Try to create an account using a Jabber client, port 5222, without encryption. Does it succeed?
        • If creation does not succeed, then check if there is any error message in the log files:
          • If there are errors, show here in a comment.
          • If there aren't error messages, abort this test.
        • If creation succeeds, now try to login, using 5222 without encryption as before. Can you login?
          • If you can't login, check the log files, is there any error message?
            • If there are errors, show here in a comment.
            • If there aren't error messages, abort this test.
          • If you can login, continue.
      2. If you reached this step, it means you can create accounts and login to them using the port 5222 without encryption. Now you must check if you can use encrypted connections (STARTTLS in port 5222 and old SSL in port 5223). Configure a Jabber client to connect to port 5222 using encryption (it may be called STARTTLS or simply TLS in the Jabber client). Can you login?
        • If you can't login, check the log files, is there any error message?
          • If there are errors, show here in a comment.
          • If there aren't error messages, abort this test.
        • If you can login, continue.
      3. If you reached this step, it means you can create accounts and login to them using the port 5222 without encryption. You can also login using STARTTLS encryption in port 5222. Now you must check if you can login using SSL encryption in port 5223. Configure a Jabber client to connect to port 5223 using encryption (it may be called SSL in the Jabber client). Can you login?
        • If you can't login, check the log files, is there any error message?
          • If there are errors, show here in a comment.
          • If there aren't error messages, abort this test.
        • If you can login, then your server works correctly!!!

If you find an error message in the log files, show it here, and also search in this site and in Internet. Quite probably other people saw the same error message and explained a solution. When you find one or several error messages in ejabberd log files, show all of them (unless they repeat constantly).

If you suspect the problem is a syntax mistake in your ejabberd.cfg file, then show all your file (you can replace the private data with **** if you want). If you only modified a few lines in {listen, or in {modules, or similar; then you don't need to show all your configuration file: you can simply show the whole sections that got affected (the {listen ... } section, etc).

If you aborted the test without success, it means you reached a pretty bad situation: something abnormal happens in your server but there isn't an error report or a crash file to investigate the problem. In that case:

  1. Try to uninstall ejabberd completely, install again and proceed with the test before doing any change in the ejabberd configuration.
  2. If that also fails, try the same installation method in a different machine.
  3. Or try to install ejabberd in your machine, with a different method (binary installer, operating system package, source code compilation, ...)

If you are lost, you can start a thread explaining your problem. In such case, provide meaningful and summarized information of your setup. Some of the information that you can provide:

  • What abnormal behaviour do you see in ejabberd
  • How did you install ejabberd
  • What version of ejabberd.
  • If you installed Erlang, mysql, pgsql, additional librearies because they were needed, please detail how did you install them, and which version.
  • If you made changes in ejabberd.cfg, or the ejabberd start script.
  • What Jabber clients did you try.
  • Your operating system, version, CPU architecture, kernel version and kernel architecture.
  • If you made additional tests in other machines, or with other versions of ejabberd, etc: please also mention that information.
  • Can you reproduce the problem in your machine, or in several of your machines?
  • Can your problem be reproduced in other machines? That means: do you know how I can reproduce the same problem in my machine? This is important when the problem is a bug in ejabberd.

If you don't know some of this data, or you consider it isn't important, don't worry. If later it seems important, it will be requested and you can provide in another comment.

Note that the people that try to help in the forums and mailing lists spends time for free. This means that they only invest a part of their spare time. So, sometimes you get a response in 5 hours, and sometimes you get a response in 5 days. Some problems are easier to answer than others, and not all the people know the answer to all problems. Maybe some questions get a lot of responses fast, and other questions only get a response after several days. If your question did not receive any response after a full week, quite probably the people that read the forum doesn't know the answer and can't help.

Sorry about waiting so long.

Sorry about waiting so long. I get a "connection refused" in Pidgin when trying to do anything (account creation included) involving Jabber towards my server, and with ejabberd (beam.smp) running, either with or without SSL/TLS on the appropriate ports.

As far as I can tell, there are no errors, especially since none of the lines since my last try at getting this working contain any:

==> ejabberd.log <==
=INFO REPORT==== 2008-02-21 16:50:54 ===
I(<0.9458.1>:ejabberd_s2s_in:341): VERIFY KEY: {"kenji-m.zapto.org",
                                                "gmail.com",
                                                "EE82E356F1EE2C1A",
                                                "1622069622"}

=INFO REPORT==== 2008-02-21 16:50:54 ===
I(<0.9460.1>:ejabberd_s2s_out:249): recv result: {"gmail.com",
                                                  "kenji-m.zapto.org",[],
                                                  "valid"}

==> sasl.log <==
                           {mod_pubsub,start_link,
                               ["kenji-m.zapto.org",
                                [{access_createnode,pubsub_createnode}]]}},
                       {restart_type,temporary},
                       {shutdown,1000},
                       {child_type,worker}]

=PROGRESS REPORT==== 23-Feb-2008::00:56:14 ===
         application: ejabberd
          started_at: ejabberd@superbob

I've checked my Netfilter logs, and there are no dropped packets involved. Why would the connection be refused on every try?

Purge completely and install slowly

So your ejabberd server is completely useless right now? If I understood correctly, you installed ejabberd from source code package.

I propose a drastic solution:

  1. Stop ejabberd.
  2. Uninstall completely ejabberd, including the config files in /etc/ejabberd, binary files in /var/lib/ejabberd (or whatever), log files in /var/log/ejabberd, and start script in /sbin/ejabberdctl
  3. Now that you removed everything related to ejabberd, download it again, compile and install. For example:
    $ wget ...
    $ tar -xzf ...
    $ cd ejabberd-2.0.0/src
    $ ./configure --enable-odbc
    $ make
    # sudo make install
  4. Do NOT configure ejabberd: don't modify ejabberd.cfg. Immediately after installing it, try to start with: /sbin/ejabberdctl
  5. Check the directory /var/log/ejabberd It should have ejabberd.log with only some INFO REPORT, and sasl.log with many PROGRESS REPORT.
  6. Try to connect with ejabberd, with a simple telnet:
    $ telnet localhost 5222
    Trying 127.0.0.1...
    Connected to localhost.
    Escape character is '^]'.
    aaaa
    <?xml version='1.0'?>
      <stream:stream xmlns='jabber:client' 
        xmlns:stream='http://etherx.jabber.org/streams' id='none' from='localhost'
        version='1.0'>
        <stream:error>
        <xml-not-well-formed 
           xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
        </stream:error>
      </stream:stream>Connection closed by foreign host.
    $
  7. If that worked, now try to connect with a Jabber client, and create an account. Your server is still 'localhost', and you can only use plaintext connection, because you are still using the default ejabberd.cfg.
  8. If you reached to this step, then you are a lot better than you were with the previous ejabberd installation, right? Because now you can connect to port 5222.
  9. Now you can make small changes in ejabberd.cfg, restart ejabberd each time you make a change and ensure with a Jabber client that all continues working correctly. Change your server name, enable TLS, database storage, etc. Remember to make only a change at a time, and check that ejabberd starts correctly.
Syndicate content