2

I'm pretty clueless about servers as it is, and having to set up postfix is giving me a tough time. I know this error is pretty common, but even after spending half a day and trying various solutions, nothing has worked for me. Would someone be good enough to handhold me a little?

I bought a domain (plainsight.in) and a server from digitialocean (128.199.248.101) and am trying to set them up for sending email. The final aim to set up TLS and the whole shebang and send email to gmail.com, but for now even localhost to localhost mails are not working:

telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 dev.plainsight.in ESMTP Postfix (Ubuntu)
helo localhost
250 dev.plainsight.in
mail from: root@localhost
250 2.1.0 Ok
rcpt to: root@localhost
451 4.3.0 <root@localhost>: Temporary lookup failure

This baffles me. Why would localhost to localhost cause lookup failure?

At least all the mail settings are correct, as seen on this mxtoolbox page. Further, here's what my main.cf file looks like:

# See /usr/share/postfix/main.cf.dist for a commented, more complete version


# Debian specific:  Specifying a file name will cause the first
# line of that file to be used as the name.  The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname

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_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_use_tls=yes
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.

smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = dev.plainsight.in
#alias_maps = hash:/etc/aliases
virtual_alias_maps = hash:/etc/postfix/virtual
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = plainsight.in, personal-projects, localhost.localdomain, localhost
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128, 128.199.248.101
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = all

The last few lines of mail log are:

Dec 28 13:39:49 personal-projects postfix/trivial-rewrite[28844]: warning: hash:/etc/postfix/virtual is unavailable. open database /etc/postfix/virtual.db: No such file or directory
Dec 28 13:39:49 personal-projects postfix/trivial-rewrite[28844]: warning: hash:/etc/postfix/virtual: table lookup problem
Dec 28 13:39:53 personal-projects postfix/smtpd[28903]: warning: hash:/etc/postfix/virtual is unavailable. open database /etc/postfix/virtual.db: No such file or directory
Dec 28 13:39:53 personal-projects postfix/smtpd[28903]: warning: hash:/etc/postfix/virtual lookup error for "root@localhost"
Dec 28 13:39:53 personal-projects postfix/smtpd[28903]: NOQUEUE: reject: RCPT from localhost[127.0.0.1]: 451 4.3.0 <root@localhost>: Temporary lookup failure; from=<root@localhost> to=<root@localhost> proto=SMTP helo=<localhost>
Dec 28 13:39:56 personal-projects postfix/smtpd[28903]: disconnect from localhost[127.0.0.1]

Some help, please? :)

5
  • What's in your mail log? Dec 28, 2015 at 13:32
  • @MichaelHampton Nothing. I've added this info to my post as well.
    – ankush981
    Dec 28, 2015 at 13:36
  • You'll have to restart your syslog daemon to restore logging. Then try again. Dec 28, 2015 at 13:37
  • @MichaelHampton Oops! Random searching brought me to the essential postmap /etc/postfix/virtual, which I had ignored. Now it's working. Thanks for your efforts. :-)
    – ankush981
    Dec 28, 2015 at 13:50
  • @MichaelHampton Precisely! And my previous comment says that. Thanks anyway. Much appreciated, really!
    – ankush981
    Dec 28, 2015 at 13:51

1 Answer 1

5

Looks like you forgot to run postmap /etc/postfix/virtual. Remember to do this every time you change that file.

1
  • 1
    This saved my day! Oct 31, 2021 at 2:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .