Score:1

Drush can't write to /tmp

eg flag

Drush does not seem to be able to move files to the tmp folder on my local machine. Changing the tmp folder location to for instance "sites/default/files" works, but I would like to know why it doesn't work with /tmp.

I am using this script from the fontawesome module:

$this->fileSystem->move($path . '/fontawesome-free-' . $fontawesome_library['version'] . '-web', $this->fileSystem->getTempDirectory() . '/temp_fontawesome', FileSystemInterface::EXISTS_REPLACE);

and I get the error

The specified file '/home/username/websites/frilaering_newest/web/libraries/fontawesome/fontawesome-free-6.1.0-web' could not be moved to '/tmp/temp_fontawesome'.

The weird thing is that everything else seems to work - including file uploads, which uses the tmp folder - so can this be related to Drush somehow? I'm using Drush installed on the local website with composer. Everything looks fine in Drush status.

  • www-data can write to /tmp
  • /tmp is chmodded to 777
  • .htaccess file is present in /tmp folder
  • settings.local.php has "$settings["file_temp_path"] = '/tmp';"

I have tried anything - even fiddling with PrivateTmp, but the only thing that works is changing the tmp folder, which I would rather avoid.

I am using Drupal 9 with php7.3-fpm/apache2/mariaDB on latest Ubuntu

Any ideas?

4uk4 avatar
cn flag
You say that `www-data` can write to /tmp. This does matter for the web server, but not for Drush. The question is whether the user who has logged into the command line can write to /tmp.
id flag
What is the ownership and permissions on `/tmp/temp_fontawesome`? Which user is executing Drush?
4uk4 avatar
cn flag
Yes, also the sub directories.
eg flag
the user who is using drush is my local user. I have permissions to write to /tmp as far as I can see. the folder "temp_fontawesome" is never created because drush can't write to /tmp
Joehoe avatar
tr flag
could be typo related. Have you tried `../tmp` instead of `/tmp`? As an example I refer to my tmp folder like this `$settings['file_temp_path'] = '../tmp';`
eg flag
thanks, but not a typo sadly. Also this seems to only affect drush. The site handles images and files without problems, and those go through /tmp too. This only happens when using drush.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.