Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Postfix Error in Ubuntu 12.04

149 views
Skip to first unread message

Austin Einter

unread,
Oct 19, 2014, 1:40:01 PM10/19/14
to
Dear All
I am trying to setup postfix/dovecot in an Ubuntu 12.04 system.

Though I have installed postfix, dovecot and spamassin (with complete configurations), when I start service postfix, in terminal it shows everything fine.

In /var/log/mail.log and syslog I see below errors.

29615 Oct 19 13:33:37 Austin postfix/master[2134]: daemon started -- version 2.9.6, configuration /etc/postfix
29616 Oct 19 13:33:37 Austin postfix/pickup[2137]: C959EC2387: uid=0 from=<root>
29617 Oct 19 13:33:37 Austin postfix/cleanup[2139]: warning: connect to mysql server localhost: Can't connect to local MySQL server through socke      t '/var/run/mysqld/mysqld.sock' (2)
29618 Oct 19 13:33:37 Austin postfix/cleanup[2139]: warning: mysql:/etc/postfix/mysql-virtual-alias-maps.cf lookup error for "ro...@mail.mydomain.com"
29619 Oct 19 13:33:37 Austin postfix/cleanup[2139]: warning: C959EC2387: virtual_alias_maps map lookup problem for ro...@mail.mydomain.com -      - deferring delivery
29620 Oct 19 13:33:37 Austin postfix/pickup[2137]: CB8ADC2387: uid=0 from=<root>
29621 Oct 19 13:33:37 Austin postfix/cleanup[2139]: warning: mysql:/etc/postfix/mysql-virtual-alias-maps.cf lookup error for "ro...@mail.mydomain.com"
29622 Oct 19 13:33:37 Austin postfix/cleanup[2139]: warning: CB8ADC2387: virtual_alias_maps map lookup problem for ro...@mail.mydomain.com -      - deferring delivery
29623 Oct 19 13:33:37 Austin postfix/pickup[2137]: CBC35C2387: uid=0 from=<root>
29624 Oct 19 13:33:37 Austin postfix/cleanup[2139]: warning: mysql:/etc/postfix/mysql-virtual-alias-maps.cf lookup error for "ro...@mail.mydomain.com"
29625 Oct 19 13:33:37 Austin postfix/cleanup[2139]: warning: CBC35C2387: virtual_alias_maps map lookup problem for ro...@mail.mydomain.com -      - deferring delivery
29626 Oct 19 13:33:37 Austin postfix/pickup[2137]: CC130C2387: uid=0 from=<root>
29627 Oct 19 13:33:37 Austin postfix/cleanup[2139]: warning: mysql:/etc/postfix/mysql-virtual-alias-maps.cf lookup error for "ro...@mail.mydomain.com"
29628 Oct 19 13:33:37 Austin postfix/cleanup[2139]: warning: CC130C2387: virtual_alias_maps map lookup problem for ro...@mail.mydomain.com -      - deferring delivery
29629 Oct 19 13:33:37 Austin postfix/pickup[2137]: CC4EBC2387: uid=0 from=<root>
29630 Oct 19 13:33:37 Austin postfix/cleanup[2139]: warning: mysql:/etc/postfix/mysql-virtual-alias-maps.cf lookup error for "ro...@mail.mydomain.com"
29631 Oct 19 13:33:37 Austin postfix/cleanup[2139]: warning: CC4EBC2387: virtual_alias_maps map lookup problem for ro...@mail.mydomain.com -      - deferring delivery
29632 Oct 19 13:33:37 Austin postfix/pickup[2137]: CC80EC2387: uid=0 from=<root>
29633 Oct 19 13:33:37 Austin postfix/cleanup[2139]: warning: mysql:/etc/postfix/mysql-virtual-alias-maps.cf lookup error for "ro...@mail.mydomain.com"
29634 Oct 19 13:33:37 Austin postfix/cleanup[2139]: warning: CC80EC2387: virtual_alias_maps map lookup problem for ro...@mail.mydomain.com -


I tried few things including modifying permissions (for maps files), port numbers etc..., but no luck.


Can somebody kindly let me know what I need to do to avoid this error.

Thanks
Austin



Austin Einter

unread,
Oct 19, 2014, 1:41:13 PM10/19/14
to

Edgar Pettijohn

unread,
Oct 19, 2014, 1:53:17 PM10/19/14
to

On 10/19/2014 12:41 PM, Austin Einter wrote:

On Sun, Oct 19, 2014 at 11:10 PM, Austin Einter <austin...@gmail.com> wrote:
Dear All
I am trying to setup postfix/dovecot in an Ubuntu 12.04 system.

Though I have installed postfix, dovecot and spamassin (with complete configurations), when I start service postfix, in terminal it shows everything fine.

In /var/log/mail.log and syslog I see below errors.

29615 Oct 19 13:33:37 Austin postfix/master[2134]: daemon started -- version 2.9.6, configuration /etc/postfix
29616 Oct 19 13:33:37 Austin postfix/pickup[2137]: C959EC2387: uid=0 from=<root>
29617 Oct 19 13:33:37 Austin postfix/cleanup[2139]: warning: connect to mysql server localhost: Can't connect to local MySQL server through socke      t '/var/run/mysqld/mysqld.sock' (2)

Is mysql running?

Austin Einter

unread,
Oct 19, 2014, 4:33:48 PM10/19/14
to


Can anybody help me in this pls ?



---------- Forwarded message ----------
From: Austin Einter <austin...@gmail.com>
Date: Sun, Oct 19, 2014 at 11:10 PM
Subject: Postfix Error in Ubuntu 12.04
To: postfi...@postfix.org


Dear All
I am trying to setup postfix/dovecot in an Ubuntu 12.04 system.

Though I have installed postfix, dovecot and spamassin (with complete configurations), when I start service postfix, in terminal it shows everything fine.

In /var/log/mail.log and syslog I see below errors.

29615 Oct 19 13:33:37 Austin postfix/master[2134]: daemon started -- version 2.9.6, configuration /etc/postfix
29616 Oct 19 13:33:37 Austin postfix/pickup[2137]: C959EC2387: uid=0 from=<root>
29617 Oct 19 13:33:37 Austin postfix/cleanup[2139]: warning: connect to mysql server localhost: Can't connect to local MySQL server through socke      t '/var/run/mysqld/mysqld.sock' (2)
29618 Oct 19 13:33:37 Austin postfix/cleanup[2139]: warning: mysql:/etc/postfix/mysql-virtual-alias-maps.cf lookup error for "ro...@mail.mydomain.com"
29619 Oct 19 13:33:37 Austin postfix/cleanup[2139]: warning: C959EC2387: virtual_alias_maps map lookup problem for ro...@mail.mydomain.com -      - deferring delivery
29620 Oct 19 13:33:37 Austin postfix/pickup[2137]: CB8ADC2387: uid=0 from=<root>
29621 Oct 19 13:33:37 Austin postfix/cleanup[2139]: warning: mysql:/etc/postfix/mysql-virtual-alias-maps.cf lookup error for "ro...@mail.mydomain.com"
29622 Oct 19 13:33:37 Austin postfix/cleanup[2139]: warning: CB8ADC2387: virtual_alias_maps map lookup problem for ro...@mail.mydomain.com -      - deferring delivery
29623 Oct 19 13:33:37 Austin postfix/pickup[2137]: CBC35C2387: uid=0 from=<root>
29624 Oct 19 13:33:37 Austin postfix/cleanup[2139]: warning: mysql:/etc/postfix/mysql-virtual-alias-maps.cf lookup error for "ro...@mail.mydomain.com"
29625 Oct 19 13:33:37 Austin postfix/cleanup[2139]: warning: CBC35C2387: virtual_alias_maps map lookup problem for ro...@mail.mydomain.com -      - deferring delivery
29626 Oct 19 13:33:37 Austin postfix/pickup[2137]: CC130C2387: uid=0 from=<root>
29627 Oct 19 13:33:37 Austin postfix/cleanup[2139]: warning: mysql:/etc/postfix/mysql-virtual-alias-maps.cf lookup error for "ro...@mail.mydomain.com"
29628 Oct 19 13:33:37 Austin postfix/cleanup[2139]: warning: CC130C2387: virtual_alias_maps map lookup problem for ro...@mail.mydomain.com -      - deferring delivery
29629 Oct 19 13:33:37 Austin postfix/pickup[2137]: CC4EBC2387: uid=0 from=<root>
29630 Oct 19 13:33:37 Austin postfix/cleanup[2139]: warning: mysql:/etc/postfix/mysql-virtual-alias-maps.cf lookup error for "ro...@mail.mydomain.com"
29631 Oct 19 13:33:37 Austin postfix/cleanup[2139]: warning: CC4EBC2387: virtual_alias_maps map lookup problem for ro...@mail.mydomain.com -      - deferring delivery
29632 Oct 19 13:33:37 Austin postfix/pickup[2137]: CC80EC2387: uid=0 from=<root>
29633 Oct 19 13:33:37 Austin postfix/cleanup[2139]: warning: mysql:/etc/postfix/mysql-virtual-alias-maps.cf lookup error for "ro...@mail.mydomain.com"
29634 Oct 19 13:33:37 Austin postfix/cleanup[2139]: warning: CC80EC2387: virtual_alias_maps map lookup problem for ro...@mail.mydomain.com -


I tried few things including modifying permissions (for maps files), port numbers etc..., but no luck.


Can somebody kindly let me know what I need to do to avoid this error.

Thanks
Austin




Wietse Venema

unread,
Oct 19, 2014, 4:47:09 PM10/19/14
to
Austin Einter:
> 29617 Oct 19 13:33:37 Austin postfix/cleanup[2139]: warning: connect to
> mysql server localhost: Can't connect to local MySQL server through
> socke t '/var/run/mysqld/mysqld.sock' (2)

Error 2 means "No such file or directory".

As someone already posted here, is the MyqSQL daemon running?

If the daemon is running, then turn off chroot as per instructions
at http://www.postfix.org/DEBUG_README.html#no_chroot.

Wietse

Austin Einter

unread,
Oct 19, 2014, 11:08:08 PM10/19/14
to
I did chorrt modification , no luck....

Next I modified in maps config files , I changed the line
hosts = localhost
to
hosts = 127.0.0.1

After that I find below error

Oct 19 23:03:24 Kamal postfix/master[2336]: daemon started -- version 2.9.6, configuration /etc/postfix
Oct 19 23:03:24 Kamal postfix/pickup[2339]: 34292C259E: uid=0 from=<root>
Oct 19 23:03:24 Kamal postfix/cleanup[2341]: warning: connect to mysql server 127.0.0.1: Can't connect to MySQL server on '127.0.0.1' (111)

Probably this time connection refused, any kind of permission issue



Now my question is which DB user on behalf of postfix is trying to connect to DB.
If I can find this, probably I can give permission accordingly.

Thanks
Austin



 

Benny Pedersen

unread,
Oct 20, 2014, 12:38:13 AM10/20/14
to
On October 20, 2014 5:08:08 AM Austin Einter <austin...@gmail.com> wrote:

> I did chorrt modification , no luck....
>
> Next I modified in maps config files , I changed the line
> hosts = localhost
> to
> hosts = 127.0.0.1

Check my.cnf, your mysql only binds to socket not inet pr default

#skip-networking
bind-address = 127.0.0.1

Without the bind-address localhost is really socket file

socket = /path/to/socketfile.sock

Check this match postfix maps

Austin Einter

unread,
Oct 20, 2014, 1:58:50 AM10/20/14
to
Hi Benny.
Thanks for help.

I modified below stuff.

1. In /etc/mysql/my.cnf , I had bind-address = 0.0.0.0 and changed it to 127.0.0.1
2. In postfix maps files, I did put socket = /var/run/mysqld/mysqld.sock

Then I restarted postfix.

Similar error, given below.
128250 Oct 20 01:50:50 Austin postfix/master[6610]: daemon started -- version 2.9.6, configuration /etc/postfix
128251 Oct 20 01:50:50 Austin postfix/pickup[6613]: 93D30C25A1: uid=0 from=<root>
128252 Oct 20 01:50:50 Austin postfix/cleanup[6615]: warning: connect to mysql server 127.0.0.1: Can't connect to MySQL server on '127.0.0.1' (111)


In my,cnf, if I put bind address as 0.0.0.0 (I have a requirement to put it that way) , then it will bind to all available interfaces.

So it should be fine.


How do I know the exact reason.
...?

Any pointers...

Thanks
Austin










Austin Einter

unread,
Oct 20, 2014, 3:08:25 AM10/20/14
to
The final error I am getting when I start postfix is as below

postfix/cleanup[8682]: warning: connect to mysql server 127.0.0.1: Can't connect to MySQL server on '127.0.0.1' (111)

So it looks as a permission issue.


I hope, postfix uses DB user/password given in alias-maps (in my case /etc/postfix/mysql-virtual-alias-maps.cf) file.
The content of file is as below.

user=mailuser
password=mailpassword
hosts=127.0.0.1
port=9876
dbname=maildb
query=SELECT destination FROM virtual_aliases WHERE source='%s'


So in this case , postfix uses DB user mailuser and password mailpassword to connect to mysql.

Next I checked the permission stuff in my DB.


mysql>
mysql> show grants for 'mailuser'@'127.0.0.1';
+--------------------------------------------------------------------------------------------------------------------------+
| Grants for mail...@127.0.0.1                                                                                            |
+--------------------------------------------------------------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'mailuser'@'127.0.0.1' IDENTIFIED BY PASSWORD '*B53D5E197345FF7F5B6BEC761F5E952BD4393656' |
| GRANT ALL PRIVILEGES ON `maildb`.* TO 'mailuser'@'127.0.0.1'                                                         |
+--------------------------------------------------------------------------------------------------------------------------+
2 rows in set (0.00 sec)


From above one can see the permissions are in place.


So, why I get mysql 111 (connection refuse) error.

Any idea.., kindly help.

Thanks
Austin







On Sun, Oct 19, 2014 at 11:10 PM, Austin Einter <austin...@gmail.com> wrote:

Paul Hoffman

unread,
Oct 20, 2014, 3:17:03 AM10/20/14
to
On Mon, Oct 20, 2014 at 12:38:25PM +0530, Austin Einter wrote:
> The final error I am getting when I start postfix is as below
>
> postfix/cleanup[8682]: warning: connect to mysql server 127.0.0.1: Can't
> connect to MySQL server on '127.0.0.1' (111)
>
> So it looks as a permission issue.

I wouldn't make that assumption. Have you verified that MySQL is truly
running? Do you know how to use netstat or lsof?

Paul.

--
Paul Hoffman <pa...@flo.org>
Systems Librarian
Fenway Libraries Online
c/o Wentworth Institute of Technology
550 Huntington Ave.
Boston, MA 02115
(617) 442-2384 (FLO main number)

Austin Einter

unread,
Oct 20, 2014, 3:29:32 AM10/20/14
to
Hi Paul
Thanks.

Used netstat -tap and the output is
tcp        0      0 *:9876                  *:*                     LISTEN      9306/mysqld

From ps -ef | grep mysql
mysql     9306     1  0 03:22 ?        00:00:00 /usr/sbin/mysqld

More over, same mysql server I am using for web server purpose, and my site is up.

So MySQLd is up, no doubt.

Port/Host and Permissions fine..., not getting what may go wrong.

Best Regards
Austin









Koko Wijatmoko

unread,
Oct 20, 2014, 4:04:37 AM10/20/14
to
Seems you're using non-standard port for mysql (9306).
If I'm not wrong, mysql use port 3306...

$ cat /etc/services|grep 3306
mysql 3306/tcp
mysql 3306/udp

Austin Einter

unread,
Oct 20, 2014, 4:29:20 AM10/20/14
to
Looks resolved, need to verify though...
port= line not required
hosts=127.0.0.1:9876  , this is what working looks...

Any idea whats the difference between these 2 config styles.


If I want to send a test mail from terminal.., how can I do that ..., any simple command or link to follow pls share.

Austin



On Mon, Oct 20, 2014 at 12:59 PM, Austin Einter <austin...@gmail.com> wrote:
Hi Paul
Thanks.

Used netstat -tap and the output is
tcp        0      0 *:9876                  *:*                     LISTEN      9306/mysqld

From ps -ef | grep mysql
mysql     9306     1  0 03:22 ?        00:00:00 /usr/sbin/mysqld

More over, same mysql server I am using for web server purpose, and my site is up.

So MySQLd is up, no doubt.

Port/Host and Permissions fine..., not getting what may go wrong.

Best Regards
Austin









Wietse Venema

unread,
Oct 20, 2014, 7:22:34 AM10/20/14
to
Austin Einter:
> > Used netstat -tap and the output is
> > tcp 0 0 *:9876 *:*
> > LISTEN 9306/mysqld

That is port 9876. What TCP port did you configure POSTFIX connect to?

Wietse

0 new messages