Symptoms
The Logrotate service logs errors on servers with an error such as the one below:
CONFIG_TEXT: HOSTNAME logrotate[]: error: error renaming /usr/local/cpanel/3rdparty/wp-toolkit/var/logs/sw-engine.error.log to /usr/local/cpanel/3rdparty/wp-toolkit/var/logs/sw-engine.error.log.1.gz: Read-only file system
This error states that the WP-Toolkit logs cannot be written to or moved as the system is "read only".
Description
This happens on servers where Logrotate is controlled by Systemd; on these servers, the ProtectSystem Systemd variable is enabled, which prevents the service from accessing file paths within the /usr and /etc Directories. This then leads to the error above as the WP-Toolkit logs are located within the /usr path.
We've opened an internal case for our development team to investigate this further. For reference, the case number is EXTWPTOOLK-13990. Follow this article to receive an email notification when a solution is published in the product.
Workaround
This can be worked around by adding a ReadWritePath variable to the LogRotate service. This can be done with the commands below. This should be performed by the root user via SSH:
Create an override systemd file by running the following command.
# systemctl edit logrotate.service
Add the following syntax.
CONFIG_TEXT: [Service]
ReadWritePaths=/usr/local/cpanel/3rdparty/wp-toolkit/var/logs/Reload Systemd
# systemctl daemon-reload
Restart the logrotate service
# systemctl restart logrotate
Afterward, you can verify this is enabled by running the command below. This will list the loaded environment variables for the Logrotate service and specifically check for the modification added in step 2 above.
# systemctl show logrotate | grep -i '^readwrite'
A successful return when this is enabled will look like the following:
CONFIG_TEXT: root@host systemctl show logrotate | grep -i '^readwrite'
ReadWritePaths=/usr/local/cpanel/3rdparty/wp-toolkit/var/logs
Comments
0 comments
Article is closed for comments.