server icon indicating copy to clipboard operation
server copied to clipboard

`Cannot write into 'config' directory` misleading when an upgrade is needed

Open timonegk opened this issue 3 years ago • 3 comments

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

  1. Set up NextCloud with a read-only configuration file
  2. Set 'config_is_read_only' to true
  3. 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

timonegk avatar Nov 06 '21 14:11 timonegk

+1

abewartech avatar Sep 17 '22 03:09 abewartech

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+

szaimen avatar Jan 23 '23 12:01 szaimen

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.

k-popov avatar Jan 25 '23 15:01 k-popov

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.

joshtrichards avatar Jul 12 '23 20:07 joshtrichards