Bitwarden not starting because of database error #1571

Closed
opened 2025-10-09 17:20:16 +03:00 by OVERLORD · 6 comments
Owner

Originally created by @cysieks on GitHub.

Subject of the issue

I installed a fresh bitwarden docker image in Azure App Service. Attached Azure File Share as /data.
The problem is that it's not starting at all.

Your environment

  • Bitwarden_rs version:
    Docker image bitwardenrs/server:latest

Steps to reproduce

Started as Web App Service

Expected behaviour

The application should start normally.

Actual behaviour

Errors in log
[panic][ERROR] thread 'main' panicked at 'Failed to turn on WAL: DatabaseError(__Unknown, "database is locked")': src/db/mod.rs:275

When I changed ENABLE_DB_WAL=false, then first WARN is x14 times
[2020-10-26 19:27:40.192][bitwarden_rs::util][WARN] Can't connect to database, retrying: DieselMigError.
[CAUSE] QueryError(
DatabaseError(
__Unknown,
"database is locked",
),
)
[2020-10-26 19:27:41.294][bitwarden_rs][ERROR] Error creating database pool: DieselMigError.
[CAUSE] QueryError(
DatabaseError(
__Unknown,
"database is locked",
),
)

When I checked Azure File Share, there are RSA keys, icon_cache folder, and 0 bytes db.sqlite3 file.
Added next settings:
LOG_FILE=/data/bitwarden.log
LOG_LEVEL=trace
EXTENDED_LOGGING=true

but the only difference is that I have 14x WARN + 1x ERROR in this file.
Do you have an idea of how to make this work?

Relevant logs

Originally created by @cysieks on GitHub. ### Subject of the issue I installed a fresh bitwarden docker image in Azure App Service. Attached Azure File Share as /data. The problem is that it's not starting at all. ### Your environment * Bitwarden_rs version: Docker image bitwardenrs/server:latest ### Steps to reproduce Started as Web App Service ### Expected behaviour The application should start normally. ### Actual behaviour Errors in log [panic][ERROR] thread 'main' panicked at 'Failed to turn on WAL: DatabaseError(__Unknown, "database is locked")': src/db/mod.rs:275 When I changed ENABLE_DB_WAL=false, then first WARN is x14 times [2020-10-26 19:27:40.192][bitwarden_rs::util][WARN] Can't connect to database, retrying: DieselMigError. [CAUSE] QueryError( DatabaseError( __Unknown, "database is locked", ), ) [2020-10-26 19:27:41.294][bitwarden_rs][ERROR] Error creating database pool: DieselMigError. [CAUSE] QueryError( DatabaseError( __Unknown, "database is locked", ), ) When I checked Azure File Share, there are RSA keys, icon_cache folder, and 0 bytes db.sqlite3 file. Added next settings: LOG_FILE=/data/bitwarden.log LOG_LEVEL=trace EXTENDED_LOGGING=true but the only difference is that I have 14x WARN + 1x ERROR in this file. Do you have an idea of how to make this work? ### Relevant logs <!-- Share some logfiles, screenshots or output of relevant programs with us. -->
Author
Owner

@cysieks commented on GitHub:

Already checked that and no luck.

Tomorrow I'm going to test mysql version, but I was hoping to keep it much simpler.

@cysieks commented on GitHub: Already checked that and no luck. Tomorrow I'm going to test mysql version, but I was hoping to keep it much simpler.
Author
Owner

@BlackDex commented on GitHub:

You should add nobrl with cifs.
Also, Azure Blobs is a bit different and thus worked.

@BlackDex commented on GitHub: You should add nobrl with cifs. Also, Azure Blobs is a bit different and thus worked.
Author
Owner

@BlackDex commented on GitHub:

Hello @cysieks,

Azure is using a Samba (Smab/CIFS) shared volume which can't handle locking that well.

On Azure you are better of using either a MySQL or Postgresql based database.

You could try to disable WAL for Sqlite which maybe solves your problem. For this you need to set ENABLE_DB_WAL=false ec920b5756/.env.template (L87)

Be sure to delete the already created db.sqlite before you start again with the WAL set to false, since this is something which will be set during creation of the file.

@BlackDex commented on GitHub: Hello @cysieks, Azure is using a Samba (Smab/CIFS) shared volume which can't handle locking that well. On Azure you are better of using either a MySQL or Postgresql based database. You could try to disable WAL for Sqlite which maybe solves your problem. For this you need to set `ENABLE_DB_WAL=false` https://github.com/dani-garcia/bitwarden_rs/blob/ec920b5756fdae0b64edde328f634fbe2cd92ac0/.env.template#L87 Be sure to delete the already created db.sqlite before you start again with the WAL set to false, since this is something which will be set during creation of the file.
Author
Owner

@BlackDex commented on GitHub:

Since you can not change the mountpoint options at azure this will not work very well, this is unfortunately not something we can fix.

@BlackDex commented on GitHub: Since you can not change the mountpoint options at azure this will not work very well, this is unfortunately not something we can fix.
Author
Owner

@cysieks commented on GitHub:

What mount point options should be changed?

Strange thing is, that it worked about a year ago when Azure Blob was an option for mounting point.
Right now all files are created/amended properly (like log file), except the database file. So it looks like it's sqllite handling issue.

Thanks

@cysieks commented on GitHub: What mount point options should be changed? Strange thing is, that it worked about a year ago when Azure Blob was an option for mounting point. Right now all files are created/amended properly (like log file), except the database file. So it looks like it's sqllite handling issue. Thanks
Author
Owner

@BlackDex commented on GitHub:

Closing this issue because it's not something we can fix on our side.
Also, if you want to discuss this further i suggest to use the forum: https://bitwardenrs.discourse.group/

@BlackDex commented on GitHub: Closing this issue because it's not something we can fix on our side. Also, if you want to discuss this further i suggest to use the forum: https://bitwardenrs.discourse.group/
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/vaultwarden#1571