Error "error/file_not_writable" when attempting course back up

Error "error/file_not_writable" when attempting course back up

by Michael Otto -
Number of replies: 3

Hi Everyone

To provide some background, I recently upgraded my moodle from 1.9.x to the latest revision of 2.3. The vast majority of site functions operate flawlessly, save for some minor, but noticeable exceptions, such as backup.

I am attempting back up a course through the inteface, and receive the following error:

error/file_not_writable

There is a link that directs me to the following page to get more information as to what is wrong, but it contains nothing of use:

http://docs.moodle.org/23/en/error/moodle/file_not_writable

The error suggests a permissions failure - I am not sure of this is the case, and if it is, is the error in the file system or in the database...

I consider myself an intemediate Unix/Linux admin and am looking for some instructions that can guide me to a) better uinderstand this error (its source and the reason for the effect) and b) work instructions on how to fix the issue so I may backup courses.

I appreciate everyones help, and apologize in advance if this is a re-post. I have searched the forums and have come up short.

Thank you all

Average of ratings: -
In reply to Michael Otto

Re: Error "error/file_not_writable" when attempting course back up

by Ken Task -
Picture of Particularly helpful Moodlers

When Moodle courses are backed up, Moodle uses moodledata/temp/backup folder to build the backup .mbz file.  Moodle must be able to create temporary folders and xml files in that backup folder in order to build the backup .mbz file (which is really a .zip).

Check ownership/permissions on moodledata folder:

chown apache:apache /var/www/moodledata -R

if on a CentOS/RHEL/Fedora system.  If on 'other' use whatever appropriate.

While inspecting moodledata/temp/backup/ folder might look to see if there are any .log files there.  They are text and can be viewed with cat.  Sometimes they give hints.  If a backup is successful one might see 0 byte .log files there.

Run the backup again.  If it again fails, turn on debugging and see what it says.

'spirit of sharing', Ken

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

Re: Error "error/file_not_writable" when attempting course back up

by Michael Otto -

Ken, thank you very much for your swift reply. The information you provided was EXACTLY what was needed. The only varience to the information you provided is the user name referneced in the change owner (chown) command listed above based on the fact that I am running a different distribution of Linux. In effect, where your command suggests "apache" as the user name, I simply replaced it with the appropriate user name based on the distribution I am currently running.

Thanks again Ken

Michael Otto

In reply to Michael Otto

Re: Error "error/file_not_writable" when attempting course back up

by Clement See -

l am facing a similar problem. However l am not very experienced with moodle. When l try to delete to a topic or any object from , as the admin user after turning editing on, l get the "error/file_not_writablesad

These are the specs of my moodle instance

  • Moodle 3.1.1+
  • Centos 7 OS 
  • Apache 2.4.6 
  • MySQL 5.6.31
  • PHP 5.4.16

The moodle paths are as follows

  /var/www/moodle/moodledata

  /var/www/moodle/moodlesite

  /etc/php.ini

  /etc/httpd/conf/httpd.conf

l have ensured that the permissions on : /var/www/moodle/moodledata are correct ( 777), and the folders are owned by the apache user


Apache writes logs on: 

   ErrorLog "/var/log/httpd/error.log"

The logging path for PHP configs are as follows:

 log_errors = On

 error_log = /var/log/httpd/php-errors.log

Whenever l try to delete an object on moodle, or to duplicate an object , l get the "error/file_not_writable" on the frontend. l don't see any trace of this error on the log files for apache or PHP. The /var/log/httpd/  folder permissions have also been changed to 777 in desperation.

l read through https://moodle.org/mod/forum/discuss.php?d=165833 and other posts, but l can't seem to find a solution to this. Please help with pointers. l need to know exactly

  • which log file is not writeable, where moodle is trying to write to
  • l also need to be able to see this error in detail on the log file(s)