Mod is not writable

Mod is not writable

by Anatole Landrein -
Number of replies: 24
Hello

After a migration from MoodleCloud to a self-hosted Moodle I still have to install the missing plugins (48 out of 472).

Install plugin from zip file => I have the following message:

Debugging output enabled
ZIP /home/capaepe.coursacademiques.fr/moodledata/temp/tool_installaddon/6439489d171c9/plugin.zip
Validating mod_attendance ... Error
  [OK] Name of the plugin to be installed [attendance]
  [OK] Plugin version [2023020107]
  [OK] Required Moodle version [2022090200]
  [OK] Full component name [mod_attendance]
  [OK] Declared maturity level [MATURITY_STABLE]   [OK] Plugin release [2023020107]
  [Debug] Found language file [attendance]
  [Error] Write access check [/home/capaepe.coursacademiques.fr/public_html/moodle/mod] Installation aborted due to validation failure


With SSH the ls -l command gives me this for the /mod/ directory:

drwxr-xr-x 26 root      root        4096 Mar 11 05:10 mod

It seems ok, right? Permissions and owner ok?
What can be the problem ?

Thanks


Average of ratings: -
In reply to Anatole Landrein

Re: Mod is not writable

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

Your webserver needs to be the owner of the moodle folder and subdirectories...

Average of ratings: Useful (1)
In reply to Emma Richardson

Re: Mod is not writable

by Anatole Landrein -

I indeed solved the problem: it was necessary to give the permissions not to root but to "5002", via a chwon -R.
Now it works! 🙂

In reply to Anatole Landrein

Re: Mod is not writable

by Ken Task -
Picture of Particularly helpful Moodlers

That's odd!

And what user is 5002 associated with on your system?

'SoS', Ken


In reply to Ken Task

Re: Mod is not writable

by Anatole Landrein -
I must confess that I don't know how to answer this question. 😊
I just found that it was the number associated with the public_html directory.
In reply to Anatole Landrein

Re: Mod is not writable

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
> I must confess that I don't know how to answer this question.

I repeat: "It is worth learning the Unix file permissions if you you are going maintain a Moodle server on the Unix command interface, aka Shell."

Although this is generally true, if you are not in a true Shell, as in a VPS or a root server, but in a "jail" aka chroot, as in shared hosting, that makes matters complicated. Then you need specific instructions from your hosting provider.

Hint: When talking Shell, keep to that language. Don't paraphrase, just quote.

_Example_:

$ ls -ld /path/to/mod
drwxr-x--- 27 johnd www-data 4096 Apr  6 14:05 mod
In reply to Anatole Landrein

Re: Mod is not writable

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
The ownership and the file permissions of your mod/ directory are good.

The "problem" you have is different. For the web server to unzip a zip archive in mod/, the web server needs write permissions in mod/. So you need to make mod/ writable by the web server, if you want to go that path. The cautious system administrator would undo this once the the plug-in is in place.

How exactly does one open can close these permissions? It is worth learning the Unix file permissions if you you are going maintain a Moodle server on the Unix command interface, aka Shell. It is not theoretical physics. Yes, there are always people who will give you copy-and-paste "recommendations". The prudent "super user" won't run any without understanding them.
wink
In reply to Visvanath Ratnaweera

Re: Mod is not writable

by Anatole Landrein -
Do you mean set chmod 777 ? It make no difference.
In reply to Anatole Landrein

Re: Mod is not writable

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Glad to hear that you solved the problem. But after studying the precursor  I expect more. You are yet to tell us how exactly you migrated the MoodleCloud instance to your new server.
In reply to Visvanath Ratnaweera

Re: Mod is not writable

by Anatole Landrein -
I followed Moodle_migration.
In reply to Anatole Landrein

Re: Mod is not writable

by Ken Task -
Picture of Particularly helpful Moodlers

mod directory must be writable by web service user if using the GUI interface to install plugins.

Typical config of apache web server, that user is 'apache'.

But your server setup shows your code is in 'public_html' - that could be a 'user jail'.   You are hosted on HOSTINGER so it might be a good idea to consult HOSTINGER docs/faqs on setup of customer web sites.  More than likely, you have a 'customer' login which is not the same as the apache user and it's that login that needs to own the folders/files in moodle code.

https://support.hostinger.com/en/articles/1583479-how-to-fix-file-permissions

'SoS', Ken



Average of ratings: Useful (1)
In reply to Anatole Landrein

Re: Mod is not writable

by Anatole Landrein -
I installed all the missing modules except some that I can't find from the Moodle Plugin Directory.

Here they are :

nps_survey (block_nps_survey)
count (atto_count)
fileslist (tool_fileslist)
moodlecloud (logstore_moodlecloud)
Local plugins :
filestorage (local_filestorage)
logging (local_logging)
moodlecloud (local_moodlecloud)

How to find these missing modules? 
Are they specific to MoodleCloud?
In reply to Anatole Landrein

Re: Mod is not writable

by Ken Task -
Picture of Particularly helpful Moodlers

When you move off moodlecloud or a site hosted with a Moodle Partner,  you get only an SQL dump of your database and NOT the code directory cause the code isn't the same as DIY moodle code one can download.

So you will NOT find them in Moodle plugins to install.  They are contained in the SQL dump and your stock/DIY moodle will complain they are missing from disk.  Only option is to say OK and let your moodle remove the tables associated with those.

Then inspect all the courses to see if those had been used in courses somewhere and remove those.

'SoS', Ken



Average of ratings: Useful (2)
In reply to Ken Task

Re: Mod is not writable

by Anatole Landrein -
OK I think I understand but what if they are necessary for the courses ?
Some where missing, I installed them and they are no longer marked as missing now.
In reply to Anatole Landrein

Re: Mod is not writable

by Anatole Landrein -
Apart from testing all the features of all the courses one by one, 😓  is there no solution to see if these 7 plugins are necessary?
In reply to Anatole Landrein

Re: Mod is not writable

by Ken Task -
Picture of Particularly helpful Moodlers

With 2 persons in same thread - with different issues - this is getting confusing ... for all.

So this is in response to @Anatole

Plugins/Addons are not supposed to modify core code.
Are we talking about these?

nps_survey (block_nps_survey)
count (atto_count)
fileslist (tool_fileslist)
moodlecloud (logstore_moodlecloud)
Local plugins :
filestorage (local_filestorage)
logging (local_logging)
moodlecloud (local_moodlecloud)

or others?

Those that show moodlecloud you can't acquire, there fore not necessary.  The others??? depends upon usage in site, I would think!   Those that say 'local' are found in /local/ of moodle code - like these:

filestorage (local_filestorage)
logging (local_logging)

In local of a 4.1.highest site I have I don't have those.

Suggest going to moodle plugins site to see if you cannot find them there and read up on what they do.

in mod of a 4.1.highest core:
assign           choice    glossary     label   README.txt   url
assignment       data      h5pactivity  lesson  resource     wiki
bigbluebuttonbn  feedback  hvp          lti     scorm        workshop
book             folder    imscp        page    survey
chat             forum     index.html   quiz    upgrade.txt

Never delete them.  Just hide if you don't want to use.

IF you go to Site Admin - Plugins - Manage Activities
you will/should see a list of Activity modules used ... second column the number
of courses that use that activity.

So if you have 100 courses and you see 100 in that column then all courses used
that activity.

For testing, click the number, click a course that's listed, and test.
One has to assume that if it works in one course, it will work in all!

One has also to assume that course is representative of all courses in site.  We, here in forums, have NO IDEA of what is 'representative' on YOUR site!!!!

If you saw 0 - meaning no courses use that - then consider hiding it first (just in case) before removing but DO NOT REMOVE CORE MODS OR BLOCKS OR THEMES - if you don't want to use a CORE MOD/BLOCK/THEME, JUST HIDE IT.

Might want to turn on debugging to test representative course just to see.

'SoS', Ken


Average of ratings: Useful (1)
In reply to Ken Task

Re: Mod is not writable

by Anatole Landrein -

Thanks, that's exactly the information I was looking for ! 🙂

And yes I was actually talking about the 7 plugins mentioned.

That way I know now where they are used: in the SCORM package activity

Then I don't know if it is necessary to install one of the SCORM Cloud for Moodle or SCORM Cloud Course Format plugins form Moodle Plugins directory.

In reply to Anatole Landrein

Re: Mod is not writable

by Ken Task -
Picture of Particularly helpful Moodlers

SCORM's a mini-applications built outside of moodle.  Moodle only plays them.

Moodle does have a core SCORM player.

Did you click the number, then click the first course link listed, then click a SCORM in that course to see if it played?

The plugins you listed before did not show a plugin for SCORM's, so you might not need an addon installed to play them ... that's unless they don't play.

If they don't play, turn on debugging and attempt to play again to see what your moodle might be saying about why.

If there are issues, suggest using the SCORM's forum to post about those issues.  Dan Marsden moderates that forum and is the lead for SCORM's in moodle.

https://moodle.org/mod/forum/view.php?id=1951

'SoS', Ken

Average of ratings: Useful (1)
In reply to Anatole Landrein

Odp: Mod is not writable

by Piotr F -
Hi, thanks for all tips here.

Currently, what is the subject of this topic?
Apologies, got losty a bit.
Thought it was, eventually, about setting right permissions to /mod in order to add plugins.
I would like to continue that issue exactly, to create some kind of a full manual as it might be useful for other people looking for the solution.
Where should the problem 'mod is not writable' go then, as I am not familiar with the policies?
Shall I open another thread of the same title with _2 at the end, with the focus on the very issue?

From what I have read here, it looks like there is a discrepancy between 'right permissions' and admin web UI:
if advices given here are correct then only root should have the permissions, ergo, it would not allow to add any plugin via web UI. It will be very safe but inconvenient.
If the above is correct than how to use admin web UI?
In reply to Piotr F

Re: Odp: Mod is not writable

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Your understood correctly, for example this post. In other words, to make the web GUI installation of additional plug-ins to work, various sub-directories of the Moodle code need to be writable by the web server - ./mod is one of them. But this is a less than optimum configuration - in the eyes of some system administrators, I must say. There are others who are happy with it.

The short answer is: You can't be safe and convenient at the same time. Think of it. Door locks to your house is inconvenient - but safer. ;)

Your alternatives are:
1. Convenient: make those directories writable by the web server
2. Safer: don't do that. Instead:
2.a either install the additional plug-ins manually (in the Unix shell)
2.b or make those directories writable by the web server, install the additional plug-in the web GUI way and then take back the writability.

P.S. Yes, the conversation threading is hopelessly broken. You got your own thread. This one is a thread another poster has created - which you already tried to hijack once. Since you're here you might as well continue here. This is not about a specific issue, rather about documenting a "discrepancy". ;)