marius-wieschollek / passwords

A simple, yet feature rich password manager for Nextcloud
GNU Affero General Public License v3.0
215 stars 45 forks source link

Failing to enable password module #398

Closed gcclinux closed 2 years ago

gcclinux commented 3 years ago

Hello,

This is the 3rd time I am writing about this issue after the upgrade, the first time it was closed due to duplicate ticket, then the second was closed with not fix, so here I am again, I can't access my passwords, please help.

` I am still seeing the same error, has there been any more updates that I missed?

$ sudo -u www-data php occ app:enable passwords An exception occurred while executing a query: SQLSTATE[42P07]: Duplicate table: 7 ERROR: `

marius-wieschollek commented 3 years ago

I would suspect that you might be affected by this too: https://github.com/marius-wieschollek/passwords/issues/397#issuecomment-875707052 .

If not please fill out the entire bug report form and we treat this as a separate issue.

marius-wieschollek commented 3 years ago

Does this issue persist with 2021.7.2?

johannes-schliephake commented 3 years ago

I'm experiencing issues that look quite similar.

System Information

Server: Nextcloud Version: 21.0.3 PHP Version: 7.4.3 Database and Version: MySQL 8.0.25 Server OS and Version: Ubuntu 20.04.2 Passwords Version: 2021.7.22 and 2021.7.23-build4219

Steps to reproduce

Install the update from 2021.7.21 to 2021.7.22 or 2021.7.23-build4219 (both via app store and manual install).

Actual result

The update fails and Passwords is disabled afterwards. Error message: An exception occurred while executing a query: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '' for key 'oc_passwords_share.pw_index_share'

Nextcloud log

Nextcloud log {"reqId":"SC5bGj2Ao91JoGTWxhbs","level":3,"time":"2021-07-16T20:38:28+00:00","remoteAddr":"...","user":"admin","app":"settings","method":"POST","url":"/index.php/settings/apps/enable","message":{"Exception":"Doctrine\\DBAL\\Exception\\UniqueConstraintViolationException","Message":"An exception occurred while executing a query: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '' for key 'oc_passwords_share.pw_index_share'","Code":1062,"Trace":[{"file":"/var/www/owncloud/3rdparty/doctrine/dbal/src/Connection.php","line":1728,"function":"convert","class":"Doctrine\\DBAL\\Driver\\API\\MySQL\\ExceptionConverter","type":"->"},{"file":"/var/www/owncloud/3rdparty/doctrine/dbal/src/Connection.php","line":1667,"function":"handleDriverException","class":"Doctrine\\DBAL\\Connection","type":"->"},{"file":"/var/www/owncloud/3rdparty/doctrine/dbal/src/Connection.php","line":1040,"function":"convertExceptionDuringQuery","class":"Doctrine\\DBAL\\Connection","type":"->"},{"file":"/var/www/owncloud/lib/private/DB/Connection.php","line":226,"function":"executeQuery","class":"Doctrine\\DBAL\\Connection","type":"->"},{"file":"/var/www/owncloud/3rdparty/doctrine/dbal/src/Connection.php","line":1757,"function":"executeQuery","class":"OC\\DB\\Connection","type":"->"},{"file":"/var/www/owncloud/lib/private/DB/Migrator.php","line":256,"function":"query","class":"Doctrine\\DBAL\\Connection","type":"->"},{"file":"/var/www/owncloud/lib/private/DB/Migrator.php","line":90,"function":"applySchema","class":"OC\\DB\\Migrator","type":"->"},{"file":"/var/www/owncloud/lib/private/DB/Connection.php","line":524,"function":"migrate","class":"OC\\DB\\Migrator","type":"->"},{"file":"/var/www/owncloud/lib/private/DB/MigrationService.php","line":464,"function":"migrateToSchema","class":"OC\\DB\\Connection","type":"->"},{"file":"/var/www/owncloud/lib/private/DB/MigrationService.php","line":418,"function":"migrateSchemaOnly","class":"OC\\DB\\MigrationService","type":"->"},{"file":"/var/www/owncloud/lib/private/Installer.php","line":163,"function":"migrate","class":"OC\\DB\\MigrationService","type":"->"},{"file":"/var/www/owncloud/apps/settings/lib/Controller/AppSettingsController.php","line":448,"function":"installApp","class":"OC\\Installer","type":"->"},{"file":"/var/www/owncloud/lib/private/AppFramework/Http/Dispatcher.php","line":218,"function":"enableApps","class":"OCA\\Settings\\Controller\\AppSettingsController","type":"->"},{"file":"/var/www/owncloud/lib/private/AppFramework/Http/Dispatcher.php","line":127,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/owncloud/lib/private/AppFramework/App.php","line":157,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/owncloud/lib/private/Route/Router.php","line":302,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/var/www/owncloud/lib/base.php","line":993,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/var/www/owncloud/index.php","line":37,"function":"handleRequest","class":"OC","type":"::"}],"File":"/var/www/owncloud/3rdparty/doctrine/dbal/src/Driver/API/MySQL/ExceptionConverter.php","Line":60,"Previous":{"Exception":"Doctrine\\DBAL\\Driver\\PDO\\Exception","Message":"SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '' for key 'oc_passwords_share.pw_index_share'","Code":1062,"Trace":[{"file":"/var/www/owncloud/3rdparty/doctrine/dbal/src/Driver/PDO/Connection.php","line":87,"function":"new","class":"Doctrine\\DBAL\\Driver\\PDO\\Exception","type":"::"},{"file":"/var/www/owncloud/3rdparty/doctrine/dbal/src/Connection.php","line":1035,"function":"query","class":"Doctrine\\DBAL\\Driver\\PDO\\Connection","type":"->"},{"file":"/var/www/owncloud/lib/private/DB/Connection.php","line":226,"function":"executeQuery","class":"Doctrine\\DBAL\\Connection","type":"->"},{"file":"/var/www/owncloud/3rdparty/doctrine/dbal/src/Connection.php","line":1757,"function":"executeQuery","class":"OC\\DB\\Connection","type":"->"},{"file":"/var/www/owncloud/lib/private/DB/Migrator.php","line":256,"function":"query","class":"Doctrine\\DBAL\\Connection","type":"->"},{"file":"/var/www/owncloud/lib/private/DB/Migrator.php","line":90,"function":"applySchema","class":"OC\\DB\\Migrator","type":"->"},{"file":"/var/www/owncloud/lib/private/DB/Connection.php","line":524,"function":"migrate","class":"OC\\DB\\Migrator","type":"->"},{"file":"/var/www/owncloud/lib/private/DB/MigrationService.php","line":464,"function":"migrateToSchema","class":"OC\\DB\\Connection","type":"->"},{"file":"/var/www/owncloud/lib/private/DB/MigrationService.php","line":418,"function":"migrateSchemaOnly","class":"OC\\DB\\MigrationService","type":"->"},{"file":"/var/www/owncloud/lib/private/Installer.php","line":163,"function":"migrate","class":"OC\\DB\\MigrationService","type":"->"},{"file":"/var/www/owncloud/apps/settings/lib/Controller/AppSettingsController.php","line":448,"function":"installApp","class":"OC\\Installer","type":"->"},{"file":"/var/www/owncloud/lib/private/AppFramework/Http/Dispatcher.php","line":218,"function":"enableApps","class":"OCA\\Settings\\Controller\\AppSettingsController","type":"->"},{"file":"/var/www/owncloud/lib/private/AppFramework/Http/Dispatcher.php","line":127,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/owncloud/lib/private/AppFramework/App.php","line":157,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/owncloud/lib/private/Route/Router.php","line":302,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/var/www/owncloud/lib/base.php","line":993,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/var/www/owncloud/index.php","line":37,"function":"handleRequest","class":"OC","type":"::"}],"File":"/var/www/owncloud/3rdparty/doctrine/dbal/src/Driver/PDO/Exception.php","Line":26,"Previous":{"Exception":"PDOException","Message":"SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '' for key 'oc_passwords_share.pw_index_share'","Code":"23000","Trace":[{"file":"/var/www/owncloud/3rdparty/doctrine/dbal/src/Driver/PDO/Connection.php","line":82,"function":"query","class":"PDO","type":"->"},{"file":"/var/www/owncloud/3rdparty/doctrine/dbal/src/Connection.php","line":1035,"function":"query","class":"Doctrine\\DBAL\\Driver\\PDO\\Connection","type":"->"},{"file":"/var/www/owncloud/lib/private/DB/Connection.php","line":226,"function":"executeQuery","class":"Doctrine\\DBAL\\Connection","type":"->"},{"file":"/var/www/owncloud/3rdparty/doctrine/dbal/src/Connection.php","line":1757,"function":"executeQuery","class":"OC\\DB\\Connection","type":"->"},{"file":"/var/www/owncloud/lib/private/DB/Migrator.php","line":256,"function":"query","class":"Doctrine\\DBAL\\Connection","type":"->"},{"file":"/var/www/owncloud/lib/private/DB/Migrator.php","line":90,"function":"applySchema","class":"OC\\DB\\Migrator","type":"->"},{"file":"/var/www/owncloud/lib/private/DB/Connection.php","line":524,"function":"migrate","class":"OC\\DB\\Migrator","type":"->"},{"file":"/var/www/owncloud/lib/private/DB/MigrationService.php","line":464,"function":"migrateToSchema","class":"OC\\DB\\Connection","type":"->"},{"file":"/var/www/owncloud/lib/private/DB/MigrationService.php","line":418,"function":"migrateSchemaOnly","class":"OC\\DB\\MigrationService","type":"->"},{"file":"/var/www/owncloud/lib/private/Installer.php","line":163,"function":"migrate","class":"OC\\DB\\MigrationService","type":"->"},{"file":"/var/www/owncloud/apps/settings/lib/Controller/AppSettingsController.php","line":448,"function":"installApp","class":"OC\\Installer","type":"->"},{"file":"/var/www/owncloud/lib/private/AppFramework/Http/Dispatcher.php","line":218,"function":"enableApps","class":"OCA\\Settings\\Controller\\AppSettingsController","type":"->"},{"file":"/var/www/owncloud/lib/private/AppFramework/Http/Dispatcher.php","line":127,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/owncloud/lib/private/AppFramework/App.php","line":157,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/owncloud/lib/private/Route/Router.php","line":302,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/var/www/owncloud/lib/base.php","line":993,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/var/www/owncloud/index.php","line":37,"function":"handleRequest","class":"OC","type":"::"}],"File":"/var/www/owncloud/3rdparty/doctrine/dbal/src/Driver/PDO/Connection.php","Line":82}},"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:90.0) Gecko/20100101 Firefox/90.0","version":"21.0.3.1","id":"60f1f02a4592d"}

Thanks for looking into it!

marius-wieschollek commented 3 years ago

@johannes-schliephake In your case it seems more like an issue when moving the share information for passwords.

Can you check if the old table passwords_entity_share has any entry without uuid?

johannes-schliephake commented 3 years ago

That table is not present anymore. The database only holds the new tables you listed in another issue.

marius-wieschollek commented 3 years ago

do you have a recent backup?

johannes-schliephake commented 3 years ago

Yes, but it's a bit of a pain to restore (it's a backup of the entire database). If you just want me to check the UUIDs it's easier.

marius-wieschollek commented 3 years ago

If you could check that it would be good. Then i can at least fix the issue for the next to run into it.

But also after shares, the passwords_entity_tag, passwords_entity_tag_revision, passwords_relation_password_tag are copied, so you might want to restore some of the tables to fix this.

johannes-schliephake commented 3 years ago

Ok, so the latest backup of 2021.7.21 did not contain the entity tables either. Upgrading from the backup 2021.7.21 to 2021.7.23 did work however.