Symptoms
-
E-Mails are stuck in the queue with below messages in
/var/log/maillog
:amavis[26892]: (26892-01) (!)connect_to_sql: unable to connect to DSN ‘DBI:mysql:database=emailsecurity;host=localhost;port=3306’: Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (13)
amavis[26892]: (26892-01) (!!)TROUBLE in process_request: connect_to_sql: unable to connect to any dataset at (eval 132) line 253.
amavis[26892]: (26892-01) (!)Requesting process rundown after fatal error -
MariaDB upgrade has been performed recently on the server with SELinux enabled
Cause
MariaDB bug #MDEV-24941: SElinux incorrect label for server socket.
The SELinux context for the MariaDB socket file /var/lib/mysql/mysql.sock
has been lost because of the above because of upgrade to MariaDB version affected by the bug.
Resolution
To workaround the problem until the bug is resolved, set up a scheduled task which frequently restores SELinux context on MariaDB mysql.sock file /var/lib/mysql/mysql.sock​
:
-
Navigate to Tools & Settings > Scheduled Tasks (Cron jobs) and click Add Task
-
Set up the new scheduled the task with the following values:
- Run a command
- Command: /usr/sbin/restorecon -v /var/lib/mysql/mysql.sock
- Run: Cron-style: * * * * *​
- System user: root
- Description: Restore MariaDB socket SELinux MDEV-24941:
- Notify: Do not notify
-
Click OK
The scheduled task will execute restorecon command to temporarily resolve the issue. It will run automatically once in a minute.
The following alternative workarounds are also available:
-
Downgrade MariaDB server to version not affected by bug #MDEV-24941
-
Disable Amavis by disabling Plesk Email Security extension