The ejabberd service does not start
Applies to: Medulla Server
Version: All versions
Environment: On-Premise
Category: Services / ejabberd
If the ejabberd service no longer starts, even after restarting the Medulla server, it may be necessary to reset its Mnesia database.
Caution:
The procedure below deletes ejabberd’s local Mnesia database. It must only be used after performing a full backup of the /var/lib/ejabberd/ directory.
1. Prerequisites
Back up the ejabberd directory
Before proceeding, perform a backup of the entire folder:
/var/lib/ejabberd/
For example:
cp -a /var/lib/ejabberd /var/lib/ejabberd.backup
Verify that the backup is present:
ls -la /var/lib/ejabberd.backup
Install crudini
The crudini command is required to retrieve the information needed to recreate the ejabberd root account.
apt install crudini
2. Stop ejabberd
systemctl stop ejabberd
Verify that the service has stopped:
systemctl status ejabberd
3. Reset the Mnesia database
Delete the files in /var/lib/ejabberd/, while preserving the hidden file .erlang.cookie:
rm -rf /var/lib/ejabberd/*
Note:
The command rm -rf /var/lib/ejabberd/* does not delete hidden files. The .erlang.cookie file is therefore retained.
Verify that it exists before continuing:
ls -la /var/lib/ejabberd/
In particular, the following file must still be present:
.erlang.cookie
4. Restart ejabberd
systemctl start ejabberd
Check the service status:
systemctl status ejabberd
The service should now be in the following state:
active (running)
5. Recreate the ejabberd root account
Once ejabberd has restarted, recreate its root account using the Medulla configuration information:
ejabberdctl register root $(crudini --get /etc/pulse-xmpp-agent/relayconf.ini.local chat domain) $(crudini --get /root/.my.cnf mysql password)
This command automatically retrieves:
- the XMPP domain from
/etc/pulse-xmpp-agent/relayconf.ini.local; - the password from
/root/.my.cnf.
6. Final verification
Check the service status again:
systemctl status ejabberd
If it fails again, check the service logs:
journalctl -u ejabberd --no-pager -n 100
Success:
If ejabberd is in the active (running) state and the root account has been successfully recreated, the Mnesia database reset is complete.