Suppressing 'doveadm exited with return code 68' from dovecot-fts-xapian

On one of the mail servers I maintain, we use the Dovecot Xapian FTS plugin (via apt package dovecot-fts-xapian) to provide full text search for our IMAP users. To keep the indexes up to date, we have a simple cron job:

#!/bin/sh
/usr/bin/doveadm fts optimize -A 2> /dev/null

The -A flag tells doveadm to update the index for all users, because otherwise we'd need to run a separate cron for each user. However, all of the mail users have system accounts (not virtual accounts) but not all system accounts have mailboxes. Unfortunately doveadm isn't smart enough to realise this, and still attempts to optimise their Xapian FTS indexes, exiting with error code 68 when it can't find the correct location. Since we're running via cron, this ends up producing a warning email every time the cron job runs.

To work around this, after adding a new user I now run the following command: mkdir --parents --mode=700 ~username/Maildir/xapian-indexes && chown -R username:username ~username/Maildir. This isn't strictly a fix, but it creates the required folder so that doveadm stops complaining. A better fix would be to use the -F flag and maintain a file with a list of all of the mail active users.

Add new comment

CAPTCHA