One of the problems with having just two people living in an old, rambling house is that you spend a lot of time shouting.
My More Significant Other (MSO) and I work in different parts of the house – I have an office and she prefers to work on her laptop in the living room. We often need to communicate (yes, the romance is still strong) and have been known to email each other several times a day, as well as using our DECT phones in intercom mode. But sometimes you just want to exchange a few words, and yelling seemed the most effective way.
We recently rejigged the house. Now my office is on the top floor of the three-story building. Shouting is no longer an option.
So it was time to Jabber.
It would have been easy enough to install XMPP chat clients like Adium (which is indeed what we’re using) and sign up for an online account at, say, Jabber.org. But that’s not nearly enough fun.
Our home network currently has a Raspberry Pi 3B+ running PiHole, to give us a blissfully ad-free life. But PiHole is a lightweight service that doesn’t really need a Pi all to itself. I’m also using it for occasional, minor FTP services (mainly to get files on and off my old PowerBook 3400C). But it’s still not breaking a sweat. So it seemed like a perfect candidate for an XMPP server.
After some research, I decided to go with ejabberd because it would give us all the functionality we need with a pretty simple install. Or so it seemed.
I know a lot of people like Prosody because it has lots of optional, open-source modules and is hackable, being built on Lua (whereas ejabberd is based on Erlang). But for this particular application, we just don’t need bells and whistles.
Installing ejabberd under Raspbian couldn’t be easier. Just:
sudo apt install ejabberd
Then you need to set up an admin account:
sudo dpkg-reconfigure ejabberd
This will prompt you for a few things. The first is the domain. I tried to get clever here, and this turned out to be my downfall. I’m not going to go into every detail – I can’t remember much of what came next – but suffice to say it makes a lot of sense just to accept the default option of ‘localhost’. From here on out, we’ll pretend that that’s what I did.
You’ll then be prompted for a username and password for the admin account. These, of course, should be ‘admin’ and ‘password’. (Just kidding – always use strong passwords, kids.)
The next step is to use your favourite laptop or desktop to log in to ejabberd’s admin console via the browser. My RPi has an IP address of 10.0.1.20 so the URL is:
Note the port number in there. You should be able to log in with the admin credentials you created earlier – the one thing to note is that you log in as ‘admin@localhost’, not just ‘admin’. You can then set up users – select the ‘localhost’ virtual host and go from there. These users can then log in using the usernames <user>@localhost and the passwords you give them.
This is when I hit a problem.
I installed Adium on my laptop and logged in. All looked fine, but then I noticed that I was being logged out around every 15 seconds or so. Adium would reconnect, but the same thing would happen again and again. Looking at the account configuration in Adium I saw a notice saying that there was an error due to a ‘policy violation’.
The ejabberd logs were unhelpful.
I started to think that my clever use of a domain other than ‘localhost’ was the culprit (I’m now not so sure, but still…). I tried editing the ejabberd config file, tried putting various entries in /etc/hosts but nothing solved the problem.
Next, I tried uninstalling (sudo apt remove ejabberd) and reinstalling ejabberd many times. If you uninstall in this way, it has a tendency to leave behind a number of files in places such as /etc/ejabberd/, /etc/systemd/system/ and /etc/init.d/.
In the end, I’d messed around so much that ejabberd would no longer install cleanly. Things were starting to look seriously b0rked. It took a while to realise that I should have uninstalled using:
sudo apt remove –purge ejabberd
That removes the config files too. Once I’d done that, I was able to reinstall ejabberd again cleanly. This time I used localhost as the domain name.
But that brought me back to the earlier problem. I was still getting those regular log-outs with the policy violation notice in Adium on the laptop.
I needed to switch to using my desktop machine, so I installed Adium on that, connected to the ejabberd server using the same account and … no problem. No policy violation. Everything tickety-boo.
WTF? Then came the obvious step – going through the Adium preferences on laptop and desktop to see where any differences might lie. And the problem?
Yup. In the accounts preferences, under ‘Personal’, the option was set to use a global icon. And Adium had pulled an icon from somewhere (I’ve no idea where it got it, but it is an icon I created for use in various places.) Changing to ‘use this icon’ (which defaults to a blank) made the problem go away. Go figure.