Skip to content
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

Upgrade to latest 2FA fails with database exception #7024

Closed
heldchen opened this issue Oct 31, 2017 · 3 comments
Closed

Upgrade to latest 2FA fails with database exception #7024

heldchen opened this issue Oct 31, 2017 · 3 comments

Comments

@heldchen
Copy link

heldchen commented Oct 31, 2017

Steps to reproduce

  1. update 2fa plugin via in-browser app update

Expected behaviour

updating 2fa plugin works

Actual behaviour

updating twofactor_u2f plugin fails, then nextcloud falls back to update/maintenance mode, where further update attempts fail again.

Preparing update
Set log level to debug
Turned on maintenance mode
Doctrine\DBAL\Exception\InvalidFieldNameException: An exception occurred while executing 'SELECT min_value, increment_by FROM "activity_activity_id_seq"': SQLSTATE[42703]: Undefined column: 7 ERROR: column "min_value" does not exist LINE 1: SELECT min_value, increment_by FROM "activity_activity_id_se... ^
The update was unsuccessful. Please report this issue to the Nextcloud community.

the specified column does not exist. here's what SELECT * FROM activity_activity_id_seq; actually returns:

services_nextcloud@lannik:/var/www/users/services_nextcloud/src/current/data$ psql
psql (10.0)
Type "help" for help.

services_nextcloud=> select * FROM activity_activity_id_seq;
 last_value | log_cnt | is_called
------------+---------+-----------
        354 |      31 | t
(1 row)

Server configuration

Operating system:
debian 9

Web server:
apache 2.4

Database:
postgresql 10

PHP version:
7.1

Nextcloud version: (see Nextcloud admin page)
12.0.3

Updated from an older Nextcloud/ownCloud or fresh install:
n/a (plugin related)

Where did you install Nextcloud from:
n/a (plugin related)

Signing status:
unable to gather this information as the instance is now in maintenance mode and cannot be reactivated.

List of activated apps:

App list

Enabled:

  • activity: 2.5.2
  • bruteforcesettings: 1.0.2
  • calendar: 1.5.6
  • comments: 1.2.0
  • contacts: 2.0.1
  • dav: 1.3.0
  • federatedfilesharing: 1.2.0
  • federation: 1.2.0
  • files: 1.7.2
  • files_pdfviewer: 1.1.1
  • files_sharing: 1.4.0
  • files_texteditor: 2.4.1
  • files_trashbin: 1.2.0
  • files_versions: 1.5.0
  • files_videoplayer: 1.1.0
  • firstrunwizard: 2.1
  • gallery: 17.0.0
  • groupfolders: 1.1.0
  • logreader: 2.0.0
  • lookup_server_connector: 1.0.0
  • nextcloud_announcements: 1.1
  • notes: 2.3.1
  • notifications: 2.0.0
  • oauth2: 1.0.5
  • password_policy: 1.2.2
  • provisioning_api: 1.2.0
  • serverinfo: 1.2.0
  • sharebymail: 1.2.0
  • socialsharing_email: 1.0.1
  • systemtags: 1.2.0
  • tasks: 0.9.5
  • theming: 1.3.0
  • twofactor_backupcodes: 1.1.1
  • twofactor_totp: 1.3.1
  • twofactor_u2f: 1.3.3
  • updatenotification: 1.2.0
  • workflowengine: 1.2.0
    Disabled:
  • admin_audit
  • encryption
  • files_external
  • survey_client
  • user_external
  • user_ldap

Nextcloud configuration:

Config report Nextcloud or one of the apps require upgrade - only a limited number of commands are available You may use your browser or the occ upgrade command to do the upgrade { "system": { "instanceid": "octfc7x2vjbz", "passwordsalt": "***REMOVED SENSITIVE VALUE***", "secret": "***REMOVED SENSITIVE VALUE***", "trusted_domains": [ "docs.services.mydomain.com" ], "datadirectory": "\/var\/www\/users\/services_nextcloud\/data\/store", "overwrite.cli.url": "https:\/\/docs.services.mydomain.com\/", "dbtype": "pgsql", "version": "12.0.3.3", "dbname": "services_nextcloud", "dbhost": "localhost", "dbport": "", "dbtableprefix": "", "dbuser": "***REMOVED SENSITIVE VALUE***", "dbpassword": "***REMOVED SENSITIVE VALUE***", "installed": true, "htaccess.RewriteBase": "\/", "memcache.local": "\\OC\\Memcache\\APCu", "mail_from_address": "docs", "mail_domain": "mydomain.com", "maintenance": false, "theme": "", "loglevel": 2 } }

Are you using external storage, if yes which one: local/smb/sftp/...
no

Are you using encryption: yes/no
no

Are you using an external user-backend, if yes which one: LDAP/ActiveDirectory/Webdav/...
no

Nextcloud log (data/nextcloud.log)

Nextcloud log empty log
@nickvergessen
Copy link
Member

nickvergessen commented Oct 31, 2017

Sorry postgres 10 is currently not supported by Doctrine/DBAL: #5930

@Siassei
Copy link

Siassei commented Dec 13, 2017

@nickvergessen
I can not find any note in the offical documantation, that tell me postgres 10 is not supported with nextcloud 12! wtf ...

Offical documentation

https://docs.nextcloud.com/server/12/admin_manual/installation/system_requirements.html#supported-platforms

Offical docker-compose.yml without version numbers. posgres:latest is atm 10.1
https://github.com/nextcloud/docker/blob/master/.examples/docker-compose/insecure/postgres/apache/docker-compose.yml

@heldchen
Copy link
Author

uhm the first link you posted does say:

PostgreSQL 9.x (10 is supported with Nextcloud 13+);

I'm using this patch on my installations to get v12 work with postgresql 10:

patch -b -p 1 << 'DELIM'
--- a/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Schema/PostgreSqlSchemaManager.php
+++ b/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Schema/PostgreSqlSchemaManager.php
@@ -289,7 +289,13 @@
             $sequenceName = $sequence['relname'];
         }
 
-        $data = $this->_conn->fetchAll('SELECT min_value, increment_by FROM ' . $this->_platform->quoteIdentifier($sequenceName));
+        $version = floatval($this->_conn->getWrappedConnection()->getServerVersion());
+
+        if ($version >= 10) {
+           $data = $this->_conn->fetchAll('SELECT min_value, increment_by FROM pg_sequences WHERE schemaname = \'public\' AND sequencename = '.$this->_conn->quote($sequenceName));
+        } else {
+            $data = $this->_conn->fetchAll('SELECT min_value, increment_by FROM ' . $this->_platform->quoteIdentifier($sequenceName));
+        }
 
         return new Sequence($sequenceName, $data[0]['increment_by'], $data[0]['min_value']);
     }
'
DELIM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants