mod_admin_extra: command not known

Dear all,

I was using ejabberd 2.1.6 (CentOS5) with the followwing script to create a list of active users for my 2 virtual hosts:

ejabberdctl srg-delete GROUP VHOST1
ejabberdctl srg-delete GROUP VHOST2
ejabberdctl srg-create GROUP VHOST1 GROUP GROUP_of_all_Users GROUP
ejabberdctl srg-create GROUP VHOST2 GROUP GROUP_of_all_Users GROUP
...
foreach user (...)
   set id = ...
   set domain = ...
   ejabberdctl srg_user_add $id $domain GROUP VHOST1
   ejabberdctl srg_user_add $id $domain GROUP VHOST2
end

Now I installed a new server (15.02, CentOS7) and I got
Error: command "srg-delete" not known.

So I installed mod_admin_extra from git://github.com/processone/ejabberd-contrib.git:

cd .../ejabberd-contrib/mod_admin_extra
./build.sh
cp ebin/mod_admin_extra.beam .../lib/ejabberd-15.02/ebin/

Then I put "mod_admin_extra []" to .../conf/ejabberd.yml and restarted ejabberd, but still I get
Error: command "srg-delete" not known.

What's missing?
TIA
Reinfried

Hello, Can you please paste

Hello,

Can you please paste the module snippets from your configuration file ?
I am not sure mod_admin_extra is correctly defined here.

Here is the part of

Here is the part of ejabberd.yml where I've put mod_admin_extra:

...
##
## Modules enabled in all ejabberd virtual hosts.
##
modules:
...
    access: register
    mod_roster: []
    mod_shared_roster: []
    mod_vcard: []
    mod_version: []
## zusaetzlich:
##  mod_ctlextra: []
    mod_admin_extra: []
...

I took a fresh ejabberd.yml

I took a fresh ejabberd.yml and configured it and now mod_admin_extra can be found, some errors like Error: the command "srg_user_add" requires 1 more argument but now I can work on it.

Thank you!

and this was only an error

and this was only an error within the script, now it works!

Thank you again
Reinfried

If the module isn't listed in

If the module isn't listed in config file, then executing the command will result in:

$ ejabberdctl srg-delete aa localhost
Error: command "srg-delete" not known.

If the module is listed in ejabberd.yml, but the beam file is not in place: when ejabberd starts, it complains in the log file saying this, and ejabberd gets stopped:

11:32:12.789 [critical] Problem starting the module mod_admin_extra for host <<"localhost">> 
 options: []
 error: undef
[{mod_admin_extra,start,[<<"localhost">>,[]],[]},
 {gen_mod,start_module,3,[{file,"src/gen_mod.erl"},{line,82}]},
 {lists,foreach,2,[{file,"lists.erl"},{line,1336}]},
 {ejabberd_app,start,2,[{file,"src/ejabberd_app.erl"},{line,67}]},
 {application_master,start_it_old,4,
                     [{file,"application_master.erl"},{line,272}]}]
11:32:12.789 [critical] ejabberd initialization was aborted because a module start failed.
11:32:15.127 [critical] couldn't find module /lib/ejabberd/ebin/mod_admin_extra.beam needed for application 'ejabberd'

If the module is listed in ejabberd.yml, and the beam file is in place, then the module is started, the commands are shown when requesting information (ejabberdctl help), and the command does not fail:

$ ejabberdctl srg-delete aa localhost
$

In your case, see the ejabberd log files in case ejabberd complains about some problem at server start. Also check if other commands provided by mod_admin_extra are available or not.

There are no lines with

There are no lines with mod_admin_extra in any log file.

I showed where I have mod_admin_extra in ejabberd.yml and here is a part of the directory listing of .../jabber/lib/ejabberd-15.02/ebin

...
-rw-r--r-- 1 root root  3144 Feb 16 15:35 mod_adhoc.beam
-rw-r--r-- 1 root root 30052 Mar  3 16:32 mod_admin_extra.beam
-rw-r--r-- 1 root root 13572 Feb 16 15:35 mod_announce.beam
-rw-r--r-- 1 root root  6641 Feb 16 15:35 mod_blocking.beam
...

