-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
[Bug]: Nextcloud 24 upgrade fail - bool given in /var/www/html/lib/private/Security/CertificateManager.php #33487
Comments
I have hit this as well, trying to upgrade from Nextcloud 23.0.0 to 24.0.5 (no docker) using |
I have this error too with Nextcloud 24.0.6.1 on Docker. I can't use this commands :
|
If you need an urgent fix try the following, this is probably bad practice/not recommended: What I did is I manually edited the PHP file where the error was thrown and just put an empty string, where the type error was thrown, then did the update and reverted my changes. |
Thanks for the suggestion @supermar1010 Here my temporary fix on public function getAbsoluteBundlePath(): string {
+ return \OC::$SERVERROOT . '/resources/config/ca-bundle.crt'; // TMP FIX
try {
if (!$this->bundlePath) {
if (!$this->hasCertificates()) { |
I opted to stay at 23.x until a 24.x release that updates cleanly is released. Let me know if I can provide any further information to help resolve this 'properly'. |
This may be a permission issue: nextcloud/docker#1747 (comment) |
@szaimen: AFAICT, the permissions are correct in my case: ls -ld nextcloud/apps/files_external
Note that my nextcloud installation is owned by the sudo -u nextcloud php8 nextcloud/occ upgrade |
This should be fixed with bffa67c |
@CarlSchwan: Since that commit is tagged v25.0.0rc5, does that mean there won't be any 24.x release that won't fail upgrading? And if so, will I be able to update straight from 23.x to 25.x using |
I still get the very same error with 25.0.1
|
I thought it might be a leftover from previous data, so I deleted everything, did a clean install with S3 as primary data storage and ran into the same error still. @CarlSchwan, whould you mind reopening this? |
I tried to reproduce the isse observed by @Mister-42 but failed to do so since upgrading from 23.x to 25.x (see my earlier question) turns out not to be supported. sudo -u nextcloud php8 nextcloud/occ upgrade
So is there any viable upgrade path from 23.x to the latest version that does not require re-installation from scratch or manually editing source files in a directory called |
I can confirm that
Is it required (and safe) to leave the change to |
I suggest to reopen this issue and fix the main error which was introduced in following commit 8 month ago #31605 @icewind1991 can you fix this bug. You try to convert
server/lib/public/Files/Storage/IStorage.php Lines 312 to 320 in 72744a7
Possible solution: public function getAbsoluteBundlePath(): string {
try {
- if (!$this->bundlePath) {
+ if ($this->bundlePath === null) {
if (!$this->hasCertificates()) {
$this->bundlePath = \OC::$SERVERROOT . '/resources/config/ca-bundle.crt';
}
if ($this->needsRebundling()) {
$this->createCertificateBundle();
}
- $this->bundlePath = $this->view->getLocalFile($this->getCertificateBundle());
+ $bundlePath = $this->view->getLocalFile($this->getCertificateBundle());
+ if($bundlePath !== false) {
+ $this->bundlePath = $bundlePath;
+ }
}
return $this->bundlePath;
} catch (\Exception $e) {
return \OC::$SERVERROOT . '/resources/config/ca-bundle.crt';
}
} Is it possible to receive true by I'm also not sure about the logic. The property So i suggest to change the code as followed: public function getAbsoluteBundlePath(): string {
try {
- if (!$this->bundlePath) {
+ if ($this->bundlePath === null) {
- if (!$this->hasCertificates()) {
- $this->bundlePath = \OC::$SERVERROOT . '/resources/config/ca-bundle.crt';
- }
if ($this->needsRebundling()) {
$this->createCertificateBundle();
}
- $this->bundlePath = $this->view->getLocalFile($this->getCertificateBundle());
+ $bundlePath = $this->view->getLocalFile($this->getCertificateBundle());
+ if($bundlePath === false) {
+ return \OC::$SERVERROOT . '/resources/config/ca-bundle.crt';
+ }
+ $this->bundlePath = $bundlePath;
}
return $this->bundlePath;
} catch (\Exception $e) {
return \OC::$SERVERROOT . '/resources/config/ca-bundle.crt';
}
} comment to update: |
Almost forgot to mention, that there is also a cheap solution ... use - } catch (\Exception $e) {
+ } catch (\Throwable $e) {
return \OC::$SERVERROOT . '/resources/config/ca-bundle.crt';
} |
sounds good to me. Can you open a PR with that? :) |
Just reporting back that
|
Sounds like another error. The bugfix worked on my server ... 🤨 @mschilli87 Can you also report the error message? |
Unless the error message is saved in some log file I could still check, unfortunately no. I thought is was the same but did not carefully check. I saw an error in CertificateManager.php and somethin about 'bool' and given that this was the only errer I ever encountered when upgrading Nextcloud and this issue provided a working fix the last two times, I came here and started working around it. 🤷 😅 |
@Messj1: This is the error message I get when I try to update from 25.0.2 to 25.0.3:
|
@Messj1: Here is the error when upgrading from 25.0.3 to 26.0.0:
|
@mschilli87: This is not the same error but also the same type of error.
If you have a look at
you can see that the first parameter must be the bool. (PHP fwrite reference)
The resource parameter is set as return value of View class
The return value is a resource if I only read the doc server/lib/private/Files/View.php Lines 973 to 979 in 62cfd3b
but the function returns for sure also other types server/lib/private/Files/View.php Lines 1006 to 1016 in 62cfd3b
Since the pull request #35092 ist still open I can commit the solution there: $fhCerts = $this->view->fopen($tmpPath, 'w');
+
+ if (!is_resource($fhCerts)) {
+ throw new \RuntimeException('Unable to open file handler to create certificate bundle "' . $tmpPath . '".');
+ } |
Bug description
I have the same issue as here: nextcloud/docker#1747
But the solution proposed there does not work for me. My nextcloud uses a S3 bucket as primary storage.
My permissions inside the container look like this:
Steps to reproduce
Expected behavior
The update should work flawless
Installation method
Official Docker image
Operating system
RHEL/CentOS
PHP engine version
No response
Web server
No response
Database engine version
MariaDB
Is this bug present after an update or on a fresh install?
Updated to a major version (ex. 22.2.3 to 23.0.1)
Are you using the Nextcloud Server Encryption module?
Encryption is Disabled
What user-backends are you using?
Configuration report
List of activated Apps
Nextcloud Signing status
No response
Nextcloud Logs
Additional info
No response
The text was updated successfully, but these errors were encountered: