Bitwarden_rs sqlite backup: error running command #414

Closed
opened 2026-02-04 20:22:32 +03:00 by OVERLORD · 1 comment
Owner

Originally created by @luciano-fiandesio on GitHub (Sep 9, 2019).

I'm trying to follow the wiki for vault backup:

https://github.com/dani-garcia/bitwarden_rs/wiki/Backing-up-your-vault

The command: sqlite db.sqlite3 ".backup 'backup/backup.sqlite3'" exit with an error:

Unable to open database "db.sqlite3": file is encrypted or is not a database

Is there a different way to backup the database?

Originally created by @luciano-fiandesio on GitHub (Sep 9, 2019). I'm trying to follow the wiki for vault backup: https://github.com/dani-garcia/bitwarden_rs/wiki/Backing-up-your-vault The command: `sqlite db.sqlite3 ".backup 'backup/backup.sqlite3'"` exit with an error: `Unable to open database "db.sqlite3": file is encrypted or is not a database` Is there a different way to backup the database?
Author
Owner

@Ayitaka commented on GitHub (Sep 9, 2019):

Remove the apostrophes around 'backup/backup.sqlite3', they are not needed.

Here is the script I cobbled together and run once a day via cron to backup my database and remove backups older than 30 days... adjust to your setup if you'd like. :) Hope it helps!

#!/bin/sh

DB_FILE="/home/bitwarden/bw-data/db.sqlite3"
BACKUP_DIR="/home/bitwarden/backup"
BACKUP_FILE="${BACKUP_DIR}/backup.sqlite3.$(date "+%F-%H%M%S")"

mkdir -p $BACKUP_DIR
sqlite3 $DB_FILE ".backup ${BACKUP_FILE}" >/dev/null

# Remove backups older than 30 days.
find $BACKUP_DIR -type f -name 'backup.sqlite3.*' -mtime +30 -exec rm {} \;

@Ayitaka commented on GitHub (Sep 9, 2019): Remove the apostrophes around `'backup/backup.sqlite3'`, they are not needed. Here is the script I cobbled together and run once a day via cron to backup my database and remove backups older than 30 days... adjust to your setup if you'd like. :) Hope it helps! ``` #!/bin/sh DB_FILE="/home/bitwarden/bw-data/db.sqlite3" BACKUP_DIR="/home/bitwarden/backup" BACKUP_FILE="${BACKUP_DIR}/backup.sqlite3.$(date "+%F-%H%M%S")" mkdir -p $BACKUP_DIR sqlite3 $DB_FILE ".backup ${BACKUP_FILE}" >/dev/null # Remove backups older than 30 days. find $BACKUP_DIR -type f -name 'backup.sqlite3.*' -mtime +30 -exec rm {} \; ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/vaultwarden#414