# Migration Lock after updating ghost image

**URL:** <https://forum.ghost.org/t/migration-lock-after-updating-ghost-image/49485>\
**Category:** Migrations\
**Created:** [August 12, 2024, 12:32pm UTC](https://forum.ghost.org/t/migration-lock-after-updating-ghost-image/49485 "2024-08-12T12:32:05Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![CANU](https://avatars.discourse-cdn.com/v4/letter/c/dec6dc/32.png) [@CANU](https://forum.ghost.org/u/CANU)\
**Post date:** [August 12, 2024, 12:32pm UTC](https://forum.ghost.org/t/migration-lock-after-updating-ghost-image/49485/1 "2024-08-12T12:32:05Z")

</div>

Hi, I’m currently running a ghost blog on a synology NAS system using mysql and a ghost docker image.

I recently updated the ghost image, and did a migration, but it stopped working and got migration database locked.

Currently, files such as posts and database are all stored on the server, but when I try to access the CLI of the ghost image, it crashes and is unavailable because the container is terminated.

Before asking the question, I checked the internet and confirmed that there are two ways to remove the migration\_lock table: Ghost CLI is not accessible for the same reason as above, and it is also not possible to access mysql to remove the migration\_lock table.

Is there any other way to solve migration lock problem?

This is my ghost container’s error log:

```auto
	    at async bootGhost (/var/lib/ghost/versions/5.89.0/core/boot.js:537:9)e[39m
2024/08/12 20:41:58	stdout at async initDatabase (/var/lib/ghost/versions/5.89.0/core/boot.js:69:5)
2024/08/12 20:41:58	stdout at async DatabaseStateManager.makeReady (/var/lib/ghost/versions/5.89.0/core/server/data/db/DatabaseStateManager.js:73:25)
2024/08/12 20:41:58	stdout at async DatabaseStateManager.getState (/var/lib/ghost/versions/5.89.0/core/server/data/db/DatabaseStateManager.js:40:13)
2024/08/12 20:41:58	stdout at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
2024/08/12 20:41:58	stdout at /var/lib/ghost/versions/5.89.0/node_modules/knex-migrator/lib/locking.js:62:23
2024/08/12 20:41:58	stdout	e[90mMigrationsAreLockedError: Migration lock was never released or currently a migration is running.
2024/08/12 20:41:58	stdout	
2024/08/12 20:41:58	stdout	e[90m----------------------------------------e[39m

```

Thanks for support 🤕

---

<div class="post-metadata">

**Author:** ![Raki](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/raki/32/40808_2.png) [@Raki](https://forum.ghost.org/u/Raki)\
**Post date:** [August 12, 2024, 6:32pm UTC](https://forum.ghost.org/t/migration-lock-after-updating-ghost-image/49485/2 "2024-08-12T18:32:49Z")

</div>

You need to log into MySQL or connect with MySQL with database management tool and unlock the `migrations_lock` table:

Unlock the table: `UPDATE migrations_lock set locked = 0 where lock_key = 'km01';`

---

<div class="post-metadata">

**Author:** ![CANU](https://avatars.discourse-cdn.com/v4/letter/c/dec6dc/32.png) [@CANU](https://forum.ghost.org/u/CANU)\
**Post date:** [August 12, 2024, 6:56pm UTC](https://forum.ghost.org/t/migration-lock-after-updating-ghost-image/49485/3 "2024-08-12T18:56:15Z")

</div>

Thanks for reply,

I accessed the mysql container and updated the migration\_lock table but got the same MigrationsAreLockedError, so when I checked the table, it was an empty table with no value for the key ‘km01’…

---

<div class="post-metadata">

**Author:** ![Raki](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/raki/32/40808_2.png) [@Raki](https://forum.ghost.org/u/Raki)\
**Post date:** [August 12, 2024, 7:12pm UTC](https://forum.ghost.org/t/migration-lock-after-updating-ghost-image/49485/4 "2024-08-12T19:12:13Z")

</div>

Then try to insert it:  
`INSERT INTO migrations_lock (lock_key, locked, acquired_at, released_at) VALUES ('km01', 0, '2024-05-21 00:16:28', '2024-05-21 00:16:40');`

---

<div class="post-metadata">

**Author:** ![CANU](https://avatars.discourse-cdn.com/v4/letter/c/dec6dc/32.png) [@CANU](https://forum.ghost.org/u/CANU)\
**Post date:** [August 13, 2024, 11:30am UTC](https://forum.ghost.org/t/migration-lock-after-updating-ghost-image/49485/5 "2024-08-13T11:30:43Z")

</div>

It works like charm, really thanks for your help! 🥹
