[Bug]: SQLite Migration Problem when using Docker/NFS #2309

Closed
opened 2026-04-25 00:05:58 +02:00 by adam · 4 comments
Owner

Originally created by @davidangel on GitHub (Oct 14, 2024).

What happened?

Problem: NFS creates "hidden" files in the migrations folder, and it looks like audiobookshelf attempts to run every file in this directory as a migration. This causes errors like the one below...

Error

[2024-10-14 01:40:24.657] ERROR: [Database] Failed to run migrations /server/migrations/.nfs.2005bda3.50cc:1

Full startup log

[2024-10-14 01:40:24.631] INFO: === Starting Server ===
[2024-10-14 01:40:24.633] INFO: [Server] Init v2.15.0
[2024-10-14 01:40:24.633] INFO: [Server] Node.js Version: v20.18.0
[2024-10-14 01:40:24.633] INFO: [Server] Platform: linux
[2024-10-14 01:40:24.634] INFO: [Server] Arch: arm64
[2024-10-14 01:40:24.643] INFO: [Database] Initializing db at "/config/absdatabase.sqlite"
[2024-10-14 01:40:24.650] INFO: [Database] Loading extension /usr/local/lib/nusqlite3/libnusqlite3.so
[2024-10-14 01:40:24.650] INFO: [Database] Successfully loaded extension /usr/local/lib/nusqlite3/libnusqlite3.so
[2024-10-14 01:40:24.651] INFO: [Database] Db supports unaccent and unicode foldings
[2024-10-14 01:40:24.651] INFO: [Database] Db connection was successful
[2024-10-14 01:40:24.657] ERROR: [Database] Failed to run migrations /server/migrations/.nfs.2005bda3.50cc:1
SyntaxError: Invalid or unexpected token
    at wrapSafe (node:internal/modules/cjs/loader:1378:20)
    at Module._compile (node:internal/modules/cjs/loader:1428:41)
    at resolve (/server/managers/MigrationManager.js:147:18)
    at /server/libs/umzug/umzug.js:330:14
    at Array.map (<anonymous>)
    at Umzug.migrations (/server/libs/umzug/umzug.js:325:20)
    at migrations (/server/managers/MigrationManager.js:166:23)
    at Umzug.paths [as migrations] (/server/libs/umzug/umzug.js:317:32)
    at MigrationManager.runMigrations (/server/managers/MigrationManager.js:82:41)
    at async Database.init (/server/Database.js:184:7)
[2024-10-14 01:40:24.658] FATAL: [Server] Unhandled rejection: Error: Database migration failed
    at Database.init (/server/Database.js:187:13)
    at async Server.init (/server/Server.js:128:5)
    at async Server.start (/server/Server.js:191:5) 
promise: Promise {
  <rejected> Error: Database migration failed
      at Database.init (/server/Database.js:187:13)
      at async Server.init (/server/Server.js:128:5)
      at async Server.start (/server/Server.js:191:5)
}

What did you expect to happen?

The migration should complete normally.

Steps to reproduce the issue

Audiobookshelf version

v2.15.0

How are you running audiobookshelf?

Docker

What OS is your Audiobookshelf server hosted from?

macOS

If the issue is being seen in the UI, what browsers are you seeing the problem on?

None

Logs

No response

Additional Notes

No response

Originally created by @davidangel on GitHub (Oct 14, 2024). ### What happened? Problem: NFS creates "hidden" files in the migrations folder, and it looks like audiobookshelf attempts to run every file in this directory as a migration. This causes errors like the one below... ## Error ``` [2024-10-14 01:40:24.657] ERROR: [Database] Failed to run migrations /server/migrations/.nfs.2005bda3.50cc:1 ``` ## Full startup log ``` [2024-10-14 01:40:24.631] INFO: === Starting Server === [2024-10-14 01:40:24.633] INFO: [Server] Init v2.15.0 [2024-10-14 01:40:24.633] INFO: [Server] Node.js Version: v20.18.0 [2024-10-14 01:40:24.633] INFO: [Server] Platform: linux [2024-10-14 01:40:24.634] INFO: [Server] Arch: arm64 [2024-10-14 01:40:24.643] INFO: [Database] Initializing db at "/config/absdatabase.sqlite" [2024-10-14 01:40:24.650] INFO: [Database] Loading extension /usr/local/lib/nusqlite3/libnusqlite3.so [2024-10-14 01:40:24.650] INFO: [Database] Successfully loaded extension /usr/local/lib/nusqlite3/libnusqlite3.so [2024-10-14 01:40:24.651] INFO: [Database] Db supports unaccent and unicode foldings [2024-10-14 01:40:24.651] INFO: [Database] Db connection was successful [2024-10-14 01:40:24.657] ERROR: [Database] Failed to run migrations /server/migrations/.nfs.2005bda3.50cc:1 SyntaxError: Invalid or unexpected token at wrapSafe (node:internal/modules/cjs/loader:1378:20) at Module._compile (node:internal/modules/cjs/loader:1428:41) at resolve (/server/managers/MigrationManager.js:147:18) at /server/libs/umzug/umzug.js:330:14 at Array.map (<anonymous>) at Umzug.migrations (/server/libs/umzug/umzug.js:325:20) at migrations (/server/managers/MigrationManager.js:166:23) at Umzug.paths [as migrations] (/server/libs/umzug/umzug.js:317:32) at MigrationManager.runMigrations (/server/managers/MigrationManager.js:82:41) at async Database.init (/server/Database.js:184:7) [2024-10-14 01:40:24.658] FATAL: [Server] Unhandled rejection: Error: Database migration failed at Database.init (/server/Database.js:187:13) at async Server.init (/server/Server.js:128:5) at async Server.start (/server/Server.js:191:5) promise: Promise { <rejected> Error: Database migration failed at Database.init (/server/Database.js:187:13) at async Server.init (/server/Server.js:128:5) at async Server.start (/server/Server.js:191:5) } ``` ### What did you expect to happen? The migration should complete normally. ### Steps to reproduce the issue 1. ### Audiobookshelf version v2.15.0 ### How are you running audiobookshelf? Docker ### What OS is your Audiobookshelf server hosted from? macOS ### If the issue is being seen in the UI, what browsers are you seeing the problem on? None ### Logs _No response_ ### Additional Notes _No response_
adam added the bug label 2026-04-25 00:05:58 +02:00
adam closed this issue 2026-04-25 00:05:58 +02:00
Author
Owner

@patrickaclark commented on GitHub (Oct 14, 2024):

I don't think this is an audiobookshelf bug. You shouldn't run sqlite dbs on NFS hosts because of locking issues and data corruption (this has been a well-documented issue for years). I worked around this by storing the /config directory outside of my NFS share locally on my docker host, and things work. NFS is just a PITA for anything with docker between permissions and because of how many docker stacks utilize a sqlite backend vs a full database which means you can't keep things as self-contained inside your NAS as you'd probably like, and then have to implement outside the box things for storage, like an rsync of the sqlite directories for backup.

@patrickaclark commented on GitHub (Oct 14, 2024): I don't think this is an audiobookshelf bug. You shouldn't run sqlite dbs on NFS hosts because of locking issues and data corruption (this has been a well-documented issue for years). I worked around this by storing the /config directory outside of my NFS share locally on my docker host, and things work. NFS is just a PITA for anything with docker between permissions and because of how many docker stacks utilize a sqlite backend vs a full database which means you can't keep things as self-contained inside your NAS as you'd probably like, and then have to implement outside the box things for storage, like an rsync of the sqlite directories for backup.
Author
Owner

@advplyr commented on GitHub (Oct 14, 2024):

Agreed sqlite shouldn't be used on NFS.
We should be ignoring dot files in the migrations folder though so I updated that.

@advplyr commented on GitHub (Oct 14, 2024): Agreed sqlite shouldn't be used on NFS. We should be ignoring dot files in the migrations folder though so I updated that.
Author
Owner

@davidangel commented on GitHub (Oct 15, 2024):

@patrickaclark – Thanks for thinking through that and explaining your thoughts. I have experienced some frustration with docker and NFS, but I'm thinking Docker + MacOS could present similar issues (.DS_Store). I've already run some containers with unmounted volumes that get backed up at intervals, perhaps I'll go that route with abs.

@advplyr – Thanks for the quick fix anyways!

@davidangel commented on GitHub (Oct 15, 2024): @patrickaclark – Thanks for thinking through that and explaining your thoughts. I have experienced some frustration with docker and NFS, but I'm thinking Docker + MacOS could present similar issues (`.DS_Store`). I've already run some containers with unmounted volumes that get backed up at intervals, perhaps I'll go that route with abs. @advplyr – Thanks for the quick fix anyways!
Author
Owner

@github-actions[bot] commented on GitHub (Oct 18, 2024):

Fixed in v2.15.1.

@github-actions[bot] commented on GitHub (Oct 18, 2024): Fixed in [v2.15.1](https://github.com/advplyr/audiobookshelf/releases/tag/v2.15.1).
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf#2309