Ghost update failed : 2.36 to 3.0 (rollback blocked)

Hi Guys,

I’ve tried to update my ghost blog 2.36.0 to the last release (3.0) but it failed furthermore ghost-cli seems to be unable to rollback :thinking:

  • Any idea of what’s happened ?
  • How to roll back to 2.36.0 and try to update again ?

Thank you in advance for your help !

OS: Ubuntu, v18.04
Node Version: v10.17.0
Ghost-CLI Version: 1.12.0
Database : Sqlite3

PROCESS
1/ Backup Ghost
cp -r content /back/content

2/ Upgrade Ghost-Cli
sudo npm install -g ghost-cli@latest
ghost-cli@1.12.0

3/Upgrade Ghost

✔ Checking system Node.js version
✔ Ensuring user is not logged in as ghost user
✔ Checking if logged in user is directory owner
✔ Checking current folder permissions
✔ Checking folder permissions
✔ Checking file permissions
✔ Checking content folder ownership
✔ Checking memory availability
✔ Checking for available migrations
✔ Checking for latest Ghost version
✔ Downloading and updating Ghost to v3.0.0


Checking theme compatibility for Ghost 3.0.0

✔ Your theme is compatible.

You can also check theme compatibility at https://gscan.ghost.org

? Are you sure you want to proceed with migrating to Ghost 3.0.0? Yes
✔ Updating to a major version
+ sudo systemctl is-active ghost_popfr
+ sudo systemctl stop ghost_popfr
✔ Stopping Ghost
✔ Linking latest Ghost and recording versions
+ sudo systemctl is-active ghost_popfr
☱ Stopping Ghost✔ 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_popfr
✔ Validating config
✔ Checking folder permissions
✔ Checking file permissions
✔ Checking content folder ownership
+ sudo systemctl start ghost_popfr
☱ Restarting Ghost+ sudo systemctl stop ghost_popfr
✖ Restarting Ghost
A GhostError occurred.

Message: Unexpected end of JSON input
Suggestion: journalctl -u ghost_popfr -n 50

Debug Information:
    OS: Ubuntu, v18.04
    Node Version: v10.17.0
    Ghost-CLI Version: 1.12.0
    Environment: production
    Command: 'ghost update'

Additional log info available in: /home/ghost/.ghost/logs/ghost-cli-debug-2019-10-26T08_57_07_417Z.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.

4/RollBack Ghost

? Unable to upgrade Ghost from v2.36.0 to v3.0.0. Would you like to revert back to v2.36.0? Yes
+ sudo systemctl is-active ghost_popfr
+ sudo systemctl reset-failed ghost_popfr
✔ Checking system Node.js version
✔ Ensuring user is not logged in as ghost user
✔ Checking if logged in user is directory owner
✔ Checking current folder permissions
✔ Checking folder permissions
✔ Checking file permissions
✔ Checking content folder ownership
✔ Checking for available migrations
✔ Checking for latest Ghost version
ℹ Downloading and updating Ghost [skipped]
+ sudo /var/www/pop/current/node_modules/.bin/knex-migrator-rollback --force --v 2.36.0 --mgpath /var/www/pop/current
✖ Rolling back database migrations
A GhostError occurred.

Message: It's not possible to roll back database changes from 3.0.0 to 2.36.0. Please restore from a backup instead

Debug Information:
    OS: Ubuntu, v18.04
    Node Version: v10.17.0
    Ghost-CLI Version: 1.12.0
    Environment: production
    Command: 'ghost update'

Additional log info available in: /home/ghost/.ghost/logs/ghost-cli-debug-2019-10-26T08_57_45_829Z.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.

5/Check logs

cat /home/ghost/.ghost/logs/ghost-cli-debug-2019-10-26T08_57_45_829Z.log
Debug Information:
    OS: Ubuntu, v18.04
    Node Version: v10.17.0
    Ghost-CLI Version: 1.12.0
    Environment: production
    Command: 'ghost update'
Message: It's not possible to roll back database changes from 3.0.0 to 2.36.0. Please restore from a backup instead
Stack: Error: It's not possible to roll back database changes from 3.0.0 to 2.36.0. Please restore from a backup instead
    at /usr/lib/node_modules/ghost-cli/lib/tasks/migrator.js:41:21
    at process._tickCallback (internal/process/next_tick.js:68:7)
 ~journalctl -u -n 50
Oct 26 11:40:49 popmv node[3036]: [2019-10-26 09:40:49] WARN Retrying...
Oct 26 11:40:49 popmv node[3036]: [2019-10-26 09:40:49] WARN Can't connect to the bootstrap socket (localhost 8000) ECONNREFUSED
Oct 26 11:40:49 popmv node[3036]: [2019-10-26 09:40:49] WARN Tries: 2
Oct 26 11:40:49 popmv node[3036]: [2019-10-26 09:40:49] WARN Retrying...
Oct 26 11:40:49 popmv node[3036]: [2019-10-26 09:40:49] WARN Can't connect to the bootstrap socket (localhost 8000) ECONNREFUSED
Oct 26 11:40:49 popmv node[3036]: [2019-10-26 09:40:49] ERROR select distinct `posts_meta`.* from `posts_meta` where `posts_meta`.`post_id` in ('5d1251302144500b40
Oct 26 11:40:49 popmv node[3036]: 251302144500b407b7cee', '5d1251302144500b407b7cef', '5d1251302144500b407b7cf0', '5d1251302144500b407b7cf1', '5d1251302144500b407b
Oct 26 11:40:49 popmv node[3036]: b407b83c9', '5d1251302144500b407b83ca', '5d1251302144500b407b83cb', '5d1251302144500b407b83cc', '5d1251302144500b407b83cd', '5d12
Oct 26 11:40:49 popmv node[3036]: 
Oct 26 11:40:49 popmv node[3036]: select distinct `posts_meta`.* from `posts_meta` where `posts_meta`.`post_id` in ('5d1251302144500b407b7617', '5d1251302144500b40
Oct 26 11:40:49 popmv node[3036]: 2144500b407b7cef', '5d1251302144500b407b7cf0', '5d1251302144500b407b7cf1', '5d1251302144500b407b7cf2', '5d1251302144500b407b7cf3'
Oct 26 11:40:49 popmv node[3036]: 83ca', '5d1251302144500b407b83cb', '5d1251302144500b407b83cc', '5d1251302144500b407b83cd', '5d1251302144500b407b83ce', '5d1251302
Oct 26 11:40:49 popmv node[3036]: {"config":{"transaction":true},"name":"11-update-posts-html.js"}
Oct 26 11:40:49 popmv node[3036]: "Error occurred while executing the following migration: 11-update-posts-html.js"
Oct 26 11:40:49 popmv node[3036]: Error ID:
Oct 26 11:40:49 popmv node[3036]:     300
Oct 26 11:40:49 popmv node[3036]: Error Code: 
Oct 26 11:40:49 popmv node[3036]:     SQLITE_ERROR
Oct 26 11:40:49 popmv node[3036]: ----------------------------------------
Oct 26 11:40:49 popmv node[3036]: MigrationScriptError: select distinct `posts_meta`.* from `posts_meta` where `posts_meta`.`post_id` in ('5d1251302144500b407b7617
Oct 26 11:40:49 popmv node[3036]: 0b407b7cee', '5d1251302144500b407b7cef', '5d1251302144500b407b7cf0', '5d1251302144500b407b7cf1', '5d1251302144500b407b7cf2', '5d1
Oct 26 11:40:49 popmv node[3036]:  '5d1251302144500b407b83ca', '5d1251302144500b407b83cb', '5d1251302144500b407b83cc', '5d1251302144500b407b83cd', '5d1251302144500
lines 1-23...skipping...

Hi,

I did a rollback (without ghost-cli) to Ghost 2.37.0 !
I will deploy a fresh instance (3.0) and import my JSON file through the admin panel.:crossed_fingers: .

FYI Rollbacks are deliberately blocked across the major version divide because some of the migrations from 2.x -> 3.0 change data in ways that can’t be reverted back, so you would potentially lose data.

Our standard advice when an upgrade fails is always to try again with ghost upgrade --force.

Can you share the log from the original error, rather than from the (expected) rollback failure?

1 Like

Hi,

@Rollbacks : I wasn’t aware of this behavior, thank for this advice ! :slightly_smiling_face:

Of course :

cat /home/ghost/.ghost/logs/ghost-cli-debug-2019-10-26T08_57_07_417Z.log
Debug Information:
    OS: Ubuntu, v18.04
    Node Version: v10.17.0
    Ghost-CLI Version: 1.12.0
    Environment: production
    Command: 'ghost update'
Message: Unexpected end of JSON input
Suggestion: journalctl -u ghost_popfr -n 50
Stack: Error: Unexpected end of JSON input
    at Server.server.close (/usr/lib/node_modules/ghost-cli/lib/utils/port-polling.js:38:28)
    at Object.onceWrapper (events.js:286:20)
    at Server.emit (events.js:198:13)
    at emitCloseNT (net.js:1619:8)
    at process._tickCallback (internal/process/next_tick.js:63:19)

I have the same problem to upgrade from 2.37 to 3.0.2

    Debug Information:
    OS: Ubuntu, v16.04
    Node Version: v10.17.0
    Ghost-CLI Version: 1.12.0
    Environment: production
    Command: 'ghost start'
Message: Unexpected end of JSON input
Suggestion: journalctl -u ghost_linuxio-ru -n 50
Stack: Error: Unexpected end of JSON input
    at Server.server.close (/usr/lib/node_modules/ghost-cli/lib/utils/port-polling.js:38:28)
    at Object.onceWrapper (events.js:286:20)
    at Server.emit (events.js:198:13)
    at emitCloseNT (net.js:1619:8)
    at process._tickCallback (internal/process/next_tick.js:63:19)

Hi,

After few weeks I’ve decided to retry an upgrade trought “Ghost-Cli” and it works smoothly ! (2.37 to 3.0.3)

Thx :slightly_smiling_face:

sudo npm install -g ghost-cli@latest
+ ghost-cli@1.13.1