This post details how to switch the database backed used by jabberd on a Spacewalk server to use a SQLite Database so that osa-dispatcher becomes stable.

By default, jabberd when installed for use by Spacewalk uses a Berkeley DB to store session data. This is notoriously flaky which results in osad clients dropping their connection and often requires an administrator to regularly stop the jabberd service, remove the corrupt database and restart it.

The solution is to reconfigure jabberd to use a better database to store its session information.

The following process will switch jabberd to use SQLite instead.

Stop jabberd and osa-dispatcher

Use service on OL6:

# service osa-dispatcher stop
# service jabberd stop

Or systemctl on OL7:

# systemctl stop osa-dispatcher
# systemctl stop jabberd

Edit the jabberd configuration

Edit /etc/jabberd/sm.xml as follows:

--- sm.xml.orig	2017-03-04 07:55:19.162581048 +1100
+++ sm.xml	2017-03-04 08:04:17.154732201 +1100
@@ -91,7 +91,7 @@
     <path>/usr/lib64/jabberd</path>

     <!-- By default, we use the SQLite driver for all storage -->
-    <driver>db</driver>
+    <driver>sqlite</driver>

     <!-- Its also possible to explicitly list alternate drivers for
          specific data types. -->

Edit /etc/jabberd/c2s.xml as follows:

--- c2s.xml.orig	2017-03-04 07:55:25.939274161 +1100
+++ c2s.xml	2017-03-04 08:04:05.179503133 +1100
@@ -386,7 +386,7 @@
     <path>/usr/lib64/jabberd</path>

     <!-- Backend module to use -->
-    <module>db</module>
+    <module>sqlite</module>

     <!-- Available authentication mechanisms -->
     <mechanisms>

Create the SQLite database

Run the following commands to create an empty SQLite database with the required jabberd schema in place and then change ownership of the database to the jabber user:

# sqlite3 /var/lib/jabberd/db/sqlite.db < /usr/share/jabberd/db-setup.sqlite
# chown jabber:jabber /var/lib/jabberd/db/sqlite.db

Start the services again

Using service on OL6:

# service jabberd start
# service osa-dispatcher start

Or using systemctl on OL7:

# systemctl start jabberd
# systemctl start osa-dispatcher

Ensure that SQLite is being used

Check /var/log/messages to make sure that jabberd uses the sqlite storage module.

# cat /var/log/messages | grep sqlite
Feb 24 12:46:18 sw24 jabberd/sm[15196]: loading 'sqlite' storage module
Feb 24 12:46:18 sw24 jabberd/sm[15196]: initialised storage driver 'sqlite'
Feb 24 12:46:18 sw24 c2s: Fri Feb 24 12:46:18 2017 [info] loading 'sqlite' authreg module
Feb 24 12:46:18 sw24 c2s: Fri Feb 24 12:46:18 2017 [notice] initialized auth module 'sqlite'
Feb 24 12:46:18 sw24 jabberd/c2s[15199]: [spacewalk.domain.com] configured; realm=, authreg=sqlite, registration enabled, using PEM:/etc/pki/spacewalk/jabberd/server.pem

Reset and restart osad

If you have already registered client servers and installed osad on those servers, it will most likely be necessary to remove the osad-auth.conf file and restart osad before they will work after the database has been switched.

Using service on OL6:

# service osad stop
# rm -f /etc/sysconfig/rhn/osad-auth.conf
# service osad start

Using systemctl on OL7:

# systemctl stop osad
# rm -f /etc/sysconfig/rhn/osad-auth.conf
# systemctl start osad

This will trigger the osad client on each server to re-authenticate to jabberd.