Before you upgrade to Ghost v5.71.0 (Selfhosted only)

Run ghost update —force when finished.

Did. Now I have this error in the console:
Message: Ghost was able to start, but errored during boot with: connect ECONNREFUSED ::1:3306
Apparently the new Node 18 breaks something.

What is your website?

Actually in August I migrated my server. At that point I installed v18.

Anyway, here is the guide by @Hannah

Replace 10 with 18

Did you ran

sudo npm install -g ghost-cli@latest

after updating Nodejs and update Ghost?

Yes, I first updated Node, then panicked and also updated Ghost itself. Now everything works. I solved by removing the line that starts with ::1 in etc/hosts. I found the solution on Stack Overflow:

localhost is translated to ::1 (IP6) instead of 127.0.0.1 (IP4). The error occurs because your database is listening on localhost and you try to connect to 127.0.0.1 or the database is listening on 127.0.0.1 and you try to connect to localhost.

The line I removed in hosts is the following:

::1 localhost ip6-localhost ip6-loopback

Now I have the shiny new Ghost, even if I didn’t really want to upgrade also that, but just the Node :stuck_out_tongue:

1 Like

Have a look here:

1 Like

Did you delete the entire line?

Yep. Also here: Ghost Update: ECONNREFUSED ::1:3306 + Error code 502 - #2 by markstos

Yes. The moment I removed it and saved, Ghost started working. So I guess it was definitely that.

1 Like

Your host is only on ip4. Isn’t it?

This will be helpful to me when I’m updating to v20. :smile:

No, I have also ipv6. My hosts file is now the following:

# Your system has configured 'manage_etc_hosts' as True.
# As a result, if you wish for changes to this file to persist
# then you will need to either
# a.) make changes to the master file in /etc/cloud/templates/hosts.debian.tmpl
# b.) change or remove the value of 'manage_etc_hosts' in
#     /etc/cloud/cloud.cfg or cloud-config from user-data
#
127.0.1.1 ghostonubuntu2204-s-1vcpu-1gb-intel
127.0.0.1 localhost

# The following lines are desirable for IPv6 capable hosts
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

Before was this:

# Your system has configured 'manage_etc_hosts' as True.
# As a result, if you wish for changes to this file to persist
# then you will need to either
# a.) make changes to the master file in /etc/cloud/templates/hosts.debian.tmpl
# b.) change or remove the value of 'manage_etc_hosts' in
# /etc/cloud/cloud.cg or cloud-config from user-data
127.0.1.1 ghostonubuntu2204-5.-1vcpu-1gb-intel
127.0.0.1 localhost

# The following lines are desirable for IPv6 capable hosts

::1 localhost ip6-localhost ip6-loopback 
ff02: :1 jp6-allnodes 
ff02: :2 ip6-allrouters

Should I change something?

This is how mine looks like

127.0.0.1       localhost
127.0.1.1       vmi*******.contaboserver.net    vmi********

# The following lines are desirable for IPv6 capable hosts
::1     localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
109.***.***.***    vmi********.contaboserver.net vmi******

Maybe I should add also the ipv6 addresses of the server in the hosts?

MySQL listens on 127.0.0.1 (localhost IPv4) by default. With node18, node.js doesn’t sort the DNS lookup results from the system, so it’s now resolving localhost to ::1.

If you want to avoid modifying your hosts file, I think you need to configure MySQL to listen on ::1.

Hey. Bro. I’m on v18. How to upgrade to v20 without any issue? (when ghost supports v20)

If you’re using the suggested install guide, here’s the suggested upgrade guide: Supported node versions for self-hosted installs of Ghost

It’s hard to say if there’s any issues you’ll have by upgrading from v18 to v20. The v16-v18 update is the first time I saw a breaking change that affected Ghost. Previously it was a pretty straightforward update.

So it’s better to backup and upgrade. Isn’t it?

That’s always the suggestion when making notable system changes :slight_smile:

1 Like