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

Integrity check fails on PostgreSqlSchemaManager.php with latest version 12.0.4 #7549

Closed
BambooVolt opened this issue Dec 17, 2017 · 5 comments

Comments

@BambooVolt
Copy link

Steps to reproduce

  1. Update your installation to 12.0.4 (I had 12.0.3 beforehand) - I used pkg update -f && pkg upgrade
  2. Run the nextcloud update process - I used the recommended method:
  • cd /usr/local/www/nextcloud
  • su -m www -c "php ./occ upgrade"
    No errors were reported - in fact near the end I see the below (which indicates to me no errors were found?)
Starting code integrity check...
Finished code integrity check
Update successful
Turned off maintenance mode
Reset log level
  1. However, upon logging into nextcloud I see a message (top of screen) that integrity check has failed. Listing the invalid files only shows the one - PostgreSqlSchemaManager.php - with a sha512 hash like so (confirmed using sha512 from command line):
    5839a5ca8dacedb7eb8ab40e9025614a042741557346ddd228f3e0aa38a6bb352226c59b3b429057651ad6c58ba20f69a4049178c39aedf7a9a7c462faa042d4

Expected behaviour

Hashes are updated with the upgrade so they actually match the installed files, and thus the integrity check should succeed.

Actual behaviour

The integrity check fails as the hash for PostgreSqlSchemaManager.php is not correct.

The 'expected' hash is:
9c9a80a71990dc784914780024b780189f7f68d38ee98f49439d5db9adce290d1105a17fb8a670090fa92b65760775fb942bc3060b368bf16b82702fa2d5f9f2

...which is clearly wrong and does not match the file installed.

Server configuration

Operating system:
FreeBSD 11.1-RELEASE-p1 #0 r323888M

Web server:
nginx-1.12.2_3,2

Database:
sqlite3-3.21.0_1

PHP version:
php56-5.6.32_1

Nextcloud version: (see Nextcloud admin page)
nextcloud-12.0.4

Updated from an older Nextcloud/ownCloud or fresh install:
Upgrade from 12.0.3

Where did you install Nextcloud from:
FreeBSD packages

Signing status:

Signing status
Login as admin user into your Nextcloud and access 
http://example.com/index.php/settings/integrity/failed 
paste the results here.

Technical information

The following list covers which files have failed the integrity check. Please read
the previous linked documentation to learn more about the errors and how to fix
them.

Results

  • core
    • INVALID_HASH
      • 3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Schema/PostgreSqlSchemaManager.php

Raw output

Array
(
[core] => Array
(
[INVALID_HASH] => Array
(
[3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Schema/PostgreSqlSchemaManager.php] => Array
(
[expected] => 9c9a80a71990dc784914780024b780189f7f68d38ee98f49439d5db9adce290d1105a17fb8a670090fa92b65760775fb942bc3060b368bf16b82702fa2d5f9f2
[current] => 5839a5ca8dacedb7eb8ab40e9025614a042741557346ddd228f3e0aa38a6bb352226c59b3b429057651ad6c58ba20f69a4049178c39aedf7a9a7c462faa042d4
)

            )

    )

)

List of activated apps:

App list
If you have access to your command line run e.g.:
sudo -u www-data php occ app:list
from within your Nextcloud installation folder

Enabled:

  • activity: 2.5.2
  • comments: 1.2.0
  • dav: 1.3.0
  • federatedfilesharing: 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
  • logreader: 2.0.0
  • lookup_server_connector: 1.0.0
  • notifications: 2.0.0
  • oauth2: 1.0.5
  • password_policy: 1.2.2
  • provisioning_api: 1.2.0
  • serverinfo: 1.2.0
  • systemtags: 1.2.0
  • theming: 1.3.0
  • twofactor_backupcodes: 1.1.1
  • updatenotification: 1.2.0
  • workflowengine: 1.2.0
    Disabled:
  • admin_audit
  • bruteforcesettings
  • calendar
  • checksum
  • contacts
  • documents
  • encryption
  • federation
  • files_external
  • nextcloud_announcements
  • sharebymail
  • survey_client
  • user_external
  • user_ldap

Nextcloud configuration:

Config report
If you have access to your command line run e.g.:
sudo -u www-data php occ config:list system
from within your Nextcloud installation folder

or 

Insert your config.php content here. 
Make sure to remove all sensitive content such as passwords. (e.g. database password, passwordsalt, secret, smtp password, …)

{
"system": {
"datadirectory": "/media",
"instanceid": "xxxxxxxxxxxxxxxxxx",
"passwordsalt": "REMOVED SENSITIVE VALUE",
"trusted_domains": [
"A.A.A.A",
"A.DNS.NAME",
"B.B.B.B",
"C.C.C.C",
"Another.DNS.NAME"
],
"trusted_proxies": [
"A.A.A.A",
"B.B.B.B",
"C.C.C.C"
],
"dbtype": "sqlite",
"dbname": "nextcloud",
"version": "12.0.4.3",
"installed": true,
"updatechecker": true,
"forcessl": false,
"theme": "",
"loglevel": 0,
"maintenance": false,
"secret": "REMOVED SENSITIVE VALUE",
"trashbin_retention_obligation": "auto",
"appstoreenabled": true,
"overwrite.cli.url": "https://the.server.dns.name:port",
"proxy": "X.X.X.X:Y"
}
}

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

Client configuration

Browser:
Firefox

Operating system:
Ubuntu

Logs

Web server error log

Web server error log

No errros in the past month

Nextcloud log (data/nextcloud.log)

Nextcloud log

Nothing relevant

@MorrisJobke
Copy link
Member

Could you check that the file has the exact same content as https://github.com/nextcloud/3rdparty/blob/v12.0.4/doctrine/dbal/lib/Doctrine/DBAL/Schema/PostgreSqlSchemaManager.php

Could you send over this file?

What exactly is shown in http://example.com/index.php/settings/integrity/failed

@BambooVolt
Copy link
Author

BambooVolt commented Dec 19, 2017

  1. They differ: I downloaded the source from here into the current directory and diffed it to the installed version, thus:
diff PostgreSqlSchemaManager.php /usr/local/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine

/DBAL/Schema/PostgreSqlSchemaManager.php
292c292,301
<         $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));
>         }
> //        $data = $this->_conn->fetchAll('SELECT min_value, increment_by FROM ' . $this->_platform->quoteIdentifier($sequenceName));
  1. My copy of the file cannot be uploaded - I repeatedly get the error from GitHub: in red "Something went really wrong, (sic) and we can't process that file. (End red, now in blue) Try again."
    Fails over and over, I'm not wasting my time any more trying. The diff should suffice.

  2. Expand the signing status arrow in the first post to see what is exactly shown.

EDIT: To add: It looks like it was a change for PosgrSQL10 - in the diff
if ($version >= 10) {....

@MorrisJobke
Copy link
Member

But 12.0.4 is not compatible to Postgres 10. Did you patched this in? Please drop the lines and re-run the integrity check from the CLI or the admin settings. It should then be fine.

@MorrisJobke
Copy link
Member

I will close this, as this looks like a patched instance and this is actually the wanted behaviour. It should detect if the code is not the original released one.

@BambooVolt
Copy link
Author

BambooVolt commented Dec 20, 2017

@MorrisJobke
Found the source/issue here in the FreeBSD port - it has been updated by the port maintainer with the comment "www/nextcloud: Update to 12.0.4 - Include upstream PostgreSQL fix". No mention that it breaks the integrity check here (read on).

https://svnweb.freebsd.org/ports/head/www/nextcloud/files/patch-3rdparty_doctrine_dbal_lib_Doctrine_DBAL_Schema_PostgreSqlSchemaManager.php?revision=456283&view=markup

Further the bug has already been filed:
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=224393

I rolled back my version to match the repo and all is good => integrity check passes.

Apologies for any confusion.

For any others reading this, it's the FreeBSD port that is broken - it has a modified PostgreSqlSchemaManager.php with an incorrect checksum in signatures.json

Many Thanks

Edits: Typos, additional link from bugs.freebsd.org

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

2 participants