Not sure if hit a bug or just some cosmic random happening :)


#1

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

#2

What does ghost doctor output? I think it should fail :thinking:

The only folder that needs to be owned by the ghost user is the content folder (because of write access requirements)


#3

Not sure if this apply in your case. Via the ghost cli, the command doctor showed me once that I should do:

find ./ -type d -exec chmod 775 {} \;
find ./ ! -path "./versions/*" -type f -exec chmod 664 {} \;

#4

@vikaspotluri123: here’s the output of the ghost doctor command:

ghost doctor
✔ Checking system Node.js version
✔ Checking logged in user
✔ Ensuring user is not logged in as ghost user
✔ Checking if logged in user is directory owner
✔ Checking current folder permissions
✔ Checking operating system compatibility
Running sudo command: systemctl is-active ghost_www-domain-com
ℹ Validating config [skipped]
✔ Checking folder permissions
✔ Checking file permissions
✔ Checking content folder ownership
✔ Checking memory availability
ubuntu@ip-172-31-22-96:/srv/www/domain.com$ ls -lsa
total 28
4 drwxr-xr-x  5 ubuntu ubuntu 4096 Aug  1 23:00 .
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 Aug  1 23:00 current -> /srv/www/domain.com/versions/1.25.3
4 -rw-rw-r--  1 ubuntu ubuntu  150 Aug  1 23:00 .ghost-cli
4 drwxrwxr-x  3 ghost  ghost  4096 Jul  7 10:08 system
4 drwxrwxr-x  7 ubuntu ubuntu 4096 Aug  1 23:00 versions

So clearly something fishy as now I notice the ghost user is also owner of the system folder as well as the config file… Yet ghost doctor doesn’t fail.

@pascalandy: is not a folder/file permission type of thing, but rather a user permission messup.


#5

There error I share was a warning the ghost cli gave to my particular setup. I was just sharing an idea from a previous experience.


#6

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.