Resolving a Media Module Update FAILURE
So, one day, I got this email from the Drupal system:
The body of the email looked like this:
So, I went to the website to run cron to get an overall report on the status of the Drupal 7 system:
Here's what I got as a result:
So, I clicked on available updates to see what needed updating
OK, the Media Module needs updating. Fine.
So, I checked Media and clicked on the Download these updates button:
Not having much to say about the presented information, I clicked on Continue:
DRUPAL: Failure(s) on Multiple Levels
First of all, the error message is truncated, making the error condition hard to diagnose.
Second, there's clearly a file permissions problem or a filesystem security problem (or both) at play here, with no diagnostic messaging in the offing to help anyone figure out what the nature of the error might be.
Third, why are Next steps being displayed when the system is clearly in an error condition?
Fourth, my site is now in maintenance mode, which means customers cannot access my site while I am figuring out yet another obscure Drupal error.
Showing the Entire Error:
I suppose seeing the entire error is too much to ask of the Drupal 7 System?
Thankfully, I know a trick I learned ten years ago when I first started struggling with Drupal - which is to use CTRL-A to highlight the entire screen and then paste the content into Microsoft Notepad.
Here's what I got:
So now we at least know where the error is and what it pertains to:
File Transfer failed
Reason: Cannot remove file <root>/sites/all/modules/media/README.txt
So there's some problem with the apache server being able to manipulate files in the area of the Drupal 7 system related to /modules, and this error manifested when the Apache user tried to mess with the README.txt file.
Hmmm...these kinds of errors were already addressed in an earlier article I wrote about Enabling the Drupal 7 GUI to Upload Modules:
https://mymanthemaker.blogspot.com/2019/10/enabling-d7-to-upload-modules.html
So let's quickly scan that article and use that information to help guide us while we take a look at the permissions of the modules directory, shall we?
drwxr-xr-x. 54 apache apache 4096 Oct 24 12:11 modules
unconfined_u:object_r:httpd_sys_rw_content_t:s0 modules
Well, this SELINUX security context is also cool (rw)
Let's drill down to the next layer, shall we?
# cd modules
# ls -l
drwxr-xr-x. 10 root root 4096 Jul 15 23:31 media
This is because when I am at the command line my security context is root, an account with the power to do anything. But when I am using the GUI I am considered by Linux to be the apache user (which is the web servers security context) which has a much more limited set of rights than does root.
Let's fix the ownership issue, and see what happens:
# chown apache:apache ./media -R
OK, let's re-run the update. But first we need to find where in the Administration Interface to go to make an update happen, because the Drupal 7 Module Update error screen offers nowhere to go.
UTTER FAILURE AGAIN
OK, there's one more thing to check - the SELINUX permissions:
# ls -lZ
unconfined_u:object_r:httpd_sys_content_t:s0 media
Well, that's no good, it needs to be read/write (rw) for Apache to be able to make changes:
chcon unconfined_u:object_r:httpd_sys_rw_content_t:s0 ./media -R
Now, let's try that update again.
OK, click on Continue for the third time now...
Alright! Finally! Success!
Now we can click on Run database updates to finalize this fix.
Click on Continue:
Looks like we are done.
No comments:
Post a Comment