Blank config.php after upgrade -> 19.0.2

Nextcloud version (eg, 18.0.2): 19.0.2 (occ still shows
Operating system and version (eg, Ubuntu 20.04): Ubuntu 20.04
Apache or nginx version (eg, Apache 2.4.25): Apache/2.4.41 (Ubuntu)
PHP version (eg, 7.1): PHP 7.4.3

The issue you are facing:
After running v18.0.4.2 smoothly for long time, today I decided to update my NC installation. I used exclusively the web updater and everything went smoothly (no error, NC correctly starting). I updated first to (as indicated by web updater) and successively to 19.0.2. After the update NC is still working,
though I got some warning in “Settings->Overview” page, specifically:

  1. Missing index “properties_path_index” in table “oc_properties”.
  2. Missing optional column “reference_id” in table “oc_comments”.

I went to command line to update the db using occ command, which to my surprise resulted in:

$sudo -u www-data php /srv/nextcloud/occ db:add-missing-indices
Nextcloud is not installed - only a limited number of commands are available
  There are no commands defined in the "db" namespace. 

so I tried the check version

$ sudo -u www-data php occ -V
Nextcloud is not installed - only a limited number of commands are available
Nextcloud 18.0.4

occ shows no installed nextcloud and old version, while nextcloud is running and showing v19.0.2 from web interface. I am unable to run almost any occ command. That is when I checked config.php and found out it is empty.

What available solutions do I have to fix the problem?
I already tried to overwrite config.php with a backup, changing version parameter to 19.0.2, but I got a warning about unsupported downgrade and reverted it.

Thanks in advance for any help, it will be really appreciated.

Is this the first time you’ve seen this error? (Y/N): Y

Steps to replicate it:

  1. Start from
  2. Upgrade via web to
  3. Upgrade via web to 19.0.2

The output of your Nextcloud log in Admin > Logging:

Log Here

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):


The output of your Apache/nginx/system log in /var/log/____:

# Error log does not show any related information.

(open) upstream issue:

for a workaround: after the updater goes through, do not agree to do occ upgrade, instead delete /var/www/nextcloud/config/CAN_INSTALL and restore your backup of var/www/nextcloud/config/config.php . Now you can continue with occ upgrade

@DanScharon, thanks for pointing it out.
I am still having trouble recovering my nextcloud install: a couple of questions I hope could point me in the right direction:

  1. I am not sure when the error occurred: during the first (> or the second (> 19.0.2) upgrade, so I am not sure which config.php backup to restore from <data-dir>/updater-<instance-id>/backups folder.

  2. What if I already completed the upgrade via web-gui as I could not be aware that the config was empty? I mean when it restarts the instance and you get to the blue screen saying

App Upgrade required
[List of apps]
[Start Update Button]
To avoid timeouts with larger installations, you can instead run the following command from your installation directory:
./occ upgrade

  1. In case I have left no other options than a full restore: does the web-gui updater make a backup of the database, too? Where can I find it?

Thanks again to everybody for the help.

You are sure that you don’t have a second location for the setup where the current version is?
Can you check the data folder if the data for your user is there?

1 Like

@tflidd, thanks for the reply.

well, shame on me. :expressionless:
I just double checked and I remembered I had reinstalled nextcloud under a different directory after a similar problem.
I had been running occ from an old config , current version works ok.

Is there any chance running occ upgrade command from old version I might have messed up anything in the database or the current version?
I had re-run occ upgrade from the correct location and everything apparently looks ok.

It depends how you set it up. Automatically, it creates different databases, so it should be independent. If you manually use the same database and user, it could have an impact. Better delete the old unused one to avoid confusion (unless you have some data you want to save).