Armhf builds of dovecot-lucene and postgrey

Hi,

I’ve been running MIAB on Beaglebone Black running Ubuntu 14.04 for around 18 months. It’s worked great-- thanks for all the work to make it so easy.

This morning, I tried to install MIAB 0.13b on a Raspberry Pi 2 running Ubuntu 14.04, but I ran into trouble with dovecot-lucene (and probably postgrey too, but I didn’t get that far). From what I can tell, the problem is that the MIAB Launchpad PPA doesn’t build packages for the armhf architecture, which is what the Beaglebone Black and Raspberry Pis use. Currently, the PPA just builds for x86, plus amd64 for dovecot-lucene.

Could you (JoshData) enable armhf builds on your Launchpad PPA?

It appears that you could enable armhf builds by submitting a request as described here: https://dev.launchpad.net/CommunityARMBuilds

(I can imagine that you might not want to do this because it will enable a bunch of crazy people to start running MIAB at home, which would generate an infinite stream of “How do I get a static IP?” and “Is port 25 broken or something?” questions. If that’s the case, would you mind if I built them in my own PPA? I’m guessing this would still enable a substantial fraction of the enthusiasts.)

Cheers,
Brandon

Hello,

If you can build them and verify that Mail-in-a-Box works at all on that platform, then I’ll look into adding the build. I don’t want to go down the rabbit hole of trying to add support for a platform that it might not work properly on anyway.

The packages are also basically optional, so you could skip the PPA.

OK, that seems reasonable.

I’ll alter mail-dovecot.sh so it omits dovecot-lucene here: https://github.com/mail-in-a-box/mailinabox/blob/b2dfdc386ab057faf6b2a199efa45725a6e70035/setup/mail-dovecot.sh#L29

For postgrey, I suspect that apt will just install the default Ubuntu version.

I’ll report back later.

Thanks!

I ran an install from the latest commit on Github, but with the dovecot-lucene package omitted. This was mostly successful, but I ran into a problem in creating the admin user:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>500 Internal Server Error</title>
<h1>Internal Server Error</h1>
<p>The server encountered an internal error and was unable to complete your request.  Either the server is overloaded or there is an error in the application.</p>
FAILED: tools/mail.py user make-admin username@example.com
-----------------------------------------
That's not a user (username@example.com).
-----------------------------------------

(username@example.com was my actual email address.)

Does anyone have suggestions about how I might debug this?

It looks like Nginx and PHP-FPM are both running. Maybe there’s a PHP error logged somewhere that would explain why I’m getting a 500 response?

The end of the error appears to be from mailconfig.py: https://github.com/mail-in-a-box/mailinabox/blob/d60d73b7e048f4cdf27470e87654e5e6a2d440ce/management/mailconfig.py#L339

My bet would be that the database connection is failing for some reason-- permissions? something like that?-- so the script can’t add me to the database.

What should I check next?

Ah, found this in /var/log/syslog:

Sep 17 02:14:08 ubuntu
Exception on /mail/users/add [POST]
Traceback (most recent call last):#012  
File "/usr/lib/python3/dist-packages/flask/app.py", line 1817, in wsgi_app#012    
response = self.full_dispatch_request()#012  
File "/usr/lib/python3/dist-packages/flask/app.py", line 1477, in full_dispatch_request#012    
rv = self.handle_user_exception(e)#012  
File "/usr/lib/python3/dist-packages/flask/app.py", line 1381, in handle_user_exception#012    
reraise(exc_type, exc_value, tb)#012  
File "/usr/lib/python3/dist-packages/flask/_compat.py", line 33, in reraise#012    
raise value#012  
File "/usr/lib/python3/dist-packages/flask/app.py", line 1475, in full_dispatch_request#012    
rv = self.dispatch_request()#012  
File "/usr/lib/python3/dist-packages/flask/app.py", line 1461, in dispatch_request#012    
return self.view_functions[rule.endpoint](**req.view_args)#012  
File "/usr/local/bin/mailinabox-daemon", line 49, in newview#012    
return viewfunc(*args, **kwargs)#012  
File "/usr/local/bin/mailinabox-daemon", line 146, in mail_users_add#012    
return add_mail_user(request.form.get('email', ''), request.form.get('password', ''), request.form.get('privileges', ''), env)#012  
File "/home/ubuntu/mailinabox/management/mailconfig.py", line 294, in add_mail_user#012    
pw = hash_password(pw)#012  
File "/home/ubuntu/mailinabox/management/mailconfig.py", line 347, in hash_password#012    
return utils.shell('check_output', ["/usr/bin/doveadm", "pw", "-s", "SHA512-CRYPT", "-p", pw]).strip()#012  
File "/home/ubuntu/mailinabox/management/utils.py", line 193, in shell#012    
ret = getattr(subprocess, method)(cmd_args, **kwargs)#012  
File "/usr/lib/python3.4/subprocess.py", line 616, in check_output#012    
raise CalledProcessError(retcode, process.args, output=output)#012
subprocess.CalledProcessError: Command '['/usr/bin/doveadm', 'pw', '-s', 'SHA512-CRYPT', '-p', 'password-was-here']' returned non-zero exit status 75

