Ghost does not start after upgrade from 3 to 4

Hi all,

I was running ghost on a digital ocean droplet and updated from v3 to v4. As soon as the update was done I started getting 502 and 503 errors. ghost run worked but ghost start did not.

There are other threads mentioning such errors but none seem to stem from the issue I have:
Ghost seems to be looping indefinitely, looking at the logs it seems that there is an issue with port 2368 somehow being already used (I am not running multiple installs of Ghost as far as I know)
I have found mentions of such an error sporadically from 2017 to 2019 but cannot for the life of me find a working solution today. I have tried to force update ghost time and time again, as well as changing the port to 2369 in the config (which broke Ghost run). Nothing has worked until now.

The Droplet is running Ubuntu 18.04.6 LTS (GNU/Linux 4.15.0-158-generic x86_64)

node -v:

v14.17.6

Ghost version:

Ghost-CLI version: 1.17.3
Ghost version: 4.15.0 (at /var/www/ghost)

Ghost ls:

+ sudo systemctl is-active ghost_random-airship-io
┌───────────────────┬────────────────┬─────────┬──────────────────────┬───────────────────────────┬──────┬─────────────────┐
│ Name              │ Location       │ Version │ Status               │ URL                       │ Port │ Process Manager │
├───────────────────┼────────────────┼─────────┼──────────────────────┼───────────────────────────┼──────┼─────────────────┤
│ random-airship-io │ /var/www/ghost │ 4.15.0  │ running (production) │ https://random-airship.io │ 2368 │ systemd         │
└───────────────────┴────────────────┴─────────┴──────────────────────┴───────────────────────────┴──────┴─────────────────┘

Ghost doctor:

✔ Checking system Node.js version - found v14.17.6
✔ 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
✔ Checking for a MySQL installation
+ sudo systemctl is-active ghost_random-airship-io
Instance is currently running
ℹ Validating config [skipped]
✔ 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 v14.17.6

Ghost log:

+ sudo systemctl is-active ghost_random-airship-io
[2021-09-23 08:40:13] WARN Your site is now offline
[2021-09-23 08:40:13] WARN Ghost was running for a few seconds
[2021-09-23 08:40:15] INFO Ghost is running in production...
[2021-09-23 08:40:15] INFO Your site is now available on https://random-airship.io/
[2021-09-23 08:40:15] INFO Ctrl+C to shut down
[2021-09-23 08:40:15] INFO Ghost server started in 0.624s
[2021-09-23 08:40:15] INFO Database is in a ready state.
[2021-09-23 08:40:15] INFO Ghost database ready in 1.084s
[2021-09-23 08:40:19] INFO Ghost booted in 4.709s
[2021-09-23 08:40:19] INFO Adding offloaded job to the queue
[2021-09-23 08:40:19] INFO Scheduling job update-check at 9 21 7 * * *. Next run on: Fri Sep 24 2021 07:21:09 GMT+0000 (Coordinated Universal Time)
[2021-09-23 08:40:20] WARN Ghost is shutting down
[2021-09-23 08:40:20] WARN Ghost has shut down
[2021-09-23 08:40:20] WARN Your site is now offline
[2021-09-23 08:40:20] WARN Ghost was running for a few seconds
[2021-09-23 08:40:22] INFO Ghost is running in production...
[2021-09-23 08:40:22] INFO Your site is now available on https://random-airship.io/
[2021-09-23 08:40:22] INFO Ctrl+C to shut down
[2021-09-23 08:40:22] INFO Ghost server started in 0.637s
[2021-09-23 08:40:23] INFO Database is in a ready state.

Ghost log --error:

ERROR

NAME: InternalServerError
MESSAGE: (EADDRINUSE) Cannot start Ghost.

level: normal

"Port 2368 is already in use by another program."
"Is another Ghost instance already running?"
InternalServerError: (EADDRINUSE) Cannot start Ghost.
    at Server.<anonymous> (/var/www/ghost/versions/4.15.0/core/server/ghost-server.js:110:34)
    at Server.emit (events.js:400:28)
    at emitErrorNT (net.js:1347:8)
    at processTicksAndRejections (internal/process/task_queues.js:82:21)

Has anyone had to deal with this issue recently? How have you been able to solve this?

Thank you!

@Cyril Did you update to the latest minor version of v3 (which was v3.42.5 up until a security update was released six hours ago) prior to updating to the new major version of Ghost v4?

See here in the Ghost docs. I’m not sure if this is the cause of the issues you’re having or not, but it’s a good place to start looking.

Hi Donald,
Thanks for your answer, yes I did update to the latest v3 before going for v4 (I followed the docs for updating and upgrading)

I was having similar problems with the upgrade so I’ve wrote article describing all steps and problems which I faced:

How to Upgrade from Ghost 3 to 4 on Digital Ocean

My problems were related to:

  • Node
  • MySQL

I ended up saving my blog, scrapping the droplet, spinning a new one up with a fresh install of ghost and reuploading my blog. Took me 15 minutes instead of hours on end :slight_smile: