## General help

### Fatal error: $CFG->dataroot is not writable, admin has to fix directory permissions! Exiting. Fatal error:$CFG->dataroot is not writable, admin has to fix directory permissions! Exiting.

Hi all,

We've been experiencing this error for some time now and after reading and all threads that relates to this error on this forum, we've still not able to do any remedy for this. What's different with our situation is that the Moodle Server freezes and does not response. What we do is restart the system and it becomes OK again. We've been suspecting that it could be a hardware problem, first the harddisk,  we've replaced the hard disk and restored Moodle, but still problem occurs. I'm now suspecting it could really the server that has a problem. Below are the details of the installation and server specs. All help, suggestion and replies are much appreciated. Thank you very much!

Moodle Version: 2.4

Moodle Server Spec:

• OS: CentOS 5.9
• 1 x 2.0GHz Quad Core Xeon E5504 Nehalem
• Chipset/FSB: Intel 5520
• 4 x 2GB DDR3 1066 ECC Reg in 18 DIMMs
• Expansion slot: 2 PCI-E 2.0 x8
• 1 PCI-E x4
• 3 PCI-X 133/100 Mhz
• LAN: Dual Gigabit LAN
• VGA: ATI ES1000 32MB Graphics Controller
• Intel ICH10R SATA Controller
• RAID 0, 1, 5, & 10 – Check OS COMPATIBILY
• 1 x 1TB SATA BARRACUDA ES hard disk
• 8 x 3.5"Hot Swap SAS/SATA; 3 x 5.25"bays
• DVD-RW
• Power Supply: 800Watts Redundant Power Supply
• Cooling System: 5 x 8cm heavy duty cooling fans,
• Super Doctor III, Watch Dog

Error Scenario:

When LMS is accessed it displays "Fatal error: $CFG->dataroot is not writable, admin has to fix directory permissions! Exiting." and the server freezes but can still be pinged. Should anyone require further details I'd be glad to answer. TIA Average of ratings: - Re: Fatal error:$CFG->dataroot is not writable, admin has to fix directory permissions! Exiting.

Hi Dexter

You need to give dataroot folder 777 permission where your all data is stored. Please give this permission with terminal so that all files and folders inside data folder are writeable

Average of ratings: -
Re: Fatal error: $CFG->dataroot is not writable, admin has to fix directory permissions! Exiting. Hi Sakshi, Good day! Thank you for the response. We've already set the permission of the moodledata folder to 777 long before we've encountered the problem. What we don't understand is that it displays the "Fatal error:$CFG->dataroot is not writable, admin has to fix directory permissions! Exiting." error and the server is unresponsive/freezes so we have to restart the server. Could it be that the hardware (server) that is causing the "Fatal error: $CFG->dataroot is not writable, admin has to fix directory permissions! Exiting." error since its unresponsive and Moodle cannot access the dataroot folder? Thanks Average of ratings: - Re: Fatal error:$CFG->dataroot is not writable, admin has to fix directory permissions! Exiting.

Thanks for complete description of system.

Question:  the moodledata directory might be on a partition of it's own (/data).  The 'df' command will show all partitions/devices.

If Moodle is set to use files for session information that attempts to write a session file to moodledata/sessions/.  Can change that behavior by editing config.php and adding: $CFG->dbsessions=1; That will use DB for session information. Typically, DB files are on/in /var/ Is apache server still running? ps aux |grep httpd Check logs: dmesg | less Might check CentOS forums for such situations where system mounts a partition as ro. http://bit.ly/1eD0Qdi 'spirit of sharing', Ken Average of ratings: - Re: Fatal error:$CFG->dataroot is not writable, admin has to fix directory permissions! Exiting.

Knowing CentOS, I would bet very large amounts of money that this is a SELinux issue.

CentOS ships with very tight SELinux rules by default. One of those rules prevents Apache and PHP from accessing files outside the webroot, which is where your moodledata folder will be.

Average of ratings:Useful (1)
Απάντηση: Re: Fatal error: $CFG->dataroot is not writable, admin has to fix directory permissions! Exiting. Indeed, it's a SELinux issue. I had met the same problem.. If you don't want to disable SELinux at all, you can run the following command: chcon -R -t httpd_sys_content_t /path_to/moodledata This sets SELinux to allow apache to write to the directory. Andreas Average of ratings:Useful (1) Re: Fatal error:$CFG->dataroot is not writable, admin has to fix directory permissions! Exiting.

First question one needs to ask when debugging an issue such as this, is, has it always been like this on this hardware, or has it only just started cropping up recently?

There can be many reasons that the error message is coming up, however considering your system is freezing/locking up/potentially kernel panicking may be from something completely different, such as the RAID device failing, or even the RAM failing, but in order to really figure out what's going on we need to know the answer to the question above and go from there.

I'd also strongly advise pulling down relevant logs in /var/log (specifically dmesg/kernel logs, syslog, messages, etc), both current, and archived ones, and go through the error messages on there, hopefully they're being captured, which may not be the case considering your having disk issues...

If you have access to the terminal, you could also modify syslog to output to tty8, and watch that for errors as well.

Matt

Average of ratings: -