Yet another "Could not communicate with Ghost" error, fresh install, first time

Newbie here. Installed Ghost using CLI on an AWS EC2 instance, trying to start it for the first time. But ghost start simply times out and gives the following “Could not communicate with Ghost” error. Not using Elastic IP or anything. MySQL is on a remote host.

  • GhostCLI 1.25.3, Ghost 5.71.1
  • What errors or information do you see in the console?
    When I run ghost start:
ghostbloguser@ip-172-31-0-81:/var/www/blog.knravish.me$ ghost start -V

Love open source? We’re hiring JavaScript Engineers to work on Ghost full-time.
https://careers.ghost.org


+ sudo systemctl is-active ghost_blog-knravish-me
Using https on all URLs is highly recommended. In production, SSL is required when using Stripe.
Support for non-https admin URLs in production mode is deprecated and will be removed in a future version.
[19:31:13] Checking system Node.js version [started]
[19:31:13] Checking system Node.js version - found v18.18.2 [title changed]
[19:31:13] Checking system Node.js version - found v18.18.2 [completed]
[19:31:13] Ensuring user is not logged in as ghost user [started]
[19:31:13] Ensuring user is not logged in as ghost user [completed]
[19:31:13] Checking if logged in user is directory owner [started]
[19:31:13] Checking if logged in user is directory owner [completed]
[19:31:13] Checking current folder permissions [started]
[19:31:13] Checking current folder permissions [completed]
[19:31:13] Validating config [started]
+ sudo systemctl is-active ghost_blog-knravish-me
[19:31:13] Validating config [completed]
[19:31:13] Checking folder permissions [started]
[19:31:14] Checking folder permissions [completed]
[19:31:14] Checking file permissions [started]
[19:31:14] Checking file permissions [completed]
[19:31:14] Checking content folder ownership [started]
[19:31:14] Checking content folder ownership [completed]
[19:31:14] Checking memory availability [started]
[19:31:14] Checking memory availability [completed]
[19:31:14] Checking binary dependencies [started]
[19:31:14] Checking binary dependencies [completed]
[19:31:14] Checking systemd unit file [started]
[19:31:14] Checking systemd unit file [completed]
[19:31:14] Checking systemd node version [started]
[19:31:14] Checking systemd node version - found v18.18.2 [title changed]
[19:31:14] Checking systemd node version - found v18.18.2 [completed]
+ sudo systemctl start ghost_blog-knravish-me
[19:31:14] Checking systemd node version - found v18.18.2 [completed]
+ sudo systemctl start ghost_blog-knravish-me
+ sudo systemctl stop ghost_blog-knravish-me
✖ Starting Ghost: blog-knravish-me
A GhostError occurred.

Message: Could not communicate with Ghost
Suggestion: journalctl -u ghost_blog-knravish-me -n 50
Stack: Error: Could not communicate with Ghost
    at Server.<anonymous> (/home/ghostbloguser/.nvm/versions/node/v18.18.2/lib/node_modules/ghost-cli/lib/utils/port-polling.js:91:11)
    at Object.onceWrapper (node:events:631:28)
    at Server.emit (node:events:517:28)
    at emitCloseNT (node:net:2221:8)
    at process.processTicksAndRejections (node:internal/process/task_queues:81:21)


Debug Information:
    OS: Ubuntu, v22.04.3 LTS
    Node Version: v18.18.2
    Ghost Version: 5.71.1
    Ghost-CLI Version: 1.25.3
    Environment: production
    Command: 'ghost start -V'

Additional log info available in: /home/ghostbloguser/.ghost/logs/ghost-cli-debug-2023-11-04T19_36_14_403Z.log

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

You can always refer to https://ghost.org/docs/ghost-cli/ for troubleshooting.

cat /home/ghostbloguser/.ghost/logs/ghost-cli-debug-2023-11-04T19_36_14_403Z.log gives:

Debug Information:
    OS: Ubuntu, v22.04.3 LTS
    Node Version: v18.18.2
    Ghost Version: 5.71.1
    Ghost-CLI Version: 1.25.3
    Environment: production
    Command: 'ghost start -V'
Message: Could not communicate with Ghost
Suggestion: journalctl -u ghost_blog-knravish-me -n 50
Stack: Error: Could not communicate with Ghost
    at Server.<anonymous> (/home/ghostbloguser/.nvm/versions/node/v18.18.2/lib/node_modules/ghost-cli/lib/utils/port-polling.js:91:11)
    at Object.onceWrapper (node:events:631:28)
    at Server.emit (node:events:517:28)
    at emitCloseNT (node:net:2221:8)
    at process.processTicksAndRejections (node:internal/process/task_queues:81:21)

journalctl -u ghost_blog-knravish-me -n 50 gives:

Hint: You are currently not seeing messages from other users and the system.
      Users in groups 'adm', 'systemd-journal' can see all messages.
      Pass -q to turn off this notice.
-- No entries --

ghost doctor gives:

✔ Checking system Node.js version - found v18.18.2
✔ 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 system compatibility
+ sudo systemctl is-active ghost_blog-knravish-me
+ sudo systemctl reset-failed ghost_blog-knravish-me
✔ Validating config
✔ Checking folder permissions
✔ Checking file permissions
✔ Checking content folder ownership
✔ Checking memory availability
✔ Checking binary dependencies
✔ Checking free space
✔ Checking systemd unit file
✔ Checking systemd node version - found v18.18.2

I’ve gone through many similar posts on both this forum and GitHub Issues. Some had other issues, many have gone stale. Would really appreciate any help.

Have you got a firewall on that might be giving you trouble? Ghost does need to ‘talk to itself’ to boot up.

If you can run ghost run -D, that’ll get you more debugging information, hopefully with something actionable.

1 Like

No firewall in use, ufw is disabled.

For some reason, ghost run fails, giving me:

+ sudo node current/index.js
Sorry, user ghostbloguser is not allowed to execute '/home/ghostbloguser/.nvm/versions/node/v18.18.2/bin/node current/index.js' as ghost on ip-172-31-0-81.us-west-1.compute.internal.

This is older, but I think it might have your answer?

1 Like

Not it, unfortunately. sudo -u ghost /usr/bin/whoami works normally, and even after I gave user ghostbloguser sudo permissions for user ghost, the error persists for ghost run, which is baffling me.

Eventually managed to resolve it, and I’m dumb lol :upside_down_face:

There were many problems but eventually it boiled down to the MySQL remote host’s SSL configuration.

For anyone in the future stumbling upon this, it’s the database SSL section of this page of the docs: Configuration - Adapt your publication to suit your needs

Thanks @Cathy_Sarisky for your help!

2 Likes

A post was split to a new topic: Unable to open database file