If I read the source of mod_admin_extra.erl I can see that the function is not srg-delete but srg_delete, but it doesn't make a difference. If I start build.sh I get

src/mod_admin_extra.erl:610: Warning: crypto:md5/1 is deprecated and will be removed in in a future release; use crypto:hash/2
src/mod_admin_extra.erl:613: Warning: crypto:sha/1 is deprecated and will be removed in in a future release; use crypto:hash/2

but I think that's no problem.

If I check for other commands like srg-list I get again Error: command "srg-list" not known.

Now I tried to remove

Now I tried to remove mod_admin_extra.beam from .../lib/ejabberd-15.02/ebin and it didn't change anything - no errors in any log file after restart, so maybe ejabberd.yml is still not correct?

ejabberdctl help gives

   backup file
   connected_users
   connected_users_number
   convert_to_yaml in out
   delete_expired_messages
   delete_old_messages days
   dump file
   dump_table file table
   export2odbc host directory
   export_odbc host file
   export_piefxis dir
   export_piefxis_host dir host
   get_loglevel
   help [--tags [tag] | com?*]
   import_dir file
   import_file file
   import_piefxis file
   incoming_s2s_number
   install_fallback file
   kick_user user host
   load file
   mnesia [info]
   mnesia_change_nodename oldnodename newnodename oldbackup newbackup
   outgoing_s2s_number
   register user host password
   registered_users host
   registered_vhosts
   reload_config
   rename_default_nodeplugin
   reopen_log
   restart
   restore file
   set_master nodename
   status
   stop
   stop_kindly delay announcement
   unregister user host
   update module
   update_list
   user_resources user host

no srg_ or srg-commands

Are you sure you do not have

Are you sure you do not have an ejabberd.cfg file that is taking precedence over that ejabberd.yml file ?

# cd /home/jabber/confconf #

# cd /home/jabber/conf
conf # ls -al
total 36
drwxr-x--- 2 root root    94 Mar  5 09:24 .
drwxr-xr-x 9 root root   146 Mar  3 16:29 ..
-rw-r--r-- 1 root root  4638 Mar  3 16:24 ejabberdctl.cfg
-rw-r--r-- 1 root root 15836 Mar  4 12:31 ejabberd.yml
-rw-r----- 1 root root   111 Mar  3 16:24 inetrc
-rw-r----- 1 root root   419 Nov 22  2012 odbc.ini
-rw-r----- 1 root root   550 Mar  3 16:24 odbcinst.ini
conf #

Thanks. I think anyway that

Thanks. I think anyway that the config file you are modifying is not the one used, as you say that removing the module does not trigger any error in the log. It means that the config file you are modifying has no impact, thus it tend to think it is not used: if you have declared mod_admin_extra in the config and deleted the beam, you should have an entry about the issue in the log when you start ejabberd.

If I edit this conf-file with

If I edit this conf-file with for example a not correct mod_shared_roster_ldap

    mod_shared_roster_ldap: [{ldap_base, "ou=Angehoerige,o=tug"},
      {ldap_rfilter, "(objectClass=inetOrgPerson)"},
      {ldap_filter,  "(objectClass=inetOrgPerson)"},
      {ldap_userdesc, "fullName"}]

I get an error

# cat .../logs/crash.log
2015-03-05 13:12:39 =CRASH REPORT====
  crasher:
    initial call: application_master:init/4
    pid: <0.36.0>
    registered_name: []
    exception exit: {{bad_return,{{ejabberd_app,start,[normal,[]]},{'EXIT',{undefined_macro,''}}}},[{application_master,init,4,[{file,"application_master.erl"},{line,133}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,239}]}]}
    ancestors: [<0.35.0>]
    messages: []
    links: [<0.35.0>,<0.37.0>,<0.7.0>]
    dictionary: []
    trap_exit: true
    status: running
    heap_size: 610
    stack_size: 27
    reductions: 129
  neighbours:

so for me it looks like it does use this file

Well, you said: " I tried to

Well, you said: " I tried to remove mod_admin_extra.beam from .../lib/ejabberd-15.02/ebin and it didn't change anything - no errors in any log file after restart"

This is a problem as it should show an error after restart if module is not found.

There is something inconsistent.

Syndicate content