Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EACCES: permission denied, open '/var/www/ghost/config.production.json' when upgrading from #8956

Closed
0xvext opened this issue Aug 31, 2017 · 6 comments

Comments

@0xvext
Copy link

0xvext commented Aug 31, 2017

Was running stably with Ghost 1.6.2, or so I thought.
Node Version: v6.11.2
Ghost-CLI Version: 1.1.1

Took a system snapshot, tried upgrading to 1.8.0 and failed with error below:

✔ Linking latest Ghost and recording versions
Running sudo command: -E -u ghost /usr/lib/node_modules/ghost-cli/node_modules/.bin/knex-migrator-migrate --init --mgpath /var/www/ghost/current
✖ Running database migrations
An error occurred.
Message: 'Command failed: /bin/sh -c sudo -E -u ghost /usr/lib/node_modules/ghost-cli/node_modules/.bin/knex-migrator-migrate --init --mgpath /var/www/ghost/current
[2017-08-31 03:15:55] ERROR

NAME: InternalServerError
MESSAGE: The server has encountered an error.

level:normal

InternalServerError: The server has encountered an error.
    at new KnexMigrateError (/usr/lib/node_modules/ghost-cli/node_modules/knex-migrator/lib/errors.js:7:26)
    at new KnexMigrator (/usr/lib/node_modules/ghost-cli/node_modules/knex-migrator/lib/index.js:28:15)
    at /usr/lib/node_modules/ghost-cli/node_modules/knex-migrator/bin/knex-migrator-migrate:20:28
    at tryCatcher (/usr/lib/node_modules/ghost-cli/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/usr/lib/node_modules/ghost-cli/node_modules/bluebird/js/release/promise.js:512:31)
    at Promise._settlePromise (/usr/lib/node_modules/ghost-cli/node_modules/bluebird/js/release/promise.js:569:18)
    at Promise._settlePromise0 (/usr/lib/node_modules/ghost-cli/node_modules/bluebird/js/release/promise.js:614:10)
    at Promise._settlePromises (/usr/lib/node_modules/ghost-cli/node_modules/bluebird/js/release/promise.js:693:18)
    at Promise._fulfill (/usr/lib/node_modules/ghost-cli/node_modules/bluebird/js/release/promise.js:638:18)
    at Promise._resolveCallback (/usr/lib/node_modules/ghost-cli/node_modules/bluebird/js/release/promise.js:432:57)
    at Promise._settlePromiseFromHandler (/usr/lib/node_modules/ghost-cli/node_modules/bluebird/js/release/promise.js:524:17)
    at Promise._settlePromise (/usr/lib/node_modules/ghost-cli/node_modules/bluebird/js/release/promise.js:569:18)
    at Promise._settlePromise0 (/usr/lib/node_modules/ghost-cli/node_modules/bluebird/js/release/promise.js:614:10)
    at Promise._settlePromises (/usr/lib/node_modules/ghost-cli/node_modules/bluebird/js/release/promise.js:689:18)
    at Async._drainQueue (/usr/lib/node_modules/ghost-cli/node_modules/bluebird/js/release/async.js:133:16)
    at Async._drainQueues (/usr/lib/node_modules/ghost-cli/node_modules/bluebird/js/release/async.js:143:10)

Error: Error parsing your configuration file: [/var/www/ghost/config.production.json]: EACCES: permission denied, open '/var/www/ghost/config.production.json'
    at File.loadSync (/var/www/ghost/versions/1.8.0/node_modules/nconf/lib/nconf/stores/file.js:160:11)
    at Provider.add (/var/www/ghost/versions/1.8.0/node_modules/nconf/lib/nconf/provider.js:137:23)
    at Provider.file (/var/www/ghost/versions/1.8.0/node_modules/nconf/lib/nconf/provider.js:63:15)
    at Object.loadNconf (/var/www/ghost/versions/1.8.0/core/server/config/index.js:34:11)
    at Object.<anonymous> (/var/www/ghost/versions/1.8.0/core/server/config/index.js:78:27)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/var/www/ghost/versions/1.8.0/MigratorConfig.js:1:76)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)


'


Debug Information:
    Node Version: v6.11.2
    Ghost-CLI Version: 1.1.1
    Environment: production
    Command: 'ghost update'

I've reviewed #378 and #281 but have been unable to resolve.

I think there may have been some instability on the system prior that I was unaware of, because I have restored my snapshot and the service will not run even back on 1.6.2. Service log shows a failure on access of the same json file.

I'm having trouble finding documentation to confirm who the owner of '/var/www/ghost/config.production.json should be, but I'm not sure if that is the root issue since I have tried running via sudo and I even tried chown of '/var/www/ghost/config.production.json to ghost:ghost just to see if it would correct the issue.

Apologies if I'm duplicating. Looked through active/closed and didn't find a resolution.

@aileen
Copy link
Member

aileen commented Aug 31, 2017

Hey @0xvext 👋

Sorry to hear that you're having trouble. As this is more likely to be an issue with Ghost-CLI, would you mind re-opening it there?

@aileen aileen closed this as completed Aug 31, 2017
@ErisDS
Copy link
Member

ErisDS commented Aug 31, 2017

P.S. the docs live at docs.ghost.org - there's a Knowledge Base that details file structure and perms, and a troubleshooting guide that mentions this problem - where did you look / search that didn't help you find them?

@0xvext
Copy link
Author

0xvext commented Aug 31, 2017

Looks like my google-fu was weak. I've got some additional homework to do. Thanks for the quick responses.

@0xvext
Copy link
Author

0xvext commented Aug 31, 2017

Looks like it was a permissions issue. No idea how perms got modified on config.production.json, but they were set to rw-rw---- which was preventing access.

Thanks again for the help.

P.S. @ErisDS Great documentation setup. I was searching via Google since I am not used to projects having such effective internal search. The Ghost knowledge base has a really good one though.

@mike-code
Copy link

I have the same issue but permissions are correct.

Message: EACCES: permission denied, open '/var/www/ghost/config.production.json'
Exit code: EACCES


Debug Information:
    OS: Ubuntu, v16.04
    Node Version: v10.15.0
    Ghost-CLI Version: 1.9.9
    Environment: production
    Command: 'ghost start'

Additional log info available in: /home/mike/.ghost/logs/ghost-cli-debug-2019-04-12T10_50_12_944Z.log

Try running ghost doctor to check your system for known issues.

You can always refer to https://docs.ghost.org/api/ghost-cli/ for troubleshooting.
[12:50:12][mike@ringo.do][/var/www/ghost]$ ll
total 16
-rw-rw-r-- 1 ghost ghost  563 Apr 11 11:48 config.production.json

Copy link
Member

@mike-code if you need support with any installation problems please use our forum. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants