Error running migrations: I've read the wiki

I’ll try and make this as thourough as I can. Vaultwarden is installed via apt packages, and running an auto-upgrade script. Here’s the results of the last update:

pgrade for Vaultwarden was found. Upgrading form 1.31.0-0 to https://github.com/dionysius/vaultwarden-deb/releases/download/debian/1.32.0-0/vaultwarden_1.32.0-0.bookworm_amd64.deb.

Current release of Vaultwarden-web-vault 2024.6.2-0 is already installed, nothing to do.

Reading package lists...
Reading package lists...
Building dependency tree...
Reading state information...
The following packages were automatically installed and are no longer required:
  geoip-database libabsl20220623 libaio1 libaom3 libavif15 libdav1d6
  libde265-0 libdeflate0 libgav1-1 libgd3 libgeoip1 libheif1 libjbig0
  libjpeg62-turbo liblerc4 libnginx-mod-http-geoip
  libnginx-mod-http-image-filter libnginx-mod-http-xslt-filter
  libnginx-mod-mail libnginx-mod-stream libnginx-mod-stream-geoip librav1e0
  libsvtav1enc1 libtiff5 libtiff6 libwebp6 libwebp7 libx265-199 libxslt1.1
  libyuv0 nginx-core python3-requests-toolbelt python3-zope.component
  python3-zope.event python3-zope.hookable python3-zope.interface telnet
Use 'apt autoremove' to remove them.
The following packages will be upgraded:
  vaultwarden
