Skip to content

Allow occ to disable config_is_read_only #47762

Open
@smrqdt

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 to occ, that allows it to ignore the config_is_read_only setting. 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 the config_is_read_only flag, 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]

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions