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?