I am trying to use a postfix on a local Ubuntu 12.04 with ZoneMinder. I installed from Ubuntu Desktop the Postfix package and its dependency.

Now if I try to send email with following command it works good:

echo "This is the body of the email" | mail -s "This is the subject line" myemail@gmail.com

Then if an alarm from ZoneMinder sends an email I get the following

Apr 16 17:05:18 ubuntu postfix/local[11541]: warning: hash:/etc/aliases is unavailable. open database /etc/aliases.db: No such file or directory

and on if i run postqueue -q i get queued emails with (alias database unavailable)

A09B4A40C16      422 Thu Apr 16 16:59:37  destination@email.net
                                                  (alias database unavailable)

I tried to set pownership to postfix as suggested in other post with the following

sudo chown postfix:postfix -R /var/lib/postfix

and restarted postfix, but din't help.

The main.cf has the following

smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu) biff = no

# appending .domain is the MUA's job.
append_dot_mydomain = no

# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h

readme_directory = no

# TLS parameters
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.

myhostname = ubuntu
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = meridianozero.net, localhost, localhost.localdomain, localhost
mynetworks = [::ffff:]/104 [::1]/128
mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all

What should I check?


This is because you have

alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases

The hash: means, that you must have a database file containing the hashes, as described in Postfix lookup table types:

An indexed file type based on hashing. This is available only on systems with support for Berkeley DB databases. Public database files are created with the postmap(1) or postalias(1) command, and private databases are maintained by Postfix daemons. The database name as used in "hash:table" is the database file name without the ".db" suffix.

Therefore, as described in the documentation of alias_maps:

If you change the alias database, run postalias /etc/aliases (or wherever your system stores the mail alias file), or simply run newaliases to build the necessary DBM or DB file.

This will build the /etc/aliases.db file from information in /etc/aliases.

Naturally you must run either of these commands also during initial setup.

| improve this answer | |
  • So shell I remove postfix and reinstall it ? – user2478262 Apr 16 '15 at 16:58
  • 11
    No. Please read my answer. It is already shorter than the manual. – Esa Jokinen Apr 16 '15 at 17:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.