0

I have searched the answers on this site and have found threads like Configuring the temporary directory which refer to this issue but could not arrive at a solution. My setup is Linux (Fedora), Apache, PHP 5.4.22 with Drupal 7.24 and I've done the following to ensure a correct configuration of the Drupal file tree:

1) chown -R apache:apache Drupal
2) cd Drupal
3) mkdir tmp
4) chmod 777 tmp
5) Change temporary directory in drupal admin/config to "tmp"

When I try to install a module (either through direct file upload or via URL) I get the error:

Module Installation: Unable to create directory 'temporary://update-extraction-f781a69c/

Now, the curious thing is that when I look in Drupal/tmp I see the following:

[root@localhost tmp]# ls -l
total 1448
-rw-rw-r-- 1 apache apache 1476650 Dec 13 23:24 bcommerce.tgz
drwxr-xr-x 2 apache apache    4096 Dec 13 23:24 update-extraction-f781a69c

So the extraction folder is created and seems to have proper ownership and permissions yet I'm still getting this error.

I've also ensured that the files in my tgz archive have proper permissions and are owned by apache, so their permissions should also be OK.

Any ideas on what might be wrong here would be much appreciated; I've been banging my head against this issue for a few hours now and have gotten nowhere.

4
  • Change temporary directory in drupal admin/config to "tmp" Try changing that to '/path/to/drupal/root/tmp'
    – Clive
    Commented Dec 13, 2013 at 22:36
  • Just tried it, unfortunately it gives the same error. BTW, the Drupal admin/config screen for files does not report errors for either of these settings, so fundamentally they seem OK even though the upload process does not work.
    – user13955
    Commented Dec 13, 2013 at 22:47
  • Yeah that was a long shot considering you've got files in the temp folder already; just thought it might be a weird relative path issue.
    – Clive
    Commented Dec 13, 2013 at 23:23
  • I've got the same exact issue on Drupal 7.24, I'm yet to upgrade the site to 7.26 and try. I'll report back.
    – bitfed
    Commented Feb 22, 2014 at 16:41

1 Answer 1

1

For me, things like these were caused by selinux. Either disable it, or add appropriate policy:

grep httpd /var/log/audit/audit.log | tail -n 50 | audit2allow -M drupaltmp   
cat drupaltmp.te 

Look inside, may be tune a little. I've got this:

module drupaltmp 1.0;

require {
        type httpd_t;
        type var_lib_t;
        type etc_t;
        type etc_mail_t;
        class file { write setattr };
        class dir { search create getattr setattr };
}

#============= httpd_t ==============
allow httpd_t etc_mail_t:dir { search getattr };
allow httpd_t etc_t:dir setattr;
#!!!! This avc is allowed in the current policy

allow httpd_t etc_t:file { write setattr };
allow httpd_t var_lib_t:dir create;

Then install it inside selinux

semodule -i drupaltmp.pp

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.