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


#1

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 https://github.com/lloydsmart/mailinabox.

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 management.sh, 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:

app.run(port=10222)

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/daemon.py:621]:
API key: 306JZ9M5VhMcKN/563/vZZm7CONmg0Ld5sRGdjm8sCQ=
--------------------------------------------------------------------------------
 * Running on http://127.0.0.1:10222/ (Press CTRL+C to quit)
Traceback (most recent call last):
  File "management/daemon.py", line 624, in <module>
    app.run(port=10222)
  File "/usr/lib/python3/dist-packages/flask/app.py", line 772, in run
    run_simple(host, port, self, **options)
  File "/usr/lib/python3/dist-packages/werkzeug/serving.py", 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.


#2

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


#3

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.


#4

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.

Thanks
Thefur


#5

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