mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2026-02-05 00:29:40 +03:00
Update to 1.25.0 database update fails #1290
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 @ToeiRei on GitHub (May 31, 2022).
Subject of the issue
Vaultwarden constantly tries to update MySQL(mariadb) using 20220302210038/up.sql
Deployment environment
vaultwarden version: 1.24.0
Install method: docker on Fedora CoreOS
Clients used: n/a
Reverse proxy and version: nginx
MySQL/MariaDB or PostgreSQL version: 10.7.4-MariaDB-1:10.7.4+maria~bullseye - mariadb.org binary distribution
Other relevant details:
Steps to reproduce
Expected behaviour
I would expect the diesel_schema_migration to just do its job and call it a day
Actual behaviour
Migration is run over and over and over ... again.
Troubleshooting data
docker logs:
@BlackDex commented on GitHub (May 31, 2022):
Please checkout: https://github.com/dani-garcia/vaultwarden/wiki/Using-the-MariaDB-(MySQL)-Backend/#foreign-key-errors-collation-and-charset follow those steps and see if that fixes your issue.
@ToeiRei commented on GitHub (May 31, 2022):
My database is already utf8mb4_unicode_ci
@BlackDex commented on GitHub (May 31, 2022):
Is that the same for all the tables? Those could be different sometimes.
Also, try to set
LOG_LEVEL=debugto see if that gives a bit more info.Also, double check the integrity of the
__diesel_schema_migrationstable and maybe execute an optimize on it so that it gets re-created.@ToeiRei commented on GitHub (May 31, 2022):
As you do not seem to live the "screenshot or it didn't happen" philosophy, here is one. My database gets optimized every night right after the backup cycle to make sure it's good for the next day.
@BlackDex commented on GitHub (May 31, 2022):
Can you show the contents of the
__diesel_schema_migrations, since it looks like that isn't updated and that causes the the migration to repeat.@ToeiRei commented on GitHub (May 31, 2022):
There is no entry in this table reflecting 20220302210038. I was trying to add one manually, no joy - as this was one of my first ideas (doing the update manually)
Debug sadly doesn't give more info.
@BlackDex commented on GitHub (May 31, 2022):
Are there any errors or other logs for the database maybe?
@ToeiRei commented on GitHub (May 31, 2022):
MariaDB doesn't complain.
@BlackDex commented on GitHub (May 31, 2022):
I'm not sure why this is not working then.
It looks like Vaultwarden can't execute something for some reason, or isn't able to execute the migration, maybe it doesn't have to correct rights, i have no clue without any more information then this.
What happens if you create a new database and run the latest Vaultwarden on that database?
Is that able to run all the other migrations, and then still gets stuck there?
@ToeiRei commented on GitHub (May 31, 2022):
The vaultwarden sql user got full permissions on the database - so I can rule out the permission thing. Migration commands itself check out without issues.
I can't just run it on a fresh database right now as I've got users using it.
@BlackDex commented on GitHub (May 31, 2022):
Well, you could always run a second instance on a different database, but anyways.
Try to do the following.
__diesel_schema_migrationsNow change to the latest version of Vaultwarden again, and that should fix the issue.
This is what the migration script should be doing, but for some reason that seems to have issues on your setup.
@ToeiRei commented on GitHub (May 31, 2022):
That's exactly what I said in the previous comment.
@BlackDex commented on GitHub (May 31, 2022):
Well, you said that you added the record to the migrations table, not that you executed those other queries.
If you are 100% sure that that exact string of numbers is in there, no spaces or other characters which are prepending or appending it like spaces or whatever, then the migration should not happen at all.
The migration tooling check that table for that exact same string and if that is there it will not run the migration.
So if you are 100% sure it is there, I'm actually not sure what to do.
I can't reproduce it my self no matter what i try to do.
If you do not get any errors from changing the the
PRIMARY KEYquery, and the table DDL is looking exactly the same as this:Then it should just be working. If not, then I'm out of options to check right now, except for running a separate Vaultwarden container using the exact same configuration as you are having right now on a new empty database and see if that wants to run or not. Or maybe even try to copy/clone the current database to
vaultwarden_newand use that and see what happens.There isn't anything we can do on the server side I'm afraid.
@ToeiRei commented on GitHub (May 31, 2022):
I'll just stay on it and see if I can reproduce it; If not, I'll just call it a fluke, reboot and carry on.