server
server copied to clipboard
`Cannot write into 'config' directory` misleading when an upgrade is needed
How to use GitHub
- Please use the 👍 reaction to show that you are affected by the same issue.
- 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.
Steps to reproduce
- Set up NextCloud with a read-only configuration file
- Set 'config_is_read_only' to true
- Upgrade NextCloud
Expected behaviour
The upgrade should be successful when no changes to the configuration file are necessary. Otherwise, there should be a message stating that the upgrade cannot be performed with a read-only configuration.
Actual behaviour
Currently, the message shown is
Cannot write into "config" directory! This can usually be fixed by giving the webserver write access to the config directory.
But, if you prefer to keep config.php file read only, set the option "config_is_read_only" to true in it.
However, config_is_read_only
is already set to true which makes the message rather confusing. The responsible line is this condition: https://github.com/nextcloud/server/blob/v22.2.0/lib/base.php#L248
Server configuration
Operating system: Debian Buster
Web server: nginx
Database: PostgreSQL
PHP version: 7.3
Nextcloud version: currently 20.0.13, but the issue is still present in newer versions
Updated from an older Nextcloud/ownCloud or fresh install: Updated
+1
Hi, please update to 24.0.9 or better 25.0.3 and report back if it fixes the issue. Thank you!
My goal is to add a label like e.g. 25-feedback to this ticket of an up-to-date major Nextcloud version where the bug could be reproduced. However this is not going to work without your help. So thanks for all your effort!
If you don't manage to reproduce the issue in time and the issue gets closed but you can reproduce the issue afterwards, feel free to create a new bug report with up-to-date information by following this link: https://github.com/nextcloud/server/issues/new?assignees=&labels=bug%2C0.+Needs+triage&template=BUG_REPORT.yml&title=%5BBug%5D%3A+
Just checked this code in 24.0.9 and 25.0.3 and it has no changes comparing to code this issue was reported for. Still if version in version.php
and version in config.php
are different, updater attempts to upgrade and fails if config is set to be read-only.
I agree the wording is inappropriate here, but from the looks of it this is purely a cosmetic bug. The documentation clearly states:
When this switch is set to true, writing to the config file will be forbidden. Therefore, it will not be possible to configure all options via the Web interface. Furthermore, when updating Nextcloud it is required to make the configuration file writable again and to set this switch to false for the update process. --https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/config_sample_php_parameters.html?highlight=config_is_read_only#config-is-read-only
The more generic HintException used here is probably a good candidate replacement:
https://github.com/nextcloud/server/blob/e9ac0287f2b7d4da856bec416a282c8fc4c7feab/lib/private/Config.php#L317-L321C5
Given NC is a community project, anyone that considers this important enough is welcome to compose a PR.