I am trying to identify the cause of an error that occurs when adding a new module in the Configure Module Menu Filters section. This happens when saving. After this when trying to visit the site I get the message 503 Service Unavailable and in the logs the message [Thu Sep 12 14:43:01.629325 2024] [core:notice] [pid 3655] AH00052: child pid 4085 exit signal Segmentation fault (11). It was identified that the error is solved after clearing the cache. Once the cache is cleared, it waits for what seems to be a variable number of minutes between 1 and 3 and the site becomes accessible again
I’ve been investigating and I’ve noticed two things
The permissions of the newly created modules have changed to drwxrwsr-x instead of rwx--S--- which is how the previous ones were
Another thing I notice is the cache permissions. The ready
Hi. Thanks for answering. I understand that the first commands are for the whole project. Then specific permissions for cache, custom, modules, themes, data and upload. Could you explain the last one?
Could I run it alone?
sudo chmod -R 775 cache
Well, as I said, deleting cache solves the error.
Also in the cache directory I notice that the cache and modules directories are owned by root.
The ownerships are very relevant and they should not be root.
The reason they become root is because some process running under root touched those files. The most typical situations are:
you log in as root, via shell, SSH, FTP, etc, and edit the files or move them around
your cron jobs are running as root user
Both of these things shouldn’t happen. Ownerships in SuiteCRM should be stable, and you shouldn’t need to reset them after the first time. This might not be easy to achieve in real life, but at least it should be the goal.
A couple more things to check:
default_permissions entry in your config.php
if you notice that new files are created with wrong ownerships or permissions in a specific directory (such as cache), check the SetOID and SetGID bits on the parent directory.
Note the leading 0 in the numbers, that signals to PHP that you’re using octal notation, which is what those more familiar permissions values are written in. Then after QR&R that might get turned into the equivalent decimal (like the values you have now, without leading 0).
I was not familiar with the terms SetOID and SetGID. I did some research and identified the SetGID bit is set. These are the permissions of cache/
drwxrwsr-x
So new files or directories inside cache/ should inherit the group www-data
Regarding the state of directories with owner root inside cache/ they were probably executed by a user who changed privileges to root and not the correct user
I do not have the authority to test if this solves the original problem. I will make the suggestion, as soon as it is done I will leave a comment
The following points can be done to resolve the mentioned error:
Check File Ownership:
It’s important that the web server user (e.g., www-data for Apache) has ownership of the necessary files and directories. If directories like modules/ and cache/ are owned by root, this could lead to access issues.
Ensure that directories have the correct permissions. A typical permission setting would be 755 for directories and 644 for files. For the cache directory, ensure it is writable by the web server user:
find /path/to/your/suitecrm -type d -exec chmod 755 {} ;
find /path/to/your/suitecrm -type f -exec chmod 644 {} ;
Fix Cache Directory Permissions:
If the cache directory has the wrong owner or permissions, it can cause the application to fail. Correct the permissions: