Please help me with my mod to run MiaB on Ubuntu 16.04 / armhf

So I’m creating an unsupported modification of Mail-in-a-Box to run on a Raspberry Pi 3 with Ubuntu 16.04 armhf.

I’ve only had to make minor changes so far, but I’ve hit a bit of a stumbling block with the management interface and was wondering if anyone could help.

My fork is on

When I try to do an install, it fails on “Installing Mail-in-a-Box system management daemon…”

Specifically, it gets all the way through, up to “restart_service mailinabox”.

Now, I know that restart_service is just a wrapper for “service $1 restart”, so this is actually calling “service mailinabox restart”. When I look at /etc/init.d/mailinabox, I see that restart just calls do_start, which in turn calls:

start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --background --make-pidfile --chuid $EXEC_AS_USER --startas $DAEMON -- $DAEMON_ARGS

So, seeing as $DAEMON is set to /usr/local/bin/mailinabox-daemon, this led me to examine that file, which seems to execute just fine all the way up until the final line, specifically:

This throws up an error that I haven’t been able to solve, and which throws off the whole install process. By running that specific python file with DEBUG=1, I can see the following error:

INFO in daemon [management/]:
API key: 306JZ9M5VhMcKN/563/vZZm7CONmg0Ld5sRGdjm8sCQ=
 * Running on (Press CTRL+C to quit)
Traceback (most recent call last):
  File "management/", line 624, in <module>
  File "/usr/lib/python3/dist-packages/flask/", line 772, in run
    run_simple(host, port, self, **options)
  File "/usr/lib/python3/dist-packages/werkzeug/", line 618, in run_simple
    test_socket.bind((hostname, port))
OSError: [Errno 98] Address already in use

Any ideas what could be causing this? I’ve looked through documentation for Flask, but haven’t found the cause yet. It seems like something else is hogging port 10222, but I can’t think what that might be as this is a fresh box.

There is already something listening at this port. Probably the original service.

Thanks for the hint. :slight_smile:

When you say that the original service is probably running, do you mean that start-stop-daemon has failed to stop it when the script calls do_restart?

If so, maybe I could fix this with a kill command, although really I’d like to diagnose why this is happening if possible. Adding in a kill -9 seems a bit hacky.

Did you get this to work? I am thinking of setting up my own MIAB on a Pi 3 and have been disappointed that ARM isn’t supported. With the specs for a Pi 3, it seems a natural place to put it instead of a bigger box server. Hope that changes/changed.


netstat -anop | grep 10222 will give you the process using the port.