owncloud / core

:cloud: ownCloud web server core (Files, DAV, etc.)
https://owncloud.com
GNU Affero General Public License v3.0
8.36k stars 2.06k forks source link

instanceid not set during ownCloud installation #33014

Open patrickjahns opened 6 years ago

patrickjahns commented 6 years ago

When installing ownCloud (via cli), the instanceid is not directly set.

This causes issue, when one wants to install ownCloud and set the configuration into a readonly mode ('config_is_read_only '=> true) directly afterwards.

The only place where we set the intanceId is at: https://github.com/owncloud/core/blob/a615bfdee0a2613517dea23f38d6c6ecafc9e470/lib/private/legacy/util.php#L1130-L1137

Steps to reproduce

  1. install ownCloud (via cli)
  2. set 'config_is_read_only' => true in config.php
  3. try to access ownCloud // execute occ

Expected behaviour

ownCloud works

Actual behaviour

An unhandled exception has been thrown:
Exception: Config file is read only. in /Users/usr/projects/owncloud/source/core/lib/private/Config.php:141
Stack trace:
#0 /Users/usr/projects/owncloud/source/core/lib/private/SystemConfig.php(100): OC\Config->setValue('instanceid', 'ocms4l43rsh7')
#1 /Users/usr/projects/owncloud/source/core/lib/private/legacy/util.php(1132): OC\SystemConfig->setValue('instanceid', 'ocms4l43rsh7')
#2 /Users/usr/projects/owncloud/source/core/lib/private/Server.php(439): OC_Util::getInstanceId()
#3 /Users/usr/projects/owncloud/source/core/lib/composer/pimple/pimple/src/Pimple/Container.php(113): OC\Server->OC\{closure}(Object(OC\Server))
#4 /Users/usr/projects/owncloud/source/core/lib/private/AppFramework/Utility/SimpleContainer.php(108): Pimple\Container->offsetGet('MemCacheFactory')
#5 /Users/usr/projects/owncloud/source/core/lib/private/ServerContainer.php(86): OC\AppFramework\Utility\SimpleContainer->query('MemCacheFactory')
#6 /Users/usr/projects/owncloud/source/core/lib/private/Server.php(1195): OC\ServerContainer->query('MemCacheFactory')
#7 /Users/usr/projects/owncloud/source/core/lib/private/Server.php(593): OC\Server->getMemCacheFactory()
#8 /Users/usr/projects/owncloud/source/core/lib/composer/pimple/pimple/src/Pimple/Container.php(113): OC\Server->OC\{closure}(Object(OC\Server))
#9 /Users/usr/projects/owncloud/source/core/lib/private/AppFramework/Utility/SimpleContainer.php(108): Pimple\Container->offsetGet('AppManager')
#10 /Users/usr/projects/owncloud/source/core/lib/private/ServerContainer.php(86): OC\AppFramework\Utility\SimpleContainer->query('AppManager')
#11 /Users/usr/projects/owncloud/source/core/lib/private/Server.php(1411): OC\ServerContainer->query('AppManager')
#12 /Users/usr/projects/owncloud/source/core/lib/private/legacy/app.php(346): OC\Server->getAppManager()
#13 /Users/usr/projects/owncloud/source/core/lib/private/legacy/app.php(110): OC_App::getEnabledApps()
#14 /Users/usr/projects/owncloud/source/core/lib/base.php(577): OC_App::loadApps(Array)
#15 /Users/usr/projects/owncloud/source/core/lib/base.php(994): OC::init()
#16 /Users/usr/projects/owncloud/source/core/console.php(64): require_once('/Users/usr...')
#17 /Users/usr/projects/owncloud/source/core/occ(11): require_once('/Users/usr...')
ownclouders commented 6 years ago

GitMate.io thinks the contributor most likely able to help you is @PVince81.

Possibly related issues are https://github.com/owncloud/core/issues/9736 (OwnCloud periodically resetting it's "set" config to default/installation config), https://github.com/owncloud/core/issues/24324 (Owncloud not restore), https://github.com/owncloud/core/issues/5734 (ownCloud 6b3 installation failed : Fatal error), https://github.com/owncloud/core/issues/19196 (Can't set cookie in middleware when ownCloud is not installed in a folder), and https://github.com/owncloud/core/issues/7848 (Installation).

PVince81 commented 5 years ago

hmm, so this means the instance id is not generated during install but in a later request ??!

patrickjahns commented 5 years ago

Yes - unfortunately. This is bad - as the config.php will not contain the instanceid right after installation.

Worst case in a scale out, every application server generates their own instanceid 😱