Ejabberdctl throws an error in /var/log/messages on backup

OS: NethServer 7.8.2003
Module: nethserver-ejabberd-1.8.1-1

It’s maybe just cosmetic as the ejabberd backup/restore process is working but I found following error in /var/log/messages:

Aug 16 06:00:20 server2 esmith::event[16978]: sed: can't read /opt/ejabberd-20.03/conf/ejabberd.yml: No such file or directory
Aug 16 06:00:20 server2 esmith::event[16978]: sed: can't read /opt/ejabberd-20.03/conf/ejabberd.yml: No such file or directory
Aug 16 06:00:20 server2 esmith::event[16978]: sed: can't read /opt/ejabberd-20.03/conf/ejabberd.yml: No such file or directory
Aug 16 06:00:20 server2 esmith::event[16978]: sed: can't read /opt/ejabberd-20.03/conf/ejabberd.yml: No such file or directory
Aug 16 06:00:20 server2 su: (to ejabberd) root on none
Aug 16 06:00:20 server2 esmith::event[16978]: 2020-08-16 06:00:20.343931
Aug 16 06:00:20 server2 esmith::event[16978]: args: ["/opt/ejabberd-20.03/conf/inetrc"]
Aug 16 06:00:20 server2 esmith::event[16978]: format: "inet_config: file ~ts not found~n"
Aug 16 06:00:20 server2 esmith::event[16978]: label: {error_logger,error_msg}
Aug 16 06:00:20 server2 esmith::event[16978]: =ERROR REPORT==== 16-Aug-2020::06:00:20.343931 ===
Aug 16 06:00:20 server2 esmith::event[16978]: inet_config: file /opt/ejabberd-20.03/conf/inetrc not found

It’s about ejabberctl missing it’s config dir.
I think best solution is using a /opt/ejabberd-20.03/conf/ejabberdctl.cfg file for setting correct values with following content:

LOGS_DIR=/var/log/ejabberd
EJABBERD_CONFIG_PATH=/etc/ejabberd/ejabberd.yml
ETC_DIR=/etc/ejabberd
SPOOL_DIR=/var/lib/ejabberd

Alternative solution:

Add --config-dir /etc/ejabberd to ejabberctl calls in /etc/e-smith/events/actions/nethserver-ejabberd-backup, /etc/e-smith/events/actions/nethserver-ejabberd-restore and maybe /etc/cron.daily/ejabberd-purge-mod_mam-database.

2 Likes

let me try to reproduce, thank for your input

1 Like

I cannot reproduce, sorry

launching the two actions for the backup and the restore process in a VM and in my server, I have no errors in logs

[root@prometheus ~]# /etc/e-smith/events/actions/nethserver-ejabberd-backup
[root@prometheus ~]# /etc/e-smith/events/actions/nethserver-ejabberd-restore

only this in log

Aug 17 15:58:52 prometheus su: (to ejabberd) root on pts/0
Aug 17 15:58:52 prometheus su: (to ejabberd) root on pts/0
Aug 17 15:59:00 prometheus su: (to ejabberd) root on pts/0
Aug 17 15:59:00 prometheus su: (to ejabberd) root on pts/0
1 Like

Thanks, I’m going to recheck in a VM.

1 Like

could you valid this please

[root@ns7dev10 ~]# systemctl cat ejabberd.service

# /usr/lib/systemd/system/ejabberd.service
[Unit]
Description=ejabberd XMPP Server
After=network.target

[Service]
Type=forking
User=ejabberd
Group=ejabberd
LimitNOFILE=65536
Restart=on-failure
RestartSec=5
Environment=LOGS_DIR=/var/log/ejabberd 
Environment=EJABBERD_CONFIG_PATH=/etc/ejabberd/ejabberd.yml 
Environment=ETC_DIR=/etc/ejabberd
Environment=SPOOL_DIR=/var/lib/ejabberd
ExecStart=/bin/sh -c "/opt/ejabberd-20.03/bin/ejabberdctl start && /opt/ejabberd-20.03/bin/ejabberdctl started"
ExecStop=/bin/sh -c "/opt/ejabberd-20.03/bin/ejabberdctl stop && /opt/ejabberd-20.03/bin/ejabberdctl stopped"
ExecReload=/bin/sh -c "/opt/ejabberd-20.03/bin/ejabberdctl reload_config"
PrivateDevices=true


[Install]
WantedBy=multi-user.target

all the path are given at the ENV of the systemd unit

1 Like

Yes, I have the same service file and it works for starting/stopping the service but it did not work without these errors on my server when using ejabberdctl from command line. I am going to recheck and report…

1 Like

It turned out it was a wrong default home dir for the ejabberd user and the ejabberdctl script uses the ejabberd user.

[root@server2 ~]# getent passwd ejabberd
ejabberd:x:1000:1000::/opt/ejabberd-16.01:/bin/bash

After changing the homedir it just worked without errors.

usermod -d /opt/ejabberd ejabberd

I think it’s from an old update or ejabberd testing.
I found similar error here.

2 Likes