"unsupported dictionary type: pcre" postfix header_checks

I have the following header_checks in place on Postfix

/^Received:/ IGNORE
/^X-Originating-IP:/    IGNORE
/^X-Mailer:/            IGNORE
/Message-Id:\s+<(.*?)@www.mainserver.com>/   REPLACE Message-Id: <[email protected]>
/X-Mailer-LID:/        IGNORE
/^MIME-Version:/i PREPEND Precedence: bulk
/X-Mailer-RecptId:/        IGNORE
/X-Mailer-SID:/        IGNORE
/X-Mailer-Sent-By:/        IGNORE
/List-Unsubscribe:/        IGNORE

Once I activate them in postfix/main.cf (after running postmap /etc/postfix/header_checks) postfix stops working. When I attempt to send an email I get the following error log

Jun 20 03:19:26 mail postfix/pickup[6813]: F37593F946: uid=0 from=<[email protected]>
Jun 20 03:19:26 mail postfix/cleanup[6819]: warning: pcre:/etc/postfix/header_checks is unavailable. unsupported dictionary type: pcre
Jun 20 03:19:26 mail postfix/cleanup[6819]: warning: pcre:/etc/postfix/header_checks lookup error for "Received: by mail.domain.com (Postfix, from userid 0)??id F37593F946; Thu, 20 Jun 2019 03:19:26 +0200"
Jun 20 03:19:26 mail postfix/cleanup[6819]: warning: F37593F946: header_checks map lookup problem -- message not accepted, try again later
Jun 20 03:19:26 mail postfix/pickup[6813]: warning: maildrop/F27653F945: error writing F37593F946: queue file write error
Jun 20 03:19:27 mail postfix/pickup[6813]: F42373F946: uid=0 from=<[email protected]>
Jun 20 03:19:27 mail postfix/cleanup[6819]: warning: pcre:/etc/postfix/header_checks is unavailable. unsupported dictionary type: pcre
Jun 20 03:19:27 mail postfix/cleanup[6819]: warning: pcre:/etc/postfix/header_checks lookup error for "Received: by mail.domain.com (Postfix, from userid 0)??id F42373F946; Thu, 20 Jun 2019 03:12:51 +0200"
Jun 20 03:19:27 mail postfix/cleanup[6819]: warning: F42373F946: header_checks map lookup problem -- message not accepted, try again later
Jun 20 03:19:27 mail postfix/pickup[6813]: warning: maildrop/2C3F23F172: error writing F42373F946: queue file write error
Jun 20 03:19:27 mail postfix/pickup[6813]: 00EE13F946: uid=0 from=<[email protected]>
Jun 20 03:19:27 mail postfix/cleanup[6819]: warning: pcre:/etc/postfix/header_checks is unavailable. unsupported dictionary type: pcre
Jun 20 03:19:27 mail postfix/cleanup[6819]: warning: pcre:/etc/postfix/header_checks lookup error for "Received: by mail.domain.com (Postfix, from userid 0)??id 00EE13F946; Thu, 20 Jun 2019 03:13:36 +0200"
Jun 20 03:19:27 mail postfix/cleanup[6819]: warning: 00EE13F946: header_checks map lookup problem -- message not accepted, try again later
Jun 20 03:19:27 mail postfix/pickup[6813]: warning: maildrop/924363F173: error writing 00EE13F946: queue file write error

What is causing this? I believe it works on my old CentOS 6 installation but I am having problems with my Ubuntu 18.04 installation.


pcre support is distributed in a separate package in Ubuntu. You can have postfix installed without having postfix-pcre installed.

You can confirm that this is your problem by listing all available lookup table types, typically you will have regexp installed but pcre missing:

$ postconf -m | grep re
betree
regexp

You can install the pcre lookup table type using:

sudo apt install postfix-pcre

Restart postfix and review your logs for potential errors with your (now for the first time loaded) maps:

sudo systemctl restart postfix
sudo journalctl -u [email protected]

Note that using postmap to update pcre-type files has no useful effect - the postmap utility will assume the default database type (typically hash) and produce a .db output for that - which is not used for pcre.