Tried to update Ghost today and one of the 5 sites I have (latest one installed with a big and possibly buggy migration from blogger to wordpress to ghost) failed due to permission errors:
✖ Downloading and updating Ghost to v1.25.3
An error occurred.
Message: 'EACCES: permission denied, mkdir '/srv/www/domain.com/versions/1.25.3''
Debug Information:
OS: Ubuntu, v16.04
Node Version: v6.14.3
Ghost-CLI Version: 1.8.1
Environment: production
Command: 'ghost update'
More info from the log:
Stack: Error: EACCES: permission denied, mkdir '/srv/www/domain.com/versions/1.25.3'
at Error (native)
at Object.fs.mkdirSync (fs.js:932:18)
at Object.mkdirsSync (/usr/lib/node_modules/ghost-cli/node_modules/fs-extra/lib/mkdirs/mkdirs-sync.js:31:9)
at download.then (/usr/lib/node_modules/ghost-cli/lib/tasks/yarn-install.js:51:16)
at process._tickCallback (internal/process/next_tick.js:109:7)
Code: EACCES
Path: /srv/www/domain.com/versions/1.25.3
The culprit:
ls -lsa versions/
total 28
4 drwxrwxr-x 7 ghost ghost 4096 Jul 28 19:03 .
4 drwxr-xr-x 5 ubuntu ubuntu 4096 Jul 28 19:03 ..
4 drwxrwxr-x 5 ubuntu ubuntu 4096 Jul 7 10:06 1.24.7
4 drwxrwxr-x 5 ubuntu ubuntu 4096 Jul 11 07:14 1.24.8
4 drwxrwxr-x 5 ubuntu ubuntu 4096 Jul 18 16:19 1.24.9
4 drwxrwxr-x 5 ubuntu ubuntu 4096 Jul 24 17:34 1.25.0
4 drwxrwxr-x 5 ghost ghost 4096 Jul 28 19:03 1.25.2
The ghost user was owner of the versions folder, but within the versions folder it was only owner of the latest version, which was updated a few days ago across all 5 sites without any issues. Obviously the update failed to mkdir because of versions folder ownership but no idea how that folder ended up under ghost user ownership…
ls -lsa
total 28
4 drwxr-xr-x 5 ubuntu ubuntu 4096 Jul 28 19:03 .
4 drwxr-xr-x 33 nginx nginx 4096 Jul 9 16:16 ..
4 -rw-rw-r-- 1 ghost ghost 881 Jul 16 14:39 config.production.json
4 drwxrwxr-x 8 ghost ghost 4096 Jul 7 10:06 content
0 lrwxrwxrwx 1 ubuntu ubuntu 39 Jul 28 19:03 current -> /srv/www/codruvrabie.eu/versions/1.25.2
4 -rw-rw-r-- 1 ubuntu ubuntu 150 Aug 1 22:59 .ghost-cli
4 drwxrwxr-x 3 ghost ghost 4096 Jul 7 10:08 system
4 drwxrwxr-x 7 ghost ghost 4096 Jul 28 19:03 versions
However, the site didn’t run into such an error in the past at least 2 updates… so clearly the last 1.25.2 Jul 28 update messed up something.
If you’re looking for some help, it’s important to provide as much context as possible so that people are able to assist you. Try to always mention:
- What’s your URL? This is the easiest way for others to debug your issue n/a
- What version of Ghost are you using? latest / 1.25.3
- What configuration? aws ec2 nginx + rds
- What browser? n/a
- What errors or information do you see in the console? ‘EACCES: permission denied, mkdir ‘/srv/www/domain.com/versions/1.25.3’’
- What steps could someone else take to reproduce the issue you’re having? no clue really it was totally random and unexpected