mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2026-03-01 11:19:52 +03:00
"Error: attempt to write a readonly database" when trying to backup the SQLite DB #1012
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @ThibaultNocchi on GitHub (Apr 22, 2021).
Subject of the issue
I've set up a cronjob to backup my SQLite DB as the documentation suggested.
But sometimes I can't read the DB and get the error "Error: attempt to write a readonly database" when trying a simple
.tablescommand against it.I've found that it happens when I reboot my system, and maybe when the app has been unaccessed for a while.
The reliable thing I found is when the DB is unavailable, there are no
db.sqlite3-shmanddb.sqlite3-walfiles next to it. When they are present, I can read/write my DB viasqlite3.The simple fix I found is logging in, then I guess a log session is wrote and the DB is "unlocked".
What can be done about it to be able to reliably access my DB?
PS: I've found #1404 but it doesn't seem to apply to my problem.
Deployment environment
Your environment (Generated via diagnostics page)
Config (Generated via diagnostics page)
Expected behaviour
I'd like to be able to backup at any time.
Actual behaviour
I need to do operations on my app first (such as login) to be able to backup.
Thank you! :)
@BlackDex commented on GitHub (Apr 23, 2021):
I'm not sure what you are doing then, because using either
.backuporVACUUM INTOwill create a new file and only reads from the original. So, it should never attempt to write to the original db.sqlite3 file at all.Be sure to check the correct syntax here: https://github.com/dani-garcia/bitwarden_rs/wiki/Backing-up-your-vault
Also, if you added it to a Linux cronjob, then make sure you escaped the
%like\%signs within the crontab.