question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItΒ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Ghost Error (Communication) / File Permission Error

See original GitHub issue

Summary

It appears my ghost cli is unable to access the log files to write logs, so it is throwing an error when i start up.

Steps to Reproduce

  1. Follow local install steps here
    • My install was working for a short period of time like this, but it was in the dev environment, so I did the following in an attempt to get a prod environment
  2. ghost setup
  3. Follow the promts.
  4. Run the different commands to see the output (pasted below).

Log file

The issue is that I can’t get access to my log files. ghost ls:

james@jamesdev:/var/www/ghost$ ghost ls
+ sudo systemctl is-active ghost_blog-jaims-dev
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Name           β”‚ Location       β”‚ Version β”‚ Status  β”‚ URL β”‚ Port β”‚ Process Manager β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ blog-jaims-dev β”‚ /var/www/ghost β”‚ 3.31.3  β”‚ stopped β”‚ n/a β”‚ n/a  β”‚ n/a             β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
james@jamesdev:/var/www/ghost$

ghost run:

james@jamesdev:/var/www/ghost$ ghost run
The `ghost run` command is used by the configured Ghost process manager and for debugging. If you're not running this to debug something, you should run `ghost start` instead.
+ sudo node current/index.js
events.js:292
      throw er; // Unhandled 'error' event
      ^

Error: EACCES: permission denied, open '/var/www/ghost/versions/3.31.3/content/logs/https___blog_jaims_dev_production.error.log'
Emitted 'error' event on Logger instance at:
    at WriteStream.onStreamError (/var/www/ghost/versions/3.31.3/node_modules/ghost-ignition/node_modules/bunyan/lib/bunyan.js:627:18)
    at WriteStream.emit (events.js:315:20)
    at internal/fs/streams.js:361:12
    at FSReqCallback.oncomplete (fs.js:156:23) {
  errno: -13,
  code: 'EACCES',
  syscall: 'open',
  path: '/var/www/ghost/versions/3.31.3/content/logs/https___blog_jaims_dev_production.error.log'
}
james@jamesdev:/var/www/ghost$

ghost start:

james@jamesdev:/var/www/ghost$ ghost start
+ sudo systemctl is-active ghost_blog-jaims-dev
βœ” Ensuring user is not logged in as ghost user
βœ” Checking if logged in user is directory owner
βœ” Checking current folder permissions
+ sudo systemctl is-active ghost_blog-jaims-dev
βœ” Validating config
βœ” Checking folder permissions
βœ” Checking file permissions
βœ” Checking content folder ownership
βœ” Checking memory availability
βœ” Checking binary dependencies
+ sudo systemctl start ghost_blog-jaims-dev
+ sudo systemctl stop ghost_blog-jaims-dev
βœ– Starting Ghost: blog-jaims-dev
A GhostError occurred.

Message: Could not communicate with Ghost
Suggestion: journalctl -u ghost_blog-jaims-dev -n 50

Debug Information:
    OS: Ubuntu, v20.04.1 LTS
    Node Version: v12.18.3
    Ghost Version: 3.31.3
    Ghost-CLI Version: 1.14.1
    Environment: production
    Command: 'ghost start'

Additional log info available in: /home/james/.ghost/logs/ghost-cli-debug-2020-08-31T16_54_37_656Z.log

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

You can always refer to https://ghost.org/docs/api/ghost-cli/ for troubleshooting.
james@jamesdev:/var/www/ghost$

journalctl -u ghost_blog-jaims-dev -n 50:

james@jamesdev:/var/www/ghost$ sudo journalctl -u ghost_blog-jaims-dev -n 50
-- Logs begin at Sat 2020-07-04 03:34:27 UTC, end at Mon 2020-08-31 16:55:43 UTC. --
Aug 31 16:54:32 jamesdev node[315350]: Emitted 'error' event on Logger instance at:
Aug 31 16:54:32 jamesdev node[315350]:     at WriteStream.onStreamError (/var/www/ghost/versions/3.31.3/node_modules/ghost-ignition/node_modules/bunyan/lib/bunyan.js:627:18)
Aug 31 16:54:32 jamesdev node[315350]:     at WriteStream.emit (events.js:315:20)
Aug 31 16:54:32 jamesdev node[315350]:     at internal/fs/streams.js:361:12
Aug 31 16:54:32 jamesdev node[315350]:     at FSReqCallback.oncomplete (fs.js:156:23) {
Aug 31 16:54:32 jamesdev node[315350]:   errno: -13,
Aug 31 16:54:32 jamesdev node[315350]:   code: 'EACCES',
Aug 31 16:54:32 jamesdev node[315350]:   syscall: 'open',
Aug 31 16:54:32 jamesdev node[315350]:   path: '/var/www/ghost/versions/3.31.3/content/logs/https___blog_jaims_dev_production.error.log'
Aug 31 16:54:32 jamesdev node[315350]: }
Aug 31 16:54:32 jamesdev systemd[1]: ghost_blog-jaims-dev.service: Succeeded.
Aug 31 16:54:32 jamesdev systemd[1]: ghost_blog-jaims-dev.service: Scheduled restart job, restart counter is at 121.
Aug 31 16:54:32 jamesdev systemd[1]: Stopped Ghost systemd service for blog: blog-jaims-dev.
Aug 31 16:54:32 jamesdev systemd[1]: Started Ghost systemd service for blog: blog-jaims-dev.
Aug 31 16:54:33 jamesdev node[315361]: - Inspecting operating system
Aug 31 16:54:34 jamesdev node[315385]: events.js:292
Aug 31 16:54:34 jamesdev node[315385]:       throw er; // Unhandled 'error' event
Aug 31 16:54:34 jamesdev node[315385]:       ^
Aug 31 16:54:34 jamesdev node[315385]: Error: EACCES: permission denied, open '/var/www/ghost/versions/3.31.3/content/logs/https___blog_jaims_dev_production.error.log'
Aug 31 16:54:34 jamesdev node[315385]: Emitted 'error' event on Logger instance at:
Aug 31 16:54:34 jamesdev node[315385]:     at WriteStream.onStreamError (/var/www/ghost/versions/3.31.3/node_modules/ghost-ignition/node_modules/bunyan/lib/bunyan.js:627:18)
Aug 31 16:54:34 jamesdev node[315385]:     at WriteStream.emit (events.js:315:20)
Aug 31 16:54:34 jamesdev node[315385]:     at internal/fs/streams.js:361:12
Aug 31 16:54:34 jamesdev node[315385]:     at FSReqCallback.oncomplete (fs.js:156:23) {
Aug 31 16:54:34 jamesdev node[315385]:   errno: -13,
Aug 31 16:54:34 jamesdev node[315385]:   code: 'EACCES',
Aug 31 16:54:34 jamesdev node[315385]:   syscall: 'open',
Aug 31 16:54:34 jamesdev node[315385]:   path: '/var/www/ghost/versions/3.31.3/content/logs/https___blog_jaims_dev_production.error.log'
Aug 31 16:54:34 jamesdev node[315385]: }
Aug 31 16:54:35 jamesdev systemd[1]: ghost_blog-jaims-dev.service: Succeeded.
Aug 31 16:54:35 jamesdev systemd[1]: ghost_blog-jaims-dev.service: Scheduled restart job, restart counter is at 122.
Aug 31 16:54:35 jamesdev systemd[1]: Stopped Ghost systemd service for blog: blog-jaims-dev.
Aug 31 16:54:35 jamesdev systemd[1]: Started Ghost systemd service for blog: blog-jaims-dev.
Aug 31 16:54:35 jamesdev node[315396]: - Inspecting operating system
Aug 31 16:54:37 jamesdev node[315420]: events.js:292
Aug 31 16:54:37 jamesdev node[315420]:       throw er; // Unhandled 'error' event
Aug 31 16:54:37 jamesdev node[315420]:       ^
Aug 31 16:54:37 jamesdev node[315420]: Error: EACCES: permission denied, open '/var/www/ghost/versions/3.31.3/content/logs/https___blog_jaims_dev_production.error.log'
Aug 31 16:54:37 jamesdev node[315420]: Emitted 'error' event on Logger instance at:
Aug 31 16:54:37 jamesdev node[315420]:     at WriteStream.onStreamError (/var/www/ghost/versions/3.31.3/node_modules/ghost-ignition/node_modules/bunyan/lib/bunyan.js:627:18)
Aug 31 16:54:37 jamesdev node[315420]:     at WriteStream.emit (events.js:315:20)
Aug 31 16:54:37 jamesdev node[315420]:     at internal/fs/streams.js:361:12
Aug 31 16:54:37 jamesdev node[315420]:     at FSReqCallback.oncomplete (fs.js:156:23) {
Aug 31 16:54:37 jamesdev node[315420]:   errno: -13,
Aug 31 16:54:37 jamesdev node[315420]:   code: 'EACCES',
Aug 31 16:54:37 jamesdev node[315420]:   syscall: 'open',
Aug 31 16:54:37 jamesdev node[315420]:   path: '/var/www/ghost/versions/3.31.3/content/logs/https___blog_jaims_dev_production.error.log'
Aug 31 16:54:37 jamesdev node[315420]: }
Aug 31 16:54:37 jamesdev systemd[1]: ghost_blog-jaims-dev.service: Succeeded.
Aug 31 16:54:37 jamesdev systemd[1]: Stopped Ghost systemd service for blog: blog-jaims-dev.
james@jamesdev:/var/www/ghost$

ghost doctor:

james@jamesdev:/var/www/ghost$ 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
System checks failed with message: 'Linux version is not Ubuntu 16 or 18'
Some features of Ghost-CLI may not work without additional configuration.
For local installs we recommend using `ghost install local` instead.
? Continue anyway? Yes
System stack check skipped
β„Ή Checking operating system compatibility [skipped]
βœ” Checking for a MySQL installation
+ sudo systemctl is-active ghost_blog-jaims-dev
βœ” Validating config
βœ” Checking folder permissions
βœ” Checking file permissions
βœ” Checking content folder ownership
βœ” Checking memory availability
βœ” Checking binary dependencies
james@jamesdev:/var/www/ghost$

Technical details

This is automatically output by Ghost-CLI if an error occurs, please copy & paste:

Debug Information:
    OS: Ubuntu, v20.04.1 LTS
    Node Version: v12.18.3
    Ghost Version: 3.31.3
    Ghost-CLI Version: 1.14.1
    Environment: production
    Command: 'ghost start'

Bug submission checklist

Please fill out this checklist to acknowledge that you followed the requirements to submit a bug report.

  • [βœ”οΈ] Tried to find help in the forum & docs
  • [βœ”οΈ] Checked for existing issues
  • [βœ”οΈ] Attached log file (i attached the logs that are available to me)
  • [βœ”οΈ] Provided technical details incl. operating system

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
vikaspotluri123commented, Sep 10, 2020

@acburdine I think we should add a warning when both dev and prod configs exist - the number of users that should intentionally have both should be low πŸ€”

0reactions
Jaimsscommented, Sep 4, 2020

Ah ok. Thank you for explaining the difference between the prod and dev environments. I was thinking the two would maybe be running concurrently, but it appears that I have to pick one or the other.

I think this resolves my problem. Thanks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Issues - GitHub
Permissions related: "Error trying to access settings files in /opt/bitnami/ghost/versions/4.9.4/content/settings/." #115.
Read more >
Ghost start results in could not communicate with ghost error
When I run ghost start , it hangs for a couple of minutes and then outputs a message about not being able to...
Read more >
How to fix permission denied in Ghost packaged by Bitnami
Learn how to fix the "Cannot upload image" error in your Ghost blog packaged by Bitnami in a few seconds with this commands...
Read more >
"Permission Denied" error shown in log when Norton Ghost v15
This morning I noticed multiple "Permission Denied" errors in its log for the image deletes. The Ghost service runs as the "SYSTEM" ID...
Read more >
502 Bad Gateway After Ghost Upgrade - DigitalOcean
When trying ghost update --force I get the error Message: 'EACCES: permission denied, rmdir '/var/www/ghost/versions/3.38.1'' Even though IΒ ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found