I’m not sure what this means. The doveadm man page just says that exit status >0 means the command failed.

Any ideas?

Run exactly what it’s trying to run and see what happens.

But that’s the last advice I can give. It’s up to you to make arm work. :slight_smile:

Hey, fair enough. I appreciate all the work you’ve already done.

I did a little more digging. It turns out that the problem is that when doveadm runs, Dovecot tries to load various plugin modules, but it fails to find the fts_lucene module, so it dies. I pulled out the references to that module, and it now works.

Here’s a summary of the changes I made: https://github.com/pingswept/dev-log/blob/master/2015-08-mailinabox-on-rpi2.markdown#get-mail-in-a-box-and-slightly-modify-it

So everything seems to be running now. I’m still having a problem getting local DNS working, but I can see spam hitting the box and getting rejected, so that’s a start.

Cheers!

@bstafford, I’m trying to get Mailinabox working with the Scaleway armhf servers and think we should pool our knowledge to get this working. I’m unsure if this affects Beaglebone Black or Raspberry Pi 2 but Scaleway’s SoC has an issue with Ubuntu 14.04’s iptables rules (and therefore ufw’s, as well) for nbd connections. I found the solution and I am a full screen into the DH parameter generation as I type. I kept notes of what I’ve managed to accomplish thus far in this gist: https://gist.github.com/schade/57b733a3acb546560900#file-mailinabox-on-scaleway-armhf-server-md.

…and successfully built and running properly as far as I can tell. I made further changes to my gist so that it reflects everything I was required to do to get mailinabox working on Scaleway.

If you got ufw working, you could drop DISABLE_FIREWALL=1 I guess?

It was definitely required for the first run as far as I could tell; but once that was complete I never needed to use it again. It’s been merrily running and delivering my mail for 3 days now. My only niggling complaint at themoment is I always get two copies of every email, but I need to find a bit of time to trace it down.

Hi there :slight_smile:

I took some time this morning to build dovecot-lucene on a Scaleway C1 armhf server hosting Mail-in-aBox.

Here’s how i made it work :

apt-add-repository ppa:mail-in-a-box/ppa

Uncomment “deb source” line in the file “/etc/apt/sources.list.d/mail-in-a-box-ppa-trusty.list”

# cat /etc/apt/sources.list.d/mail-in-a-box-ppa-trusty.list
  deb http://ppa.launchpad.net/mail-in-a-box/ppa/ubuntu trusty main
  deb-src http://ppa.launchpad.net/mail-in-a-box/ppa/ubuntu trusty main
  # deb-src http://ppa.launchpad.net/mail-in-a-box/ppa/ubuntu trusty main
  # deb-src http://ppa.launchpad.net/mail-in-a-box/ppa/ubuntu trusty main

Refresh APT and install tools and dependencies.

apt-get update
apt-get install debhelper cdbs lintian build-essential fakeroot devscripts pbuilder dh-make debootstrap
apt-get install libclucene-dev libpam0g-dev libpq-dev libmysqlclient-dev libsqlite3-dev libsasl2-dev drac-dev libbz2-dev libdb-dev libcurl4-gnutls-dev libwrap0-dev dh-systemd  libclucene-dev liblzma-dev libexttextcat-dev libstemmer-dev hardening-wrapper dh-autoreconf

Download sources.

cd /tmp
apt-get source dovecot-lucene

Make the package!

cd dovecot-2.2.9/
debuild -us -uc -b

And install it !

cd /tmp
dpkg -i dovecot-lucene_2.2.9-1ubuntu2.1+miab1_armhf.deb

Make sure that everything is OK with Dovecot :

/etc/dovecot/conf.d/90-plugin-fts.conf

Should contain :

plugin {
  fts = lucene
  fts_lucene = whitespace_chars=@.
}

And mail_plugins variable in file : vi /etc/dovecot/conf.d/10-mail.conf

#Space separated list of plugins to load for all services. Plugins specific to
# IMAP, LDA, etc. are added to this list in their own .conf files.
#mail_plugins =
mail_plugins=$mail_plugins fts fts_lucene

Rock it !

service dovecot restart

Searching is now damn fast in my fatty mailbox - 11 Go.

By the way, thanks a lot @JoshData for this great tool :smile:

MrRaph_

1 Like

Confirmed to work on a scaleway arm server. :smile:
Integrating the ARM build(s) and tweaks into the PPA would be great.
Thanks, Josh for providing this excellent tool.

Hi,

It would be very nice to see armhf support and compat for the whole setup script in the upcoming MIAB release! I am running a MAIB on a x86 VPS but being able to run it on scaleways $3 a month VPS with 50GB storage would be very cool!

Greets,

Rens