Plugins directory not writable but permissions are correct

Plugins directory not writable but permissions are correct

by Richard Thomas -
Number of replies: 13

I have been upgrading various mods / blocks via the plugins overview page.  Most of them I have upgraded successfully but I am stuck on two mods both of which give me the "Plugin files not writable" error.

However, the permission on the mod directory and its sub directories are correct.  In fact they are exactly the same as the blocks directory and I was able to upgrade a couple of blocks without issue.

I have tried changing the permissions to a+rw but they are still unwritable according to Moodle.

What is causing this and how can I fix it?


Thanks

Average of ratings: -
In reply to Richard Thomas

Re: Plugins directory not writable but permissions are correct

by Christopher Molnar -

You need to change the entire directory where Moodle is installed to the ownership (or group) that apache is being run as. For example if you are on an Unbuntu install you would do:


chown -R www-data /home/lms/moodle   


That is assuming your moodle is installed in /home/lms/moodle 


problem is then solved.


In reply to Christopher Molnar

Re: Plugins directory not writable but permissions are correct

by Richard Thomas -

Thanks for your reply.

The ownership of the directory is correct.  Both ownership and permissions are exactly the same as the rest of the moodle directory tree.  I can upgrade blocks but I cannot upgrade mods.  I can see no difference between permissions/ownership of either directory.


In reply to Richard Thomas

Re: Plugins directory not writable but permissions are correct

by Christopher Molnar -
Would you please post the result of  ls -lR of the Moodle directory?


Thanks,

-Chris

In reply to Christopher Molnar

Re: Plugins directory not writable but permissions are correct

by Richard Thomas -

Two files attached

  1. moodle-mod-recursive -  an ls -lR of the mod directory
  2. moodle-recursive.zip - a zipped up ls -lR of the moodle base directory
In reply to Richard Thomas

Re: Plugins directory not writable but permissions are correct

by Ken Task -
Picture of Particularly helpful Moodlers

In ./mod

-rw-------  1 web5 client1 43486 Mar 12 07:00 qtype_ddimageortext_moodle26_2014010800.zip
-rw-------  1 web5 client1 60418 Mar 12 07:00 qtype_ddmarker_moodle26_2014010800.zip
-rw-------  1 web5 client1 36707 Mar 12 07:00 qtype_gapselect_moodle26_2014010800.zip

Those are the extensions/addons you are trying to install, correct?

Note they are question types - beginning of the filename suggest that.

Move them to /moodlecode/question/type/
and unzip them there.   Check ownership/permissions so that web5 is the owner and group is client1.

After unzipping and checking ownership/permissions, hit Moodle site as an admin level user.  If it doesn't automagically throw you into installing new mods, go to Notifications in the Site Admin menu.

In each of those zips, there should be a README.txt file which gives info
about the add-on/plugin.  Sometimes, readme's are worth reading for the particulars to the plugin/add-on.

'spirit of sharing', Ken

In reply to Ken Task

Re: Plugins directory not writable but permissions are correct

by Richard Thomas -

Thanks for the advice but, no, they aren't the plugins I'm trying to install.  They are plugin files that are installed (and installed in the correct place).  I just haven't removed the zip files from that directory yet.

The ones I am trying to upgrade are the certificate (mod_certificate) and questionnaire (mod_questionnaire) modules.



In reply to Richard Thomas

Re: Plugins directory not writable but permissions are correct

by Ken Task -
Picture of Particularly helpful Moodlers

First, you've got a mess and in danger of loosing it all!!!   Make a backup of the code directory before going any further.

Ownerships/permissions aside, although that still needs more discussion ...  looks like you've the certificate mod in two places ... one at /mod (where it should be located) and one in /mod/questionnaire/

Same is true of journal and hotpot (both are mods) that appear to be in the questionnaire directory.

./questionnaire:
total 424
drwxr-xr-x  4 web5 client1   4096 Jan 18  2014 backup
drwxr-xr-x  8 web5 client1   4096 Jan 18  2014 certificate
-rw-r--r--  1 web5 client1   3693 Jan 18  2014 choose_group_form.php
-rw-r--r--  1 web5 client1  10777 Jan 18  2014 crosstab.inc
drwxr-xr-x  2 web5 client1   4096 Mar  8 08:11 css
drwxr-xr-x  2 web5 client1   4096 Jan 18  2014 db
drwxr-xr-x 11 web5 client1   4096 Jan 18  2014 hotpot
-rw-r--r--  1 web5 client1    897 Jan 18  2014 icon.gif
drwxr-xr-x  2 web5 client1   4096 Jan 18  2014 images
-rw-r--r--  1 web5 client1   3494 Jan 18  2014 index.php
drwxr-xr-x  6 web5 client1   4096 Jan 18  2014 journal
drwxr-xr-x 15 web5 client1   4096 Jan 18  2014 lang
-rw-r--r--  1 web5 client1  37116 Jan 18  2014 lib.php
-rw-r--r--  1 web5 client1 125133 Jan 18  2014 locallib.php
-rw-r--r--  1 web5 client1   8238 Jan 18  2014 mod_form.php
-rw-r--r--  1 web5 client1   6782 Jan 18  2014 myreport.php
drwxr-xr-x  2 web5 client1   4096 Jan 18  2014 pix
-rw-r--r--  1 web5 client1   4118 Jan 18  2014 preview.php
-rw-r--r--  1 web5 client1   2246 Jan 18  2014 print.php
-rw-r--r--  1 web5 client1   5239 Jan 18  2014 qsettings.php
-rw-r--r--  1 web5 client1  21268 Jan 18  2014 questions_form.php
-rw-r--r--  1 web5 client1  25128 Jan 18  2014 questions.php
drwxr-xr-x  2 web5 client1   4096 Jan 18  2014 questiontypes
-rw-r--r--  1 web5 client1   4421 Jan 18  2014 README
-rw-r--r--  1 web5 client1    758 Jan 18  2014 releasenotes.txt
-rw-r--r--  1 web5 client1  33261 Jan 18  2014 report.php
-rw-r--r--  1 web5 client1   9047 Jan 18  2014 resultslib.php
-rw-r--r--  1 web5 client1   4835 Jan 18  2014 settings_form.php
-rw-r--r--  1 web5 client1   6018 Jan 18  2014 styles.css
-rw-r--r--  1 web5 client1  13335 Jan 18  2014 tabs.php
-rw-r--r--  1 web5 client1   1299 Jan 18  2014 version.php
-rw-r--r--  1 web5 client1   3077 Jan 18  2014 view.php

I'd recommend downloading the same version of Moodle you have on server to local machine.   On local machine unzip it and compare a 'stock' mod directory with your mod directory on your server.   Then, being very careful in doing so, either move a folder to it's proper location or hide it on a temporary basis to see if your moodle UI breaks.

Example of hiding in the directory shown above: mv  certificate .certificate

See the 'dot' in front of the second 'certificatef'?   That hides it from apache, thus hides it from Moodle.

Then log onto your Moodle and check mods/blocks/ etc..

If you want hotpot or journal one could use mv to move the folder up on level.

Again in the directory shown above:

mv hotpot ../ (the ../ means up one level)

This would move the directory hotpot up one level which puts it into mod (where it should reside).

Same with journal.

Exception to both hotpot and journal move ... do they already exist in /mod?

Best of luck cleaning up the mess!

'spirit of sharing', Ken

In reply to Ken Task

Re: Plugins directory not writable but permissions are correct

by Richard Thomas -

How odd!  I am working on a test site so I can work through the steps to remove the extra installs - though I have no idea how they got there - before doing the same procedure on the production site.


Thank you for you advice.

In reply to Ken Task

Re: Plugins directory not writable but permissions are correct

by Richard Thomas -

Thanks again for the advice.  I stepped through the process of updating/upgrading/cleaning up on my test site several times until I was happy with the process and results.  The production server has now been cleaned up and all is looking good.


In reply to Richard Thomas

Re: Plugins directory not writable but permissions are correct

by Ken Task -
Picture of Particularly helpful Moodlers

Good!  Glad to hear it.   That's what it takes sometimes ... sandbox for learning until ya get it down.

'spirit of sharing', Ken

In reply to Richard Thomas

Re: Plugins directory not writable but permissions are correct

by Ken Task -
Picture of Particularly helpful Moodlers

Sounds like you are using 'mdeploy' ... ie, the latest 'feature' of Moodle to upgrade/install blocks/mods.   It's great when it works ... kinda confusing when it doesn't.  

Sure would be nice to see a:

cd /pathtomoodle/

ls -lR blocks

and a

ls -lR mod

The error *might* be reporting in-correctly.   If updating via the web, one gets a screen that says it will download an updated zip to a directory.   What path is that showing?

What do the ownership/permissions look like on (recursively):

moodledata/mdeploy/

Moodle uses that directory to download the zip and unzip it (and archives those versions of updates):

Here's what certificate updates/upgrades looks like on a 2.6 server:

drwxr-sr-x  7 apache apache 4096 Jan 23  2013 certificate_1358957010.0
drwxr-sr-x  7 apache apache 4096 Feb 26  2013 certificate_1361896557.0
drwxr-sr-x  7 apache apache 4096 Jan  8  2014 certificate_1389187582.0
drwxr-sr-x  7 apache apache 4096 May 28 18:18 certificate_1401319121.0

Would think that if ownership/permssions are not correct on mdeploy it would fail.

Also, in the directory, there is an mdeploy.log file.

Related to the above mod:

2014-05-28 18:18:39 === MDEPLOY EXECUTION START ===
2014-05-28 18:18:39 Successfully authorized using the passphrase file
2014-05-28 18:18:39 Plugin upgrade requested
2014-05-28 18:18:39 Downloading package https://moodle.org/plugins/download.php/6151/mod_certificate_moodle25_2013102301.zip
2014-05-28 18:18:39 Using custom CA certificate /var/www/moodle25data/moodleorgca.crt
2014-05-28 18:18:41 Package downloaded into /var/www/moodle25data/mdeploy/var/dae106eaba2f1b10a1f92d1ca6b532c1.0.zip
2014-05-28 18:18:41 MD5 checksum ok
2014-05-28 18:18:41 Current plugin code location: /var/www/html/moodle25/mod/certificate
2014-05-28 18:18:41 Moving the current code into archive: /var/www/moodle25data/mdeploy/archive/certificate_1401319121.0
2014-05-28 18:18:41 Package successfully extracted

Maybe that log file will give you a hint/clue.

'spirit of thinkering', Ken