Mail setup stuck at postfix test.

I've carefully followed the steps as described in the Linode "how to":
https://www.linode.com/docs/guides/email-with-postfix-dovecot-and-mysql/

I seemed to be doing well, until I arrived at the first test. The test was:

sudo postmap -q mydomain.com mysql:/etc/postfix/mysql-virtual-mailbox-domains.cf

The tutorial says that this should return 1 if successful. Unfortunately, when I run this test, I get the following messages:

postmap: warning: /etc/postfix/main.cf: logical line must not start with whitespace: " See /usr/share/postfix/main.c…"

postmap: warning: connect to mysql server 127.0.0.1: Access denied for user 'mailuser'@'localhost' (using password: YES)

postmap: fatal: table mysql:/etc/postfix/mysql-virtual-mailbox-domains.cf: query error: Success

This result is confusing to say the least - especially that last bit. The query error was Success?

I spent a long time trying to track down the first warning, against logical lines starting with whitespace. I examined every line, but could not find any line like that.

I've repeated these steps several times. I can see that the database is OK. As far as I can tell, all the postfix configuration files are OK. I carefully copied and pasted most of the information, of course changing the text as needed.

I would appreciate if someone could point me in the right direction, to some instructions on how to troubleshoot if a postfix test fails. For that matter, I'm not even 100% sure that it did fail. The last word was "Success" even though that line started with "fatal."

4 Replies

@baruch --

postmap: warning: /etc/postfix/main.cf: logical line must not start with whitespace: " See /usr/share/postfix/main.c…"

logical line must not start with whitespace indicates that there is some extra whitespace in the config file. Check your /etc/postfix/main.cf for lines starting with whitespace. It could be a space in the beginning of the line or maybe line break in the wrong place.

postmap: warning: connect to mysql server 127.0.0.1: Access denied for user 'mailuser'@'localhost' (using password: YES)

Does your mysql(1) database have this user? See:

https://www.mysqltutorial.org/mysql-show-users/

for how to show all the users in a mysql(1) database. If you don't have it, add the line

127.0.0.1 localhost

to the /etc/hosts file.

postmap: fatal: table mysql:/etc/postfix/mysql-virtual-mailbox-domains.cf: query error: Success

I'm pretty sure that you got this because you got unresolved errors before it.

If your mail server is going to have only a few users, you might consider using SQLite (http://sqlite.org) as your database instead of mysql(1). Not only is SQLite light years easier to deploy and manage, there is no pesky database setup other than supplying the SQLite database file name and the queries required to find a domain, user, alias, etc.

Also, since SQLite databases are just files, you can back them up, move them around, tar/gzip them, etc with the ease that you would have for any other file. There are no USERs, special permissions, ROLEs, passwords, etc that you have to configure. You just have to make sure that the filesystem permissions are correct.

This may also be especially valuable if you're just playing around and/or learning. You can create/destroy a thousand SQLite databases in a minute.

-- sw

Thank you for your reply. I appreciate it.

I went through the entire /etc/postfix/main.cf more than once, line by line. But I figured I'd try your suggestion (to check it again), and I found the error. A commented line got uncommented, probably because I copied something incorrectly.

I'm using mysql because I have wordpress sites, and wordpress relies heavily mysql. I don't find it difficult.

I completely agree that I'd be able to destroy a thousand SQLite databases in a minute. I can destroy my whole file system in a minute.

Anyway, thanks for your input. I'll have to see whether fixing that whitespace did me any good. At least I hope I get different error messages. That tells me I'm making progress.

I'm using mysql because I have wordpress sites, and wordpress relies heavily mysql. I don't find it difficult.

You have to have separate databases for postfix/dovecot and WP. You probably knew that but it never hurts to keep that perspective.

-- sw

Thanks. I agree, it's a good idea to state the obvious, because that's often where the mistake is made.

I've been retracing my steps, repeatedly, without success. I think my next step will to start a pristine nanode, see whether I can do better there. I'll post results, if I ever figure out how to do this.

Once again, thanks for your help.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct