Symptoms
Attempting to restart Apache or PHP-FPM produces errors similar to the following.
Apr 02 19:16:23 server restartsrv_httpd[24273]: at
/usr/local/cpanel/Cpanel/PHPFPM/Controller.pm line 140.
Apr 02 19:16:23 server restartsrv_httpd[24273]:
Cpanel::Exception::Services::RestartError
Apr 02 19:16:23 server restartsrv_httpd[24273]: Service Status
Apr 02 19:16:23 server restartsrv_httpd[24273]:
Found 1 versions of PHP-FPM: 56
Apr 02 19:16:23 server restartsrv_httpd[24273]: Service Error
Apr 02 19:16:23 server restartsrv_httpd[24273]:
(XID wg98e6) The “apache_php_fpm” service failed to restart because the… error:
Apr 02 19:16:23 server restartsrv_httpd[24273]:
apache_php_fpm has failed. Contact your system administrator if the ser...over.
Apr 02 19:16:23 server restartsrv_httpd[24273]:
restartsrv_apache_php_fpm --graceful exited unclean
Websites will show 500 errors and the Apache error_log will show errors similar to the following.
Fri Apr 2 20:38:29 2021 (4546): Fatal Error Unable to create lock file:
Bad file descriptor (9)
[Fri Apr 02 20:38:29.030721 2021] [cgid:error] [pid 4363:tid 47947418986240]
[client x.x.x.x:48980] End of script output before headers: ea-php56
Fri Apr 2 20:38:29 2021 (4547): Fatal Error Unable to create lock file:
Bad file descriptor (9)
[Fri Apr 02 20:38:29.126314 2021] [cgid:error] [pid 4363:tid 47947418986240]
[client x.x.x.x:48980] End of script output before headers: ea-php56
Attempting to create files in /tmp fails with a "Read-only" error.
touch /tmp/test
touch: cannot touch ‘/tmp/test’: Read-only file system
Description
When file system errors occur and it becomes impossible to reliably read from or write to /tmp
, the OS will mark the file system "read-only." This prevents services, such as Apache and PHP-FPM, from creating temporary files. Unlike physical and logical partitions, loopback partitions, such as the ome securetmp
creates, are not true partitions and cannot be repaired with utilities like fsck
or xfs-repair
. Instead, /tmp
needs to be deleted and recreated.
Workaround
The following procedure should be performed by a certified administrator to ensure nothing goes wrong.
- Access the server's command line as the 'root' user via SSH or "Terminal" in WHM.
- Open
/etc/fstab
in your preferred text editor. - Comment out the
/tmp
entry.#/usr/tmpDSK /tmp ext3 defaults,noauto 0 0
- Disable the
securetmp
service.systemctl disable securetmp
- Reboot the server.
shutdown -r now
- Remove the old
tmpDSK
file./bin/rm /usr/tmpDSK
- Run the
securetmp
script./scripts/securetmp
- Enter "y" at the prompts to confirm, enable, and configure the boot option.
- Reboot the server again.
shutdown -r now