Deployment fails with Errno 13 rmtree - it’s always permissions!

I’m running into a permissions problem on deployment:

rmtree failed: [Errno 13] Permission denied:
'/srv/www/ysgoltrewen/releases/20160425202926/web/app/plugins/sitepress-
multilingual-cms/templates/wpml-mail/language-switcher.twig'
fatal: [46.101.72.245]: FAILED! => {"changed": false, "failed": true}

I’ve recursively changed the permissions on /srv/www/ysgoltrewen/releases/ using the commands:

find ./releases -type d -exec chmod 775 {} \;
find ./releases -type f -exec chmod 644 {} \;

Now I get the error message:

rmtree failed: [Errno 13] Permission denied:
'/srv/www/ysgoltrewen/releases/20160411174508/web/app/themes/ysgoltrewen-
wp/dist/assets/img/favicon.png'
fatal: [46.101.72.245]: FAILED! => {"changed": false, "failed": true}

I’ve tried different variations of permissions but still no joy :frowning:

Any pointers? Am I barking up the wrong permissions tree?

1 Like

Strangeness, in that I’ve just checked the symlink on the current directory and it is pointing to the latest release:

current -> /srv/www/ysgoltrewen/releases/20160518175123

I’m confused now, I thought that any failure would halt deployment?!

Depends where the failure happened. Your logs didn’t include the task where it failed so it’s hard to tell.

It happened at end of tasks:


TASK [deploy : Finalize the deploy] ********************************************
System info:
  Ansible 2.0.1.0; Darwin
  Trellis at "Fix #569 - Only skip subdomains for non-www domains"
---------------------------------------------------
rmtree failed: [Errno 13] Permission denied:
'/srv/www/ysgoltrewen/releases/20160411174508/web/app/themes/ysgoltrewen-
wp/dist/assets/img/favicon.png'
fatal: [46.101.72.245]: FAILED! => {"changed": false, "failed": true}
    to retry, use: --limit @deploy.retry

PLAY RECAP *********************************************************************
46.101.72.245              : ok=23   changed=8    unreachable=0    failed=1
localhost                  : ok=0    changed=0    unreachable=0    failed=0

Not sure if that casts any light?! Or is there a log file with more info?

Trellis automatically sets the correct permissions it needs. Did you ever manually change permissions on the remote server at some point (before trying to fix it as you mentioned)?

1 Like

Ahh, that’ll be what it is. I’m uploading some paid for plugins manually. I’ll make sure their permissions are all sorted first before doing a deployment and report back what happens. Thanks for the heads up :slight_smile:

Hi all. I’m getting the same problem at the same task:

TASK [deploy : Finalize the deploy] ********************************************
System info:
  Ansible 2.0.1.0; Darwin
  Trellis at "Fix #569 - Only skip subdomains for non-www domains"
---------------------------------------------------
rmtree failed: [Errno 13] Permission denied:
'/srv/www/wow/releases/20160610210723/web/wp/wp-settings.php'
fatal: [xxx.xxx.xxx.xxx]: FAILED! => {"changed": false, "failed": true}

(IP address blanked out by me)

The permissions are:

-rw-r--r--  1 root root     11048 Jun 10 21:10 wp-settings.php

Isn’t this supposed to be www-data and not root? I wonder how this got changed? Possibly while I was trying to fix a problem with a previous deploy, perhaps.

It seems to be trying to remove an old deploy (20160610210723) - that is about a month ago at time of writing. I take it then that part of the deploy process is to remove old deploys beyond a certain number/timeframe?

I’m going to try fixing it by removing the dir myself.

Apologies for delay, it was uploading plugins manually what done it. I tried altering the permissions before uploading but still getting the error, however, everything works fine.

Error message, it works anyway, I’ll ignore it ≄ perfect solution but hey, time is short :wink: