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

[BUG] Nextcloud 24 upgrade fail - bool given in /var/www/html/lib/private/Security/CertificateManager.php #1747

Closed
Dionysoos54 opened this issue May 9, 2022 · 6 comments

Comments

@Dionysoos54
Copy link

Dionysoos54 commented May 9, 2022

Hello,

The upgrade fail to nextcloud 24 with the latest nextcloud image. I have tried to launch occ upgrade directly from the docker contener, I have these errors messages :
www-data@bb9a52ecc6a8:~/html$ php occ upgrade
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
Setting log level to debug
Updating database schema
Updated database
An unhandled exception has been thrown:
TypeError: fwrite(): Argument #1 ($stream) must be of type resource, bool given in /var/www/html/lib/private/Security/CertificateManager.php:161
Stack trace:
#0 /var/www/html/lib/private/Security/CertificateManager.php(161): fwrite(false, ‘##\n## Bundle of…’)
#1 /var/www/html/lib/private/Security/CertificateManager.php(247): OC\Security\CertificateManager->createCertificateBundle()
#2 /var/www/html/lib/private/Http/Client/Client.php(127): OC\Security\CertificateManager->getAbsoluteBundlePath()
#3 /var/www/html/lib/private/Http/Client/Client.php(74): OC\Http\Client\Client->getCertBundle()
#4 /var/www/html/lib/private/Http/Client/Client.php(218): OC\Http\Client\Client->buildRequestOptions(Array)
#5 /var/www/html/lib/private/App/AppStore/Fetcher/Fetcher.php(120): OC\Http\Client\Client->get(‘https://apps.ne/…’, Array)
#6 /var/www/html/lib/private/App/AppStore/Fetcher/AppFetcher.php(87): OC\App\AppStore\Fetcher\Fetcher->fetch(’’, ‘’)
#7 /var/www/html/lib/private/App/AppStore/Fetcher/Fetcher.php(192): OC\App\AppStore\Fetcher\AppFetcher->fetch(’’, ‘’, false)
#8 /var/www/html/lib/private/App/AppStore/Fetcher/AppFetcher.php(188): OC\App\AppStore\Fetcher\Fetcher->get(false)
#9 /var/www/html/lib/private/Installer.php(422): OC\App\AppStore\Fetcher\AppFetcher->get(false)
#10 /var/www/html/lib/private/Updater.php(413): OC\Installer->isUpdateAvailable(‘accessibility’)
#11 /var/www/html/lib/private/Updater.php(274): OC\Updater->upgradeAppStoreApps(Array)
#12 /var/www/html/lib/private/Updater.php(133): OC\Updater->doUpgrade(‘24.0.0.12’, ‘23.0.4.1’)
#13 /var/www/html/core/Command/Upgrade.php(235): OC\Updater->upgrade()
#14 /var/www/html/3rdparty/symfony/console/Command/Command.php(255): OC\Core\Command\Upgrade->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#15 /var/www/html/3rdparty/symfony/console/Application.php(1009): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#16 /var/www/html/3rdparty/symfony/console/Application.php(273): Symfony\Component\Console\Application->doRunCommand(Object(OC\Core\Command\Upgrade), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#17 /var/www/html/3rdparty/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#18 /var/www/html/lib/private/Console/Application.php(211): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#19 /var/www/html/console.php(99): OC\Console\Application->run()
#20 /var/www/html/occ(11): require_once(’/var/www/html/c…’)
#21 {main}www-data@bb9a52ecc6a8

@Dionysoos54 Dionysoos54 changed the title [BUG] Nextcloud 24 upgarde fail - bool given in /var/www/html/lib/private/Security/CertificateManager.php [BUG] Nextcloud 24 upgrade fail - bool given in /var/www/html/lib/private/Security/CertificateManager.php May 10, 2022
@clnsdev
Copy link

clnsdev commented May 23, 2022

Had exactly the same error on upgrade.
The problem came from wrong permissions on the following directory: /path-to-nextcloud-user-data/files_external.
Entering a simple sudo chown -R www-data:www-data /path-to-nextcloud-user-data/files_external solved the issue for me.

@Dionysoos54
Copy link
Author

Hi cldndev,
Your solution have solved my issue, thank you :)

Had exactly the same error on upgrade. The problem came from wrong permissions on the following directory: /path-to-nextcloud-user-data/files_external. Entering a simple sudo chown -R www-data:www-data /path-to-nextcloud-user-data/files_external solved the issue for me.

@Dionysoos54
Copy link
Author

Fixed

@bradgarrett
Copy link

bradgarrett commented Dec 11, 2022

I tried to upgrade my nextcloud instance in docker. ./occ upgrade throws the same error (pasted below) My file permissions were already set to www-data. Was the error fixed?

www-data@9b608bc10584:~/html$ ./occ upgrade -v
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
2022-12-11T03:36:13+00:00 Setting log level to debug
2022-12-11T03:36:13+00:00 Repair step: Repair MySQL collation
2022-12-11T03:36:13+00:00 Repair info: All tables already have the correct collation -> nothing to do
2022-12-11T03:36:13+00:00 Repair step: Repair SQLite autoincrement
2022-12-11T03:36:13+00:00 Repair step: Copy data from accounts table when migrating from ownCloud
2022-12-11T03:36:13+00:00 Repair step: Drop account terms table when migrating from ownCloud
2022-12-11T03:36:13+00:00 Updating database schema
2022-12-11T03:36:13+00:00 Updated database
An unhandled exception has been thrown:
TypeError: fwrite(): Argument #1 ($stream) must be of type resource, bool given in /var/www/html/lib/private/Security/CertificateManager.php:161
Stack trace:
#0 /var/www/html/lib/private/Security/CertificateManager.php(161): fwrite(false, '##\n## Bundle of...')
#1 /var/www/html/lib/private/Security/CertificateManager.php(247): OC\Security\CertificateManager->createCertificateBundle()
#2 /var/www/html/lib/private/Http/Client/Client.php(127): OC\Security\CertificateManager->getAbsoluteBundlePath()
#3 /var/www/html/lib/private/Http/Client/Client.php(74): OC\Http\Client\Client->getCertBundle()
#4 /var/www/html/lib/private/Http/Client/Client.php(218): OC\Http\Client\Client->buildRequestOptions(Array)
#5 /var/www/html/lib/private/App/AppStore/Fetcher/Fetcher.php(120): OC\Http\Client\Client->get('https://apps.ne...', Array)
#6 /var/www/html/lib/private/App/AppStore/Fetcher/AppFetcher.php(87): OC\App\AppStore\Fetcher\Fetcher->fetch('', '')
#7 /var/www/html/lib/private/App/AppStore/Fetcher/Fetcher.php(192): OC\App\AppStore\Fetcher\AppFetcher->fetch('', '', false)
#8 /var/www/html/lib/private/App/AppStore/Fetcher/AppFetcher.php(188): OC\App\AppStore\Fetcher\Fetcher->get(false)
#9 /var/www/html/lib/private/Installer.php(421): OC\App\AppStore\Fetcher\AppFetcher->get(false)
#10 /var/www/html/lib/private/Updater.php(424): OC\Installer->isUpdateAvailable('activity')
#11 /var/www/html/lib/private/Updater.php(285): OC\Updater->upgradeAppStoreApps(Array)
#12 /var/www/html/lib/private/Updater.php(144): OC\Updater->doUpgrade('25.0.2.3', '25.0.0.18')
#13 /var/www/html/core/Command/Upgrade.php(225): OC\Updater->upgrade()
#14 /var/www/html/3rdparty/symfony/console/Command/Command.php(255): OC\Core\Command\Upgrade->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#15 /var/www/html/3rdparty/symfony/console/Application.php(1009): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#16 /var/www/html/3rdparty/symfony/console/Application.php(273): Symfony\Component\Console\Application->doRunCommand(Object(OC\Core\Command\Upgrade), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#17 /var/www/html/3rdparty/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#18 /var/www/html/lib/private/Console/Application.php(213): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#19 /var/www/html/console.php(100): OC\Console\Application->run()
#20 /var/www/html/occ(11): require_once('/var/www/html/c...')

@MarvinT
Copy link

MarvinT commented Dec 14, 2022

I'm getting a similar issue on a fresh install...
Trying sudo chown -R www-data:www-data config outside of the docker container gives me an invalid user error... should I add some similar command to the docker compose or something?

Stack trace for reference:

<b>Fatal error</b>:  Uncaught TypeError: flock(): Argument #1 ($stream) must be of type resource, bool given in /var/www/html/lib/private/Config.php:228
Stack trace:
#0 /var/www/html/lib/private/Config.php(228): flock(false, 1)
#1 /var/www/html/lib/private/Config.php(71): OC\Config-&gt;readData()
#2 /var/www/html/lib/base.php(153): OC\Config-&gt;__construct('/var/www/html/c...')
#3 /var/www/html/lib/base.php(598): OC::initPaths()
#4 /var/www/html/lib/base.php(1144): OC::init()
#5 /var/www/html/index.php(34): require_once('/var/www/html/l...')
#6 {main}
  thrown in <b>/var/www/html/lib/private/Config.php</b> on line <b>228</b><br />

@joshtrichards
Copy link
Member

@MarvinT That's a very different stack trace. Please open a separate issue for it or post over on the forums (https://help.nextcloud.com).

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

5 participants