1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/7869 kB of archives.
After this operation, 309 kB of additional disk space will be used.
Get:1 /usr/src/VAULTWARDEN_UPGRADES_2024-08-12_01-30-06/vaultwarden_1.32.0-0.bookworm_amd64.deb vaultwarden amd64 1.32.0-0~bookworm [7869 kB]
apt-listchanges: Reading changelogs...
(Reading database ...  (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 28289 files and directories currently installed.)
Preparing to unpack .../vaultwarden_1.32.0-0.bookworm_amd64.deb ...
Unpacking vaultwarden (1.32.0-0~bookworm) over (1.31.0-0~bookworm) ...
Setting up vaultwarden (1.32.0-0~bookworm) ...

Configuration file '/etc/default/vaultwarden'
 ==> Modified (by you or by a script) since installation.
 ==> Package distributor has shipped an updated version.
 ==> Keeping old config file as default.
adduser: The user `vaultwarden' already exists, but is not a system user. Exiting.

 Check These URLS to make sure
https://api.github.com/repos/dionysius/vaultwarden-deb/releases
https://api.github.com/repos/dionysius/vaultwarden-web-vault-deb/releases

Reading package lists...
Building dependency tree...
Reading state information...
Calculating upgrade...
The following packages were automatically installed and are no longer required:
  geoip-database libabsl20220623 libaio1 libaom3 libavif15 libdav1d6
  libde265-0 libdeflate0 libgav1-1 libgd3 libgeoip1 libheif1 libjbig0
  libjpeg62-turbo liblerc4 libnginx-mod-http-geoip
  libnginx-mod-http-image-filter libnginx-mod-http-xslt-filter
  libnginx-mod-mail libnginx-mod-stream libnginx-mod-stream-geoip librav1e0
  libsvtav1enc1 libtiff5 libtiff6 libwebp6 libwebp7 libx265-199 libxslt1.1
  libyuv0 nginx-core python3-requests-toolbelt python3-zope.component
  python3-zope.event python3-zope.hookable python3-zope.interface telnet
Use 'apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

When vaultwarden tries to start, I seen the following errors in journlanctl -xe

[2024-08-17 10:59:45.606][panic][ERROR] thread 'main' panicked at 'Error running migrations: QueryError(DieselMigrationName { name: "2024-06-05-131359_add_2fa_duo_store", version: Migration>
                                                 0: <unknown>
                                                 1: <unknown>
                                                 2: <unknown>
                                                 3: <unknown>
                                                 4: <unknown>
                                                 5: <unknown>
                                                 6: <unknown>
                                                 7: <unknown>
                                                 8: <unknown>
                                                 9: <unknown>
                                                10: <unknown>
                                                11: <unknown>
                                                12: <unknown>
                                                13: __libc_start_main
                                                14: <unknown>

I’ve followed the guide here: Using the MariaDB (MySQL) Backend · dani-garcia/vaultwarden Wiki · GitHub

This is the generated code:

SET foreign_key_checks = 0;
ALTER TABLE `twofactor` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;                  
ALTER TABLE `users_collections` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;          
ALTER TABLE `organizations` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;              
ALTER TABLE `sends` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;                      
ALTER TABLE `attachments` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;                
ALTER TABLE `ciphers` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;                    
ALTER TABLE `ciphers_collections` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;        
ALTER TABLE `twofactor_incomplete` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;       
ALTER TABLE `organization_api_key` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;       
ALTER TABLE `users_organizations` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;        
ALTER TABLE `groups_users` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;               
ALTER TABLE `users` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;                      
ALTER TABLE `groups` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;                     
ALTER TABLE `twofactor_duo_ctx` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;          
ALTER TABLE `event` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;                      
ALTER TABLE `collections` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;                
ALTER TABLE `collections_groups` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;         
ALTER TABLE `emergency_access` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;           
ALTER TABLE `folders` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;                    
ALTER TABLE `auth_requests` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;              
ALTER TABLE `invitations` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;                
ALTER TABLE `favorites` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;                  
ALTER TABLE `devices` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;                    
ALTER TABLE `org_policies` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;               
ALTER TABLE `__diesel_schema_migrations` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; 
ALTER TABLE `folders_ciphers` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;            
SET foreign_key_checks = 1;

When I run it I get foreign key constraint errors on most of the ALTER TABLE entries. It makes it look like “SET foreign_key_checks = 0;” isn’t working correctly?

Here are the full results of what I’m seeing:

MariaDB [(none)]> connect vaultwarden;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Connection id:    42
Current database: vaultwarden

MariaDB [vaultwarden]> SET foreign_key_checks = 0;
Query OK, 0 rows affected (0.000 sec)

MariaDB [vaultwarden]> ALTER TABLE `twofactor` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;                  
ERROR 1832 (HY000): Cannot change column 'user_uuid': used in a foreign key constraint 'twofactor_ibfk_1'
MariaDB [vaultwarden]> ALTER TABLE `users_collections` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;          
ERROR 1832 (HY000): Cannot change column 'user_uuid': used in a foreign key constraint 'users_collections_ibfk_1'
MariaDB [vaultwarden]> ALTER TABLE `organizations` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;              
ERROR 1833 (HY000): Cannot change column 'uuid': used in a foreign key constraint 'auth_requests_ibfk_2' of table 'vaultwarden.auth_requests'
MariaDB [vaultwarden]> ALTER TABLE `sends` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;                      
ERROR 1832 (HY000): Cannot change column 'user_uuid': used in a foreign key constraint 'sends_ibfk_1'
MariaDB [vaultwarden]> ALTER TABLE `attachments` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;                
ERROR 1832 (HY000): Cannot change column 'cipher_uuid': used in a foreign key constraint 'attachments_ibfk_1'
MariaDB [vaultwarden]> ALTER TABLE `ciphers` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;                    
ERROR 1833 (HY000): Cannot change column 'uuid': used in a foreign key constraint 'attachments_ibfk_1' of table 'vaultwarden.attachments'
MariaDB [vaultwarden]> ALTER TABLE `ciphers_collections` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;        
ERROR 1832 (HY000): Cannot change column 'cipher_uuid': used in a foreign key constraint 'ciphers_collections_ibfk_1'
MariaDB [vaultwarden]> ALTER TABLE `twofactor_incomplete` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;       
ERROR 1832 (HY000): Cannot change column 'user_uuid': used in a foreign key constraint 'twofactor_incomplete_ibfk_1'
MariaDB [vaultwarden]> ALTER TABLE `organization_api_key` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;       
ERROR 1832 (HY000): Cannot change column 'org_uuid': used in a foreign key constraint 'organization_api_key_ibfk_1'
MariaDB [vaultwarden]> ALTER TABLE `users_organizations` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;        
ERROR 1833 (HY000): Cannot change column 'uuid': used in a foreign key constraint 'groups_users_ibfk_2' of table 'vaultwarden.groups_users'
MariaDB [vaultwarden]> ALTER TABLE `groups_users` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;               
ERROR 1832 (HY000): Cannot change column 'groups_uuid': used in a foreign key constraint 'groups_users_ibfk_1'
MariaDB [vaultwarden]> ALTER TABLE `users` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;                      
ERROR 1833 (HY000): Cannot change column 'uuid': used in a foreign key constraint 'auth_requests_ibfk_1' of table 'vaultwarden.auth_requests'
MariaDB [vaultwarden]> ALTER TABLE `groups` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;                     
ERROR 1833 (HY000): Cannot change column 'uuid': used in a foreign key constraint 'collections_groups_ibfk_2' of table 'vaultwarden.collections_groups'
MariaDB [vaultwarden]> ALTER TABLE `twofactor_duo_ctx` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;          
Query OK, 0 rows affected (0.004 sec)
Records: 0  Duplicates: 0  Warnings: 0

MariaDB [vaultwarden]> ALTER TABLE `event` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;                      
Query OK, 0 rows affected (0.003 sec)
Records: 0  Duplicates: 0  Warnings: 0

MariaDB [vaultwarden]> ALTER TABLE `collections` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;                
ERROR 1833 (HY000): Cannot change column 'uuid': used in a foreign key constraint 'ciphers_collections_ibfk_2' of table 'vaultwarden.ciphers_collections'
MariaDB [vaultwarden]> ALTER TABLE `collections_groups` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;         
ERROR 1832 (HY000): Cannot change column 'collections_uuid': used in a foreign key constraint 'collections_groups_ibfk_1'
MariaDB [vaultwarden]> ALTER TABLE `emergency_access` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;           
ERROR 1832 (HY000): Cannot change column 'grantor_uuid': used in a foreign key constraint 'emergency_access_ibfk_1'
MariaDB [vaultwarden]> ALTER TABLE `folders` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;                    
ERROR 1833 (HY000): Cannot change column 'uuid': used in a foreign key constraint 'folders_ciphers_ibfk_2' of table 'vaultwarden.folders_ciphers'
MariaDB [vaultwarden]> ALTER TABLE `auth_requests` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;              
ERROR 1832 (HY000): Cannot change column 'user_uuid': used in a foreign key constraint 'auth_requests_ibfk_1'
MariaDB [vaultwarden]> ALTER TABLE `invitations` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;                
Query OK, 0 rows affected (0.004 sec)
Records: 0  Duplicates: 0  Warnings: 0

MariaDB [vaultwarden]> ALTER TABLE `favorites` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;                  
ERROR 1832 (HY000): Cannot change column 'user_uuid': used in a foreign key constraint 'favorites_ibfk_1'
MariaDB [vaultwarden]> ALTER TABLE `devices` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;                    
ERROR 1832 (HY000): Cannot change column 'user_uuid': used in a foreign key constraint 'devices_ibfk_1'
MariaDB [vaultwarden]> ALTER TABLE `org_policies` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;               
ERROR 1832 (HY000): Cannot change column 'org_uuid': used in a foreign key constraint 'org_policies_ibfk_1'
MariaDB [vaultwarden]> ALTER TABLE `__diesel_schema_migrations` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; 
Query OK, 0 rows affected (0.004 sec)
Records: 0  Duplicates: 0  Warnings: 0

MariaDB [vaultwarden]> ALTER TABLE `folders_ciphers` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;            
ERROR 1832 (HY000): Cannot change column 'cipher_uuid': used in a foreign key constraint 'folders_ciphers_ibfk_1'
MariaDB [vaultwarden]> SET foreign_key_checks = 1;
Query OK, 0 rows affected (0.000 sec)

Does anyone have any ideas on how to fix this?

It all need to be done in 1 transaction/session, not multiple or separate commands from the cli.

Thanks for the reply, but I don’t follow. Can you kindly provide an example of what you mean?

Based on what you said, I pasted all of the commands (identically as listed above starting with the line “SET foreign_key_checks = 0;” into /tmp/migration.sql

Here’s what I get when I try it that way:

MariaDB [(none)]> connect vaultwarden
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Connection id:    44
Current database: vaultwarden

MariaDB [vaultwarden]> source /tmp/migration.sql
Query OK, 0 rows affected (0.000 sec)

Query OK, 0 rows affected (0.005 sec)
Records: 0  Duplicates: 0  Warnings: 0

ERROR 1832 (HY000) at line 3 in file: '/tmp/migration.sql': Cannot change column 'cipher_uuid': used in a foreign key constraint 'attachments_ibfk_1'
ERROR 1832 (HY000) at line 4 in file: '/tmp/migration.sql': Cannot change column 'cipher_uuid': used in a foreign key constraint 'ciphers_collections_ibfk_1'
ERROR 1833 (HY000) at line 5 in file: '/tmp/migration.sql': Cannot change column 'uuid': used in a foreign key constraint 'attachments_ibfk_1' of table 'vaultwarden.attachments'
ERROR 1833 (HY000) at line 6 in file: '/tmp/migration.sql': Cannot change column 'uuid': used in a foreign key constraint 'ciphers_collections_ibfk_2' of table 'vaultwarden.ciphers_collections'
ERROR 1832 (HY000) at line 7 in file: '/tmp/migration.sql': Cannot change column 'user_uuid': used in a foreign key constraint 'devices_ibfk_1'
ERROR 1832 (HY000) at line 8 in file: '/tmp/migration.sql': Cannot change column 'grantor_uuid': used in a foreign key constraint 'emergency_access_ibfk_1'
ERROR 1832 (HY000) at line 9 in file: '/tmp/migration.sql': Cannot change column 'user_uuid': used in a foreign key constraint 'favorites_ibfk_1'
ERROR 1832 (HY000) at line 10 in file: '/tmp/migration.sql': Cannot change column 'cipher_uuid': used in a foreign key constraint 'folders_ciphers_ibfk_1'
ERROR 1833 (HY000) at line 11 in file: '/tmp/migration.sql': Cannot change column 'uuid': used in a foreign key constraint 'folders_ciphers_ibfk_2' of table 'vaultwarden.folders_ciphers'
Query OK, 0 rows affected (0.004 sec)
Records: 0  Duplicates: 0  Warnings: 0

ERROR 1832 (HY000) at line 13 in file: '/tmp/migration.sql': Cannot change column 'org_uuid': used in a foreign key constraint 'org_policies_ibfk_1'
ERROR 1833 (HY000) at line 14 in file: '/tmp/migration.sql': Cannot change column 'uuid': used in a foreign key constraint 'auth_requests_ibfk_2' of table 'vaultwarden.auth_requests'
ERROR 1832 (HY000) at line 15 in file: '/tmp/migration.sql': Cannot change column 'user_uuid': used in a foreign key constraint 'sends_ibfk_1'
ERROR 1832 (HY000) at line 16 in file: '/tmp/migration.sql': Cannot change column 'user_uuid': used in a foreign key constraint 'twofactor_incomplete_ibfk_1'
ERROR 1832 (HY000) at line 17 in file: '/tmp/migration.sql': Cannot change column 'user_uuid': used in a foreign key constraint 'twofactor_ibfk_1'
ERROR 1832 (HY000) at line 18 in file: '/tmp/migration.sql': Cannot change column 'user_uuid': used in a foreign key constraint 'users_collections_ibfk_1'
ERROR 1833 (HY000) at line 19 in file: '/tmp/migration.sql': Cannot change column 'uuid': used in a foreign key constraint 'groups_users_ibfk_2' of table 'vaultwarden.groups_users'
ERROR 1833 (HY000) at line 20 in file: '/tmp/migration.sql': Cannot change column 'uuid': used in a foreign key constraint 'auth_requests_ibfk_1' of table 'vaultwarden.auth_requests'
Query OK, 0 rows affected (0.000 sec)

Looks like you are running in into Jira

I would say:

  • dump the database without schema
  • purge the database (remove all tables)
  • set the charset/collation correctly on the database
  • start Vaultwarden to let the tables to be created
  • import the data again.

Thanks BlackDex! It appears to be working now. I wish there was a way in the Bitwarden app so I could see all entries listed by date and see if anything got missed, but It seems it’s all there.

Here’s the procedure I used in case this helps other people:

  • dump the database without schema
mkdir /root/repair
cd /root/repair
mysqldump --no-create-info -u root vaultwarden > ./vaultwarden-noschema.sql
  • purge the database (remove all tables)
    # mysql
    In mysql run this:
SELECT table_name
FROM information_schema.tables
WHERE table_schema = 'vaultwarden';

MariaDB [(none)]> SELECT table_name
    -> FROM information_schema.tables
    -> WHERE table_schema = 'vaultwarden';
+----------------------------+
| table_name                 |
+----------------------------+
| twofactor                  |
| users_collections          |
| organizations              |
| sends                      |
| attachments                |
| ciphers                    |
| ciphers_collections        |
| twofactor_incomplete       |
| organization_api_key       |
| users_organizations        |
| groups_users               |
| users                      |
| groups                     |
| twofactor_duo_ctx          |
| event                      |
| collections                |
| collections_groups         |
| emergency_access           |
| folders                    |
| auth_requests              |
| invitations                |
| favorites                  |
| devices                    |
| org_policies               |
| __diesel_schema_migrations |
| folders_ciphers            |
+----------------------------+

connect vaultwarden
SET foreign_key_checks = 0;
DROP TABLE twofactor;
DROP TABLE users_collections;
DROP TABLE organizations;
DROP TABLE sends;
DROP TABLE attachments;
DROP TABLE ciphers;
DROP TABLE ciphers_collections;
DROP TABLE twofactor_incomplete;
DROP TABLE organization_api_key;
DROP TABLE users_organizations;
DROP TABLE groups_users;
DROP TABLE users;
DROP TABLE groups;
DROP TABLE twofactor_duo_ctx;
DROP TABLE event;
DROP TABLE collections;
DROP TABLE collections_groups;
DROP TABLE emergency_access;
DROP TABLE folders;
DROP TABLE auth_requests;
DROP TABLE invitations;
DROP TABLE favorites;
DROP TABLE devices;
DROP TABLE org_policies;
DROP TABLE __diesel_schema_migrations;
DROP TABLE folders_ciphers;

SET foreign_key_checks = 1;

ALTER DATABASE vaultwarden CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

USE vaultwarden; SELECT @@character_set_database, @@collation_database;
Database changed
+--------------------------+----------------------+
| @@character_set_database | @@collation_database |
+--------------------------+----------------------+
| utf8mb4                  | utf8mb4_unicode_ci   |
+--------------------------+----------------------+
1 row in set (0.000 sec)


\q
  • start Vaultwarden to let the tables to be created
    systemctl restart vaultwarden
    Verified that vaultwarden web runs now…
    Back to mysql
    mysql
    Restore the table data
connect vaultwarden
SELECT table_name
FROM information_schema.tables
WHERE table_schema = 'vaultwarden';

+----------------------------+
| table_name                 |
+----------------------------+
| twofactor                  |
| users_collections          |
| organizations              |
| sends                      |
| attachments                |
| ciphers                    |
| ciphers_collections        |
| twofactor_incomplete       |
| organization_api_key       |
| users_organizations        |
| groups_users               |
| users                      |
| groups                     |
| twofactor_duo_ctx          |
| event                      |
| collections                |
| collections_groups         |
| emergency_access           |
| folders                    |
| auth_requests              |
| invitations                |
| favorites                  |
| devices                    |
| org_policies               |
| __diesel_schema_migrations |
| folders_ciphers            |
+----------------------------+
26 rows in set (0.001 sec)

use vaultwarden;
source /root/repair/vaultwarden-noschema.sql;

MariaDB [(none)]> use vaultwarden;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
MariaDB [vaultwarden]> source /root/repair/vaultwarden-noschema.sql;
Query OK, 0 rows affected (0.001 sec)
SNIP
Query OK, 0 rows affected (0.000 sec)
Query OK, 0 rows affected (0.000 sec)
Query OK, 0 rows affected (0.000 sec)
ERROR 1062 (23000) at line 23 in file: '/root/repair/vaultwarden-noschema.sql': Duplicate entry '20180114171611' for key 'PRIMARY'
Query OK, 0 rows affected (0.000 sec)
Query OK, 0 rows affected (0.000 sec)
SNIP
Query OK, 986 rows affected (0.115 sec)
Records: 986  Duplicates: 0  Warnings: 0
Query OK, 0 rows affected (0.000 sec)
SNIP 
Query OK, 516 rows affected (0.016 sec)
Records: 516  Duplicates: 0  Warnings: 0
Query OK, 0 rows affected (0.000 sec)
SNIP
Query OK, 73 rows affected (0.003 sec)
Records: 73  Duplicates: 0  Warnings: 0
Query OK, 0 rows affected (0.000 sec)
SNIP
Query OK, 70 rows affected (0.003 sec)
Records: 70  Duplicates: 0  Warnings: 0
Query OK, 0 rows affected (0.000 sec)
SNIP
Query OK, 76 rows affected (0.005 sec)
Records: 76  Duplicates: 0  Warnings: 0
Query OK, 0 rows affected (0.000 sec)
SNIP
Query OK, 9 rows affected (0.001 sec)
Records: 9  Duplicates: 0  Warnings: 0
Query OK, 0 rows affected (0.000 sec)
SNIP
Query OK, 74 rows affected (0.003 sec)
Records: 74  Duplicates: 0  Warnings: 0
Query OK, 0 rows affected (0.000 sec)
SNIP
Query OK, 6 rows affected (0.001 sec)
Records: 6  Duplicates: 0  Warnings: 0
Query OK, 0 rows affected (0.000 sec)
SNIP
Query OK, 15 rows affected (0.001 sec)
Records: 15  Duplicates: 0  Warnings: 0
Query OK, 0 rows affected (0.000 sec)
SNIP
Query OK, 9 rows affected (0.003 sec)
Records: 9  Duplicates: 0  Warnings: 0
Query OK, 0 rows affected (0.000 sec)
SNIP
Query OK, 5 rows affected (0.001 sec)
Records: 5  Duplicates: 0  Warnings: 0
Query OK, 0 rows affected (0.000 sec)
SNIP
Query OK, 0 rows affected (0.000 sec)

\q

Restart Vaultwarden
systemctl restart vaultwarden
Logged in and everything seems to be OK.

1 Like

Glad it works!

And thanks!