Allow `occ` to disable `config_is_read_only`
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 36.9k
- Forks
- 5.2k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 713
Description
How to use GitHub
- Please use the 👍 reaction to show that you are interested into the same feature.
- Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
- Subscribe to receive notifications on status change and new comments.
Is your feature request related to a problem? Please describe.
Due to security considerations I like to keep the config read-only during normal use. Therefor, the option config_is_read_only is set to true in the config, and the config directory is mounted as read-only volume into the container.
To run various kinds of automatic maintenance, I run occ through a container which has config and apps mounted writable. But because config_is_read_only is set, occ denies any operation editing the config, including removing the edit lock (occ config:system:set config_is_read_only --type=boolean --value false). Therefor it is not possible to do scripted maintenance with occ, without editing the config through other means beforehand (e.g. by using sed).
Other users stated similar problems in issue #32291 (including the sed hack).
Describe the solution you'd like
There are two alternative approaches:
- Add a global flag (e.g.
--ignore-readonly) or and environment variable toocc, that allows it to ignore theconfig_is_read_onlysetting. I would prefer this solution, as it does not impede the other container during maintenance. - Add an
occ config:readonly (--on|--off)command that allows to remove theconfig_is_read_onlyflag, even when set, as a special case.
Describe alternatives you've considered
It is possible to edit the config through other means, though doing automatically with sed is hacky and prone to errors.
sed -i -e '/config_is_read_only/d' config.php
Additional context
/nextcloud $ occ -- -v config:system:set config_is_read_only --value false --type boolean
In Config.php line 328:
[OCP\HintException]
Config is set to be read-only via option "config_is_read_only".
Exception trace:
at /nextcloud/lib/private/Config.php:328
OC\Config->checkReadOnly() at /nextcloud/lib/private/Config.php:272
OC\Config->writeData() at /nextcloud/lib/private/Config.php:143
OC\Config->setValue() at /nextcloud/lib/private/SystemConfig.php:150
OC\SystemConfig->setValue() at /nextcloud/core/Command/Config/System/SetConfig.php:93
OC\Core\Command\Config\System\SetConfig->execute() at /nextcloud/3rdparty/symfony/console/Command/Command.php:298
Symfony\Component\Console\Command\Command->run() at /nextcloud/core/Command/Base.php:177
OC\Core\Command\Base->run() at /nextcloud/3rdparty/symfony/console/Application.php:1040
Symfony\Component\Console\Application->doRunCommand() at /nextcloud/3rdparty/symfony/console/Application.php:301
Symfony\Component\Console\Application->doRun() at /nextcloud/3rdparty/symfony/console/Application.php:171
Symfony\Component\Console\Application->run() at /nextcloud/lib/private/Console/Application.php:213
OC\Console\Application->run() at /nextcloud/console.php:102
require_once() at /nextcloud/occ:11
config:system:set [--output [OUTPUT]] [--type TYPE] [--value VALUE] [--update-only] [--] <name>...
/nextcloud $ occ maintenance:mode --on
In Config.php line 328:
Config is set to be read-only via option "config_is_read_only".
maintenance:mode [--on] [--off]
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with lib/private/Config.php, especially checkReadOnly(), and trace the occ command paths shown in core/Command/Config/System/SetConfig.php and maintenance:mode. Review how configuration writes are guarded and identify the intended exception or global option. Done means a supported occ maintenance workflow can bypass or change config_is_read_only without the sed workaround, with behavior covered by the relevant command tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend, cli
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100