- Plesk Onyx for Linux
Cannot start Fail2ban at Tools & Settings > Service Management:
PLESK_ERROR: Unable to start service: Unable to manage service by f2bmng: ('start', 'fail2ban'). Error: Job for fail2ban.service failed because the control process exited with error code. See "systemctl status fail2ban.service" and "journalctl -xe" for details. ERROR:__main__:Failed to start fail2ban service
Journalctl shows the following errors:
# journalctl -u fail2ban.service
server fail2ban-client: ERROR There is no directory /var/run/fail2ban to contain the socket file /var/run/fail2ban/fail2ban.sock.
Cannot enable mail forwarding for a mail account or create a domain:
PLESK_ERROR: Error: mailmng-mailname failed: Unable to open file "/run/lock/files/c1be0a084f503a66d2be105959ad7f82": No such file or directory.
System error 2: No such file or directory
Error occurred while locking the file /var/qmail/mailnames/example.com/johndoe/.qmail: No such file or directory
Either of the directories
# ls -ld /run/lock/files /run/fail2ban
ls: cannot access /run/lock/files: No such file or directory
ls: cannot access /run/fail2ban: No such file or directory
- Backup creation fails:
PLESK_ERROR: Error: server "server" Cannot encrypt dump file (this is not fatal error!): PHP Warning: fopen(/run/lock/files/backup_encrypt.lock): failed to open stream: No such file or directory; File: /opt/psa/admin/plib/backup/Encryptor.php, Line: 499 [2019-01-30 23:15:28.895] ERR [panel] Unable to open file /run/lock/files/backup_encrypt.lock
The dynamic directory
/run is re-created every server reboot but not all the required sub-folders are re-created. This is a Plesk bug with ID #PPPM-10011 which is planned to be fixed in one of the future product updates.
Note: If the administrative access to Plesk server via SSH is not available, contact the hosting/server provider regarding the issue.
As a workaround:
Connect to the server via SSH;
Create the missing directories:
# mkdir /run/lock/files
# mkdir /run/fail2ban
Set correct permissions:
# chown root:psaadm /run/lock/files/
# chmod 770 /run/lock/files/
# chown root:root /run/fail2ban
# chmod 755 /run/fail2ban
Create files with the content which will re-create the missing directories after each server reboot:
Note: This step is for OS with Systemd support, for example, CentOS 7, Ubuntu 16 and etc.
Note: This step requires root:root owner and group for "/" partition to work. Check with command "# ls -ld /"
# echo "d /run/lock/files/ 0770 root psaadm" > /etc/tmpfiles.d/lockfiles.conf
# echo "d /run/fail2ban 0755 root root" > /etc/tmpfiles.d/fail2ban.conf
Note: for Virtuozzo 6 based servers, apply the solution from this article