Ghost not updating from 4.2.2 → 4.3.2

OS: Ubuntu, v20.04.2 LTS
Node Version: v12.22.1
Ghost Version: 4.2.0
Ghost-CLI Version: 1.16.3
Environment: production

I recently tried to update from 4.2.0 to 4.3.2. When I updated, it threw an error, which I resolved by updating my permissions, but then it only updated me to 4.2.2, and seemingly not completely.

Exactly steps I took to update:

$ sudo apt-get update
$ sudo apt-get upgrade
$ <created backup>
$ sudo npm i -g ghost-cli@latest
$ cd <my ghost blog directory>
$ ghost update
<usual update checks passed, omitted for brevity>
✔ Fetched release notes
✔ Downloading and updating Ghost to v4.2.2
✔ Stopping Ghost
✔ Linking latest Ghost and recording versions
✔ Restarting Ghost
✖ Removing old Ghost versions
An error occurred.
Message: 'EACCES: permission denied, unlink '/var/www/<my blog>/blog/versions/3.35.5/Gruntfile.js''

Now ghost --version reports that I’m at 4.2.2 even though it ended with the error in removing the old version. Okay, well I don’t need those old versions, right? So I manually removed it.

$ sudo rm -rf /var/www/<my blog>/versions/3.35.5/

However, running ghost update once again still throws the same error, except now on the currently oldest version (what was previously the second oldest version).

I could just keep deleting old versions… but perhaps there’s a better solution? Any advice would be appreciated.

Thanks :slight_smile:

It seems like the ownership for the versions folder changed :confused:

The CLI only keeps the last few versions (don’t remember the exact number) so every time you run update it will try to remove enough versions to have <= that number

It seems like the ownership for the versions folder changed :confused:

Thanks, I change it to be owned by ghost and the update finished properly. But still, ghost update only updates to 4.2.2, not 4.3.2… is there a way to get it to detect the newer version?

4.2.2 is the latest available version. The 4.3.x versions were deprecated because of a migrations bug.

1 Like

I see, thanks. :slight_smile: