Unable to upgrade Ghost from v3.0.2 to v3.5.1

I got mysql error about ‘email’ table inexistence

Message: show columns from emails - ER_NO_SUCH_TABLE: Table ‘db_ghost.emails’ doesn’t exist

If i create this table manually and repeat upgrade, i got following error:

Message: backup is not a function
Suggestion: journalctl -u ghost_ghost-somesite-com -n 50
Stack: Error: backup is not a function
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)

any suggestions?

3 Likes

I have the same issue. For me the update goes through as if successful, but on ghost start I get the ‘no_such_table emails’ thing.

1 Like

Similar issue here as well. I’m getting the following:

Message: show columns from emails - ER_NO_SUCH_TABLE: Table ‘ghost_prod.emails’ doesn’t exist
Suggestion: journalctl -u ghost_ericlima-com -n 50

Debug Information:
OS: Ubuntu, v18.04.4 LTS
Node Version: v12.13.0
Ghost Version: 3.5.2
Ghost-CLI Version: 1.13.1
Environment: production
Command: ‘ghost update’

This happens with an update to 3.5.2, too.
Just ran into this issue. And this is my first update of ghost because i am not using it that long time yet.

Message: show columns from emails - ER_NO_SUCH_TABLE: Table ‘ghostcms.emails’ doesn’t exist

Debug Information:
OS: Ubuntu, v18.04.3 LTS
Node Version: v10.18.0
Ghost Version: 3.5.2
Ghost-CLI Version: 1.13.1
Environment: production
Command: ‘ghost start’

EDIT:

I just did a rollback to the old version till this issue is fixed.
Just move to your ghost folder like /var/www/ghost and open your shell:

Backup the old link
cd /var/www/ghost
mv current current_bak

Link to the “old” version. Put your last working version at the end
ln -s /var/www/ghost/current /var/www/ghost/versions/3.2.0

1 Like

Hey :wave: We have diagnozed the issue and it has been fixed on master as of https://github.com/TryGhost/Ghost/commit/25721828d930915349551393d680980bfbaaf54c

The fix will go out with upcoming 3.6.x version so please upgrade to that version when it’s available. If anybody is in critical need to upgrade to latest features they can temporarily modify their source with the referenced above commit :v:

1 Like

That’s good news. Thanks for investigating.

I know it’s hard to commit to a firm date since stuff can always happen in development, but do we have an ETA on 3.6.x as long as we promise not to hold you to it :wink:?

We’re aiming to get it out before the weekend.

2 Likes

Hey all :wave: Ghost 3.6.0 was just released with the fix for this. :partying_face:

Successfully upgraded to 3.6.0. Thanks!

Was just able to update. Awesome!

I cannot upgrade from 3.0.2 to 3.6.0. Error is as follows

[2020-02-15 07:13:21] e[36mINFOe[39m Blog is in maintenance mode.
[2020-02-15 07:13:21] e[36mINFOe[39m Ghost is running in production...
[2020-02-15 07:13:21] e[36mINFOe[39m Your site is now available on https://transang.me/
[2020-02-15 07:13:21] e[36mINFOe[39m Ctrl+C to shut down
[2020-02-15 07:13:21] e[36mINFOe[39m Ghost boot 2.995s
[2020-02-15 07:13:21] e[36mINFOe[39m Creating database backup
[2020-02-15 07:13:21] e[36mINFOe[39m Database backup written to: /var/lib/ghost/content/data/tran-sang-dev-blog.ghost.2020-02-15-07-13-21.json
[2020-02-15 07:13:21] e[36mINFOe[39m Adding posts.send_email_when_published
[2020-02-15 07:13:21] e[36mINFOe[39m Adding posts_meta.email_subject
[2020-02-15 07:13:21] e[36mINFOe[39m Adding permissions fixtures for email_previews
[2020-02-15 07:13:21] e[36mINFOe[39m Adding members.subscribed
[2020-02-15 07:13:21] e[36mINFOe[39m Adding table: emails
[2020-02-15 07:13:21] e[36mINFOe[39m Adding permissions fixtures for email
[2020-02-15 07:13:21] e[36mINFOe[39m Adding members.uuid
[2020-02-15 07:13:22] e[36mINFOe[39m Adding uuid field value to 2 members.
[2020-02-15 07:13:22] e[35mWARNe[39m (0/3) Adding permissions fixtures for email
[2020-02-15 07:13:22] e[35mWARNe[39m Adding emails.error_data
[2020-02-15 07:13:22] e[36mINFOe[39m Adding members_stripe_customers_subscriptions.cancel_at_period_end
[2020-02-15 07:13:22] e[36mINFOe[39m Adding table: labels
[2020-02-15 07:13:22] e[36mINFOe[39m Adding table: members_labels
[2020-02-15 07:13:22] e[36mINFOe[39m Dropping table: members_labels
[2020-02-15 07:13:22] e[36mINFOe[39m Dropping table: labels
[2020-02-15 07:13:22] e[36mINFOe[39m Removing members_stripe_customers_subscriptions.cancel_at_period_end
[2020-02-15 07:13:22] e[36mINFOe[39m Removing emails.error_data
[2020-02-15 07:13:22] e[36mINFOe[39m Removing permissions fixtures for emails
[2020-02-15 07:13:22] e[36mINFOe[39m Removing members.uuid
[2020-02-15 07:13:22] e[36mINFOe[39m Removing permissions fixtures for emails
[2020-02-15 07:13:22] e[36mINFOe[39m Dropping table: emails
[2020-02-15 07:13:22] e[36mINFOe[39m Removing members.subscribed
[2020-02-15 07:13:22] e[31mERRORe[39m Invalid integer: 
e[31m
e[31mInvalid integer: e[39m
e[1me[37mError Code: e[39me[22m
    e[90mparameter_invalid_integere[39m
e[90m----------------------------------------e[39m
e[90mError: Invalid integer: 
    at Function.generate (/var/lib/ghost/versions/3.6.0/node_modules/stripe/lib/Error.js:49:16)
    at IncomingMessage.<anonymous> (/var/lib/ghost/versions/3.6.0/node_modules/stripe/lib/StripeResource.js:168:39)
    at Object.onceWrapper (events.js:427:28)
    at IncomingMessage.emit (events.js:333:22)
    at IncomingMessage.EventEmitter.emit (domain.js:482:12)
    at endReadableNT (_stream_readable.js:1204:12)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)e[39m
e[39m
[2020-02-15 07:13:22] e[36mINFOe[39m Removing permissions fixtures for email_previews
[2020-02-15 07:13:22] e[36mINFOe[39m Removing posts_meta.email_subject
[2020-02-15 07:13:22] e[36mINFOe[39m Removing posts.send_email_when_published
[2020-02-15 07:13:23] e[31mERRORe[39m alter table `members_labels` add constraint `members_labels_member_id_foreign` foreign key (`member_id`) references `posts` (`id`) - ER_TABLEACCESS_DENIED_ERROR: REFERENCES command denied to user 'ghost'@'192.168.64.3' for table 'ghost.posts'
e[31m
e[31malter table `members_labels` add constraint `members_labels_member_id_foreign` foreign key (`member_id`) references `posts` (`id`) - ER_TABLEACCESS_DENIED_ERROR: REFERENCES command denied to user 'ghost'@'192.168.64.3' for table 'ghost.posts'e[39m
e[37m
{
    "name": "2-add-members-labels-table.js"
}
e[39m
e[33m"Error occurred while executing the following migration: 2-add-members-labels-table.js"e[39m
e[1me[37mError ID:e[39me[22m
    e[90m300e[39m
e[1me[37mError Code: e[39me[22m
    e[90mER_TABLEACCESS_DENIED_ERRORe[39m
e[90m----------------------------------------e[39m
e[90mMigrationScriptError: alter table `members_labels` add constraint `members_labels_member_id_foreign` foreign key (`member_id`) references `posts` (`id`) - ER_TABLEACCESS_DENIED_ERROR: REFERENCES command denied to user 'ghost'@'192.168.64.3' for table 'ghost.posts'
    at MigrationScriptError.KnexMigrateError (/var/lib/ghost/versions/3.6.0/node_modules/knex-migrator/lib/errors.js:7:26)
    at new MigrationScriptError (/var/lib/ghost/versions/3.6.0/node_modules/knex-migrator/lib/errors.js:25:26)
    at /var/lib/ghost/versions/3.6.0/node_modules/knex-migrator/lib/index.js:1055:19
    at tryCatcher (/var/lib/ghost/versions/3.6.0/node_modules/knex-migrator/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/var/lib/ghost/versions/3.6.0/node_modules/knex-migrator/node_modules/bluebird/js/release/promise.js:547:31)
    at Promise._settlePromise (/var/lib/ghost/versions/3.6.0/node_modules/knex-migrator/node_modules/bluebird/js/release/promise.js:604:18)
    at Promise._settlePromise0 (/var/lib/ghost/versions/3.6.0/node_modules/knex-migrator/node_modules/bluebird/js/release/promise.js:649:10)
    at Promise._settlePromises (/var/lib/ghost/versions/3.6.0/node_modules/knex-migrator/node_modules/bluebird/js/release/promise.js:725:18)
    at _drainQueueStep (/var/lib/ghost/versions/3.6.0/node_modules/knex-migrator/node_modules/bluebird/js/release/async.js:93:12)
    at _drainQueue (/var/lib/ghost/versions/3.6.0/node_modules/knex-migrator/node_modules/bluebird/js/release/async.js:86:9)
    at Async._drainQueues (/var/lib/ghost/versions/3.6.0/node_modules/knex-migrator/node_modules/bluebird/js/release/async.js:102:5)
    at Immediate.Async.drainQueues [as _onImmediate] (/var/lib/ghost/versions/3.6.0/node_modules/knex-migrator/node_modules/bluebird/js/release/async.js:15:14)
    at processImmediate (internal/timers.js:456:21)
    at process.topLevelDomainCallback (domain.js:137:15)
Error: ER_TABLEACCESS_DENIED_ERROR: REFERENCES command denied to user 'ghost'@'192.168.64.3' for table 'ghost.posts'
    at Query.Sequence._packetToError (/var/lib/ghost/versions/3.6.0/node_modules/mysql/lib/protocol/sequences/Sequence.js:47:14)
    at Query.ErrorPacket (/var/lib/ghost/versions/3.6.0/node_modules/mysql/lib/protocol/sequences/Query.js:77:18)
    at Protocol._parsePacket (/var/lib/ghost/versions/3.6.0/node_modules/mysql/lib/protocol/Protocol.js:291:23)
    at Parser._parsePacket (/var/lib/ghost/versions/3.6.0/node_modules/mysql/lib/protocol/Parser.js:433:10)
    at Parser.write (/var/lib/ghost/versions/3.6.0/node_modules/mysql/lib/protocol/Parser.js:43:10)
    at Protocol.write (/var/lib/ghost/versions/3.6.0/node_modules/mysql/lib/protocol/Protocol.js:38:16)
    at Socket.<anonymous> (/var/lib/ghost/versions/3.6.0/node_modules/mysql/lib/Connection.js:91:28)
    at Socket.<anonymous> (/var/lib/ghost/versions/3.6.0/node_modules/mysql/lib/Connection.js:525:10)
    at Socket.emit (events.js:321:20)
    at Socket.EventEmitter.emit (domain.js:482:12)
    at addChunk (_stream_readable.js:294:12)
    at readableAddChunk (_stream_readable.js:275:11)
    at Socket.Readable.push (_stream_readable.js:209:10)
    at TCP.onStreamRead (internal/stream_base_commons.js:186:23)
    --------------------
    at Protocol._enqueue (/var/lib/ghost/versions/3.6.0/node_modules/mysql/lib/protocol/Protocol.js:144:48)
    at Connection.query (/var/lib/ghost/versions/3.6.0/node_modules/mysql/lib/Connection.js:201:25)
    at /var/lib/ghost/versions/3.6.0/node_modules/knex-migrator/node_modules/knex/lib/dialects/mysql/index.js:144:18
    at Promise._execute (/var/lib/ghost/versions/3.6.0/node_modules/knex-migrator/node_modules/bluebird/js/release/debuggability.js:427:9)
    at Promise._resolveFromExecutor (/var/lib/ghost/versions/3.6.0/node_modules/knex-migrator/node_modules/bluebird/js/release/promise.js:518:18)
    at new Promise (/var/lib/ghost/versions/3.6.0/node_modules/knex-migrator/node_modules/bluebird/js/release/promise.js:103:10)
    at Client_MySQL._query (/var/lib/ghost/versions/3.6.0/node_modules/knex-migrator/node_modules/knex/lib/dialects/mysql/index.js:135:12)
    at Client_MySQL.query (/var/lib/ghost/versions/3.6.0/node_modules/knex-migrator/node_modules/knex/lib/client.js:192:17)
    at Runner.<anonymous> (/var/lib/ghost/versions/3.6.0/node_modules/knex-migrator/node_modules/knex/lib/runner.js:138:36)
    at Runner.tryCatcher (/var/lib/ghost/versions/3.6.0/node_modules/knex-migrator/node_modules/bluebird/js/release/util.js:16:23)
    at Runner.query (/var/lib/ghost/versions/3.6.0/node_modules/knex-migrator/node_modules/bluebird/js/release/method.js:15:34)
    at Runner.<anonymous> (/var/lib/ghost/versions/3.6.0/node_modules/knex-migrator/node_modules/knex/lib/runner.js:208:19)
    at Runner.tryCatcher (/var/lib/ghost/versions/3.6.0/node_modules/knex-migrator/node_modules/bluebird/js/release/util.js:16:23)
    at Object.gotValue (/var/lib/ghost/versions/3.6.0/node_modules/knex-migrator/node_modules/bluebird/js/release/reduce.js:168:18)
    at Object.gotAccum (/var/lib/ghost/versions/3.6.0/node_modules/knex-migrator/node_modules/bluebird/js/release/reduce.js:155:25)
    at Object.tryCatcher (/var/lib/ghost/versions/3.6.0/node_modules/knex-migrator/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/var/lib/ghost/versions/3.6.0/node_modules/knex-migrator/node_modules/bluebird/js/release/promise.js:547:31)
    at Promise._settlePromise (/var/lib/ghost/versions/3.6.0/node_modules/knex-migrator/node_modules/bluebird/js/release/promise.js:604:18)
    at Promise._settlePromise0 (/var/lib/ghost/versions/3.6.0/node_modules/knex-migrator/node_modules/bluebird/js/release/promise.js:649:10)
    at Promise._settlePromises (/var/lib/ghost/versions/3.6.0/node_modules/knex-migrator/node_modules/bluebird/js/release/promise.js:729:18)
    at _drainQueueStep (/var/lib/ghost/versions/3.6.0/node_modules/knex-migrator/node_modules/bluebird/js/release/async.js:93:12)
    at _drainQueue (/var/lib/ghost/versions/3.6.0/node_modules/knex-migrator/node_modules/bluebird/js/release/async.js:86:9)
    at Async._drainQueues (/var/lib/ghost/versions/3.6.0/node_modules/knex-migrator/node_modules/bluebird/js/release/async.js:102:5)
    at Immediate.Async.drainQueues (/var/lib/ghost/versions/3.6.0/node_modules/knex-migrator/node_modules/bluebird/js/release/async.js:15:14)
    at processImmediate (internal/timers.js:456:21)
    at process.topLevelDomainCallback (domain.js:137:15)e[39m
e[39m

I have failed to update to v3.5.2 and retry after ghost docker image is updated to v3.6.0
Now the error message is about migration lock
.
I am using kubernetes to run ghost with sqlite3 as DB. Until updating to v3.5.2(3.6.), it was running successfully without any problem.

$ kubectl logs ghost-676dd94b8-m2j85 
[2020-02-15 15:13:35] ERROR Migration lock was never released or currently a migration is running.

Migration lock was never released or currently a migration is running.

"If you are sure no migration is running, check your data and if your database is in a broken state, you could run `knex-migrator rollback`."

Error ID:
    500

----------------------------------------

MigrationsAreLockedError: Migration lock was never released or currently a migration is running.
    at MigrationsAreLockedError.KnexMigrateError (/var/lib/ghost/versions/3.6.0/node_modules/knex-migrator/lib/errors.js:7:26)
    at new MigrationsAreLockedError (/var/lib/ghost/versions/3.6.0/node_modules/knex-migrator/lib/errors.js:37:26)
    at /var/lib/ghost/versions/3.6.0/node_modules/knex-migrator/lib/locking.js:62:23
    at tryCatcher (/var/lib/ghost/versions/3.6.0/node_modules/knex-migrator/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/var/lib/ghost/versions/3.6.0/node_modules/knex-migrator/node_modules/bluebird/js/release/promise.js:547:31)
    at Promise._settlePromise (/var/lib/ghost/versions/3.6.0/node_modules/knex-migrator/node_modules/bluebird/js/release/promise.js:604:18)
    at Promise._settlePromise0 (/var/lib/ghost/versions/3.6.0/node_modules/knex-migrator/node_modules/bluebird/js/release/promise.js:649:10)
    at Promise._settlePromises (/var/lib/ghost/versions/3.6.0/node_modules/knex-migrator/node_modules/bluebird/js/release/promise.js:729:18)
    at _drainQueueStep (/var/lib/ghost/versions/3.6.0/node_modules/knex-migrator/node_modules/bluebird/js/release/async.js:93:12)
    at _drainQueue (/var/lib/ghost/versions/3.6.0/node_modules/knex-migrator/node_modules/bluebird/js/release/async.js:86:9)
    at Async._drainQueues (/var/lib/ghost/versions/3.6.0/node_modules/knex-migrator/node_modules/bluebird/js/release/async.js:102:5)
    at Immediate.Async.drainQueues [as _onImmediate] (/var/lib/ghost/versions/3.6.0/node_modules/knex-migrator/node_modules/bluebird/js/release/async.js:15:14)
    at processImmediate (internal/timers.js:456:21)

One of my 2 problematic instances has been successfully updated and is running 3.6.0 but the other, while looking like everything went OK and Ghost is running, is giving me 502 error. Ghost log doesn’t have anything useful :frowning: