Upgrading from 15.0.7 to 16.0.1 - Verifying Integrity fails

Nextcloud version: 15.0.7 (On the stable release cycle)
Operating system and version: Linux (shared hosting - distibution not certain - Debian I think)
Apache or nginx version: Apache (shared hosting - version not available to me)
PHP version: 7.2

The issue you are facing: Updating to version 16.0.1. When using the web based updater step 5 fails with the error: Verifying integrity - Parsing response failed.

Is this the first time you’ve seen this error?: Y

Steps to replicate it:

  1. Go to Settings / Overview / Open updater
  2. Installation fails at step 5 - as described above

The output of your Nextcloud log in Admin > Logging:

Error	PHP	opendir(/tmp): failed to open dir: Permission denied at /home/site/www/cloud/lib/private/TempManager.php#190

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!): I don’t have a /path/to/nextcloud/config.php file. I do have a /path/to/nextcloud/config/config.php file but much of the information in is stuff I would prefer not to publish. Let me know if there are particular lines I should post.

The output of your Apache/nginx/system log in: not available - shared hosting

Extra information:
Line 190 of the file refered to in the error log file reads:

$dh = opendir($this->tmpBaseDir);

The code line 190 is part of is here:

	/**
	 * Get all temporary files and folders generated by oc older than an hour
	 *
	 * @return string[]
	 */
	protected function getOldFiles() {
		$cutOfTime = time() - 3600;
		$files = [];
		$dh = opendir($this->tmpBaseDir);
		if ($dh) {
			while (($file = readdir($dh)) !== false) {
				if (substr($file, 0, 7) === self::TMP_PREFIX) {
					$path = $this->tmpBaseDir . '/' . $file;
					$mtime = filemtime($path);
					if ($mtime < $cutOfTime) {
						$files[] = $path;
					}
				}
			}
		}
		return $files;
	}

I do not have a ‘tmp’ folder at the root level of my site. If I create a ‘tmp’ folder at the root level it causes an ‘unexpected folder’ error in the installer at step 2.

I tried adding 'integrity.check.disabled' => true to /config/config.php and re-running the updater but got the same error. It might be worth noting that there was not a line that read 'integrity.check.disabled' => false in the config file before I did this. I’m not sure if there should be?

Any suggestions will be gratefully received.

Try this config setting to change the location of the tmp folder (unless you’ve done it already):

 * Override where Nextcloud stores temporary files. Useful in situations where
 * the system temporary directory is on a limited space ramdisk or is otherwise
 * restricted, or if external storages which do not support streaming are in
 * use.
 *
 * The Web server user must have write access to this directory.
 */
'tempdirectory' => '/tmp/nextcloudtemp'

Thank you for the suggestion. However, if I create the /tmp/nextcloud directory (writable), even with that line in my config file, I still get an error that reads:

Check for expected files
The following extra files have been found:

  • tmp

hmm then I don’t know - maybe it doesn’t work to change tempdirectory during upgrade. But I assume it had a working tmp folder before, so it’s a bit odd you get that permission error in the first place. But I’m out of ideas, maybe check if PHP set another tmp folder or something.

1 Like

Thanks for the help.

For the moment I have done the following.

  1. Switched to the ‘Production’ release cycle.
  2. Updated from 15.0.7 to 15.0.8.1 - interestingly this update worked OK
  3. Tried to update from 15.0.8.1 to 16.0.1 - this failed.

So I will stay on 15.0.8.1 for the moment and see if the forthcoming 16.0.2 release works.

1 Like

Hi,
I have just identified the issue.
I have nextcloud running on a webspace hoster with a very limited amount of memory (64 MB).
In this setup the function openssl_verify() within updater/index.php crashes (within class “Auth”, function “verifyIntegrity” )
The openssl_verify checks this full nextcloud zip file in memory. This needs more than the available 64 MB and that’s why it crashes.
You may modify the updater/index.php to skip the openssl_verify…
However this is unsecure…
Is there any method available that allows to check the file integrity with less memory usage? That would be great.

Best regards

Mathias

As a follow up.

  1. Whilst on the ‘Production’ release cycle I updated to 15.0.9.
  2. Then I switched to the ‘Stable’ release cycle, which offered the 16.0.2 update.
  3. Successfully updated to 16.0.2 without any issues.

Moin,

I was trying to run an update (Web updater) from 16.0.1. to 16.0.3. Ran into same issue as @andytough
NextCloud is running on a webspace hoster (all-inkl) and i don‘t have shell access.

None of the described solutions did do it unfortunately.

Maybe it‘s the memory issue @mknext mentioned. But there is nothing I can do about that.

Any ideas?

Thanks a lot!

Please check what the php memory_limit is that you have (you can show this via the phpinfo() command). With my provider I was able to increase the memory limit via .htaccess:

I entered

php_value memory_limit 256M

in .htaccess and everything ran smoothly.

Best regards

Mathias

Well…as of 16.0.x the .htaccess, as well as the .user.ini are checked by the integrity checker, as it they are supposed to be unmodified onward. All the needed php and other settings are supposed to be made in their appropriate config files.

You will never get rid of the integrity failures, if you keep on modifying .htaccess and/or .user.ini.

You may add the changes to the .htaccess if you place it below the special line
“#### DO NOT CHANGE ANYTHING ABOVE THIS LINE ####”.
Anything below this line is ignored from the checker

#### DO NOT CHANGE ANYTHING ABOVE THIS LINE ####
php_value memory_limit 256M

For details see the code in lib/private/IntegrityCheck/Checker.php (around line 190).

The magic line must follow directly (without any additional spaces) to the orginal content of the .htaccess file.

Best regards

Mathias

2 Likes

Is that true? Because my htaccess which I just installed from the zip archive from the main website lacks that line. Previous versions of it had it but does it still have it?

I had a look to the provided .htaccess of the 15.0.9 vs. the 16.0.3 version of nextcloud.
Interestingly with the 15.0.9 version there are “php_value memory_limit 512M” statements within the provided .htaccess.

This is no longer the case with the 16.0.3 version.

This is why the issue with the failing integrity occurs (if your default setup of the memory limit is not large enough).

@ thedonquixotic:
According to the code that magic line is still considered with the integrity check.
If you add the magic line directly following the provided .htaccess, it should work. Note, that there should be no additional white spaces before the magic line as this might break the integrity check.

Maybe it would be a good idea to provide the magic line to the default .htaccess to make this feature more obvious.

Well, since that magic line seems not to be part of a new install, the intentions seem to be clear anyway: let the .htaccess alone and configure those settings in their appropriate files, no?

Almost forgot:
@mknext Thanks a lot! It worked!

This did it for me! :+1:

Thanks, with that change, update to 16.0.4 worked fine at all-inkl

Regards
Niko