-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Possible migration failure using SQLite DB backend #2744
Comments
Hi there, Thank you for your report! I was able to reproduce this issue, and have flagged this to our engineering team. If you wish to add any further information/screenshots/recordings etc., please feel free to do so at any time - our engineering team will be happy to review these. Thanks once again! |
@tokyovigilante Could you look into your admin logs and see if there are any errors? ( |
Thanks, attached is the result of I note most of these errors are a bit historic and seem to relate to when I was setting up the container and hadn't got my config and keys etc quite right, and it has worked well with sqlite and podman prior to the latest updates. I note the last two lines in the unfiltered log are:
which would have been about when I updated the container. cat bwdata/logs/admin.log | grep -v INF
|
Thanks for the quick fix, but please push this to the dev docker image at least, as I cannot currently access my vault. |
@tokyovigilante This should be on the latest of the |
Ok, this bug is still present if that is the case, unless there is a manual step required to trigger the migration. |
You have to update your server and make sure that |
Thanks, I have re-pulled this morning with the same result.
Container version:
Here is the current schema.sql
|
@tokyovigilante Can you post the results from |
|
Hi, any update for this? Is there a manual way to trigger the migration or restore the database? Thanks. |
I think this issue needs to be reopened. I have the same issue with the latest beta image. |
I have the same issue suddenly. Can someone please reopen this issue ? |
Hey all, I am reopening this issue, to make sure, you are all getting this error |
Hello, I am facing this issue with the same error. Tried both dev and beta tag. |
This is exactly the same error I am seeing having pulled the latest beta image (as of yesterday). I'm using an Sqllite DB. More than happy to help reproduce or provide logs etc. if useful. |
@gavGaz Did you pull it brand new or were you upgrading from a different version? |
Upgraded from a previous version |
To give you all an update, I spent a good bit of time trying to recreate this error and I have not been able to. It somehow appears that it's failing to do a migration yet is still marking it as having done that migration in the My recommendation for all who ran into this issue is to find the location of your For anyone who runs into the issue in the future here is a list of the information that would be helpful, I am not planning on spending much more time on this without this information.
|
For now I switched to PostgreSQL and had no issues since then. Only downside is that bitwarden is running considerably slower when not using SQLite. But once these issues get fixed and the SQLite backend gets more stable i am happy to switch back to SQLite. |
Will deleting the .db directory also wipe out any credentials? I.e. is there a way of recovering from this situation maintaining my credential data? |
@gavGaz Yes, deleting the The long way of recovering from this situation is making a copy of the database, booting up bitwarden to let it run the migrations and then inserting the data from the original into the new one. You'll have to do this one table at a time but skipping the |
@Pascal3366 glad PostgreSQL is working okay, I'm curious where you are seeing it be "considerably slower". Is the PostgreSQL database hosted as another container on the same machine? I wouldn't expect them to have any significant difference. |
@justindbaur you notice that it is slower when it is loading the vault e.g. The database is hosted as a container on the same machine. I tried to put the database into the bitwarden mapped folder first but that would not work because it is mounted through NFS. I had constantly problems with lock files. So now the database is inside the docker volume. But yes you can really notice the speed difference between PostgreSQL and SQLite. |
@justindbaur Thanks for your work on this, deleting the |
@Pascal3366 Very interesting, I will keep an eye out, they both use EF so a slower warmup time is expected for both but once queries have been generated and cached I would actually expect Postgres to out perform, the SQLite provider doesn't have quite as many features so we have to do larger queries sometimes and filter the rest of the data in the code, outside of the query. But it's also possible the C# -> SQLite driver is more optimized then the C# -> Postgres one, and if that is the case we can't do to much. @tokyovigilante Thank you for understanding, I am working on a couple different fronts to ensure that these new databases are well tested so they can be more robust. I'm working on this PR (#2471) that adds automatic repository layer testing. In response to this issue specifically I will work on something to automatically test the upgrade path by running the tests on the |
Quick and dirty solution to add the missing columns in the User table (use carefully!) on docker host:
in docker container:
|
You should be able to skip a few steps because |
@juliokele Thanks, results below but just running this against my vault.db got my installation working again, and subsequent upgrade/pull to 2023.3.0 worked well, thanks!
@justindbaur That's great, sounds good thank you. |
Steps To Reproduce
Upgrade from
dev
Docker image from ~2 weeks ago to currentdev
orbeta
Docker image.Start bitwarden image using
podman run
Expected Result
Bitwarden server and web client is available
Actual Result
Login using web API fails, with
identity.log
suggesting DB schema has changed and either migration was not performed or failed:Screenshots or Videos
No response
Additional Context
Fedora 38 server, running Podman, with pods behind an nginx proxy.
podman run
command:podman run -d --name bitwarden -v /home/ryan/docker/bitwarden-unified/bwdata/:/etc/bitwarden:Z -p 8082:8082 --env-file settings.env bitwarden/self-host:dev
settings.env
:Githash Version
3cedc0c-dirty
Environment Details
Fedora 38 Server
Podman (run command above)
Intel Xeon D-1518, 32 GB RAM
Database Image
SQLite
Issue-Link
#2480
Issue Tracking Info
The text was updated successfully, but these errors were encountered: