Articles in this section

Unable to receive email with Plesk Email Security extension installed: (!)connect_to_sql: unable to connect to DSN 'DBI:mysql:database=emailsecurity;mysql_socket=/var/run/mysqld/mysqld.sock'

kb: bug kb: technical ext: pes Plesk Obsidian for Linux

Applicable to:

  • Plesk for Linux

Symptoms

  • Unable to receive email on the Plesk server, the process fails with the next error message in /var/log/maillog file:

    CONFIG_TEXT: (!)connect_to_sql: unable to connect to DSN 'DBI:mysql:database=emailsecurity;mysql_socket=/var/run/mysqld/mysqld.sock': Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2 "No such file or directory")
    (!!)TROUBLE in process_request: connect_to_sql: unable to connect to any dataset at (eval 146) line 253.
    (!)Requesting process rundown after fatal error

  • Plesk Email Security extension is installed

Cause

The issue is caused by Plesk Email Security bug with the ID #EXTPLESK-8784. Issue was fixed in Plesk Email Security 1.5.12

Resolution

Update Plesk Email Security extension to the latest version (1.5.12):

  1. Login into Plesk

  2. Navigate to Extensions > Updates menu

  3. Press Check Now button, then select Plesk Email Security and press on Update button, like on screenshot below:

Workaround (if updating PES is not possible for some reason):

  1. Log into the server via SSH.

  2. Using the vi text editor open the /etc/amavisd/email-security.conf file

  3. Find and change the value for the mysql_socket from below:

    CONFIG_TEXT: mysql_socket=/var/run/mysqld/mysqld.sock

    To the following:

    CONFIG_TEXT: mysql_socket=/var/lib/mysql/mysql.sock

  4. Save changes

  5. Restart Amavisd service to apply the changes:

    # systemctl restart amavisd.service

  6. Execute the command below to force Postfix to deliver the emails from mail queue:

    # postqueue -f

Was this article helpful?

Comments

14 comments
Date Votes
  • It is working with your fix.

    0
  • not working for me

    0
  • Now it's working again!

    0
  • Thank you !

    0
  • On several Plesk servers (CentOS 7), in two config files (/etc/mail/local.cf and /etc/amavisd/email-security.conf) the following line was changed after the update:

     ["DBI:mysql:database=emailsecurity;host=localhost;port=3306", "username", "password"]

    The lines where changed to use a socket connection, on my CentOS 7-servers, there is no such socket.
    Restoring both files from the backups did solve the problem.
     

    This update broke my spamassassin-filtering and no mail was accepted on my servers for several hours!
    Luckily we have Backup MX-servers, no mail was lost. But it diminish my trust in this extension. 

     

     

    0
  • Glad this was fixed quickly but boy it caused a lot of customer grief today.

    0
  • I have Centos 7 Plesk server and the onlyhave /etc/mail/spamassassin/local.cf.  I did make the change on /etc/amavisd/email-security.conf and restored an earlier version of that local.cf with no joy.

    0
  • Hello IT4BC,

    What is the error in your maillog?
    Can you state the two db-lines in those files?

     

    0
  • work after uninstall Plesk Email Security extension

    /usr/local/psa/admin/sbin/mailmng --restart-service

    postsuper -r ALL

    1
  • The fix above did not resolve the email issue.

    Uninstalling Plesk Email Security allows NEW emails to be sent and received…

    However we now hve 90+ emails in mail queue with error Deferred “4.3.2 deferred (host 127.0.0.1[127.0.0.1] said: 421 4.3.2 Service shutting down, closing channel (in reply to RCPT TO command))”

    On Resend the error becomes: 4.3.0 deferred (mail transport unavailable)

    0
  • If you reinstall this Extension the DB entry was set correct and send the mails in the mail queue:

    @lookup_sql_dsn =(

    ["DBI:mysql:database=emailsecurity;host=localhost;port=3306" 

    Sorry but we think your workaround is wrong and many customers are waiting for a patch :-)

    0
  • In our case the amavisd/email-security.conf was the problem.  

     

    typo, restart service all good..

    0
  • The command line change did not fix it for us, but the extension update did fix it. Thank you. 

    0
  •  Thanks to raoul delaboule

    I uninstall and reinstall the extension and then execute the Raoul commands:

    /usr/local/psa/admin/sbin/mailmng --restart-service

    postsuper -r ALL

    Works on some minutes, is not inmediate

    0

Please sign in to leave a comment.