Removed config.php by mistake any way to get that back 😢

Nextcloud version (eg, 20.0.5): 21.0.1
Operating system and version (eg, Ubuntu 20.04): Ubuntu 20.04
Apache or nginx version (eg, Apache 2.4.25): Apache2
PHP version (eg, 7.4): 7.4

The issue you are facing:
I removed my config.php by mistake

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

Steps to replicate it:

  1. Have a issue with sharing
  2. Try to reinstall
  3. cp config.php ~/public_html/config.php && cd && rm -r public_html

The output of your Nextcloud log in Admin > Logging:

Not needed

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

REMOVED

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

Not needed

On update Nextcloud creates an backup. Perhaps you can use it.

/path/to/nextcloud/data/updater-***/backups/nextcloud-*/config/config.php

I just checked and it was not there, here is a tree of that folder

root@mail /NSCS# cd /data
root@mail /data# ls
 appdata_oc9w9uu04m0u/   files_external/   git/      __groupfolders/   jsturtz/      msturtz/           nextcloud.log     nsturtz/      rainloop-storage/   updater-oc9w9uu04m0u/
 audit.log               flow.log          gpxpod/   index.html        lost+found/  '#nextcloud.log#'   nextcloud.log.1   onlyoffice/   updater.log
root@mail /data# tree updater-oc9w9uu04m0u/
updater-oc9w9uu04m0u/
└── downloads

1 directory, 0 files
root@mail /data#

Search with user “root”:
find /data config.php

Perhaps full path:
find / config.php

For both commands I get find: ‘config.php’: No such file or directory

I think it is not possible to re-build config.php .
Do you ever have updated from a a minor nextcloud version?
Why is there no backup?
If not you need a backup. Sorry i think there is no other possibility.

If you install a new system:

a.) backup all data, you can re-use them in your nextcloud with “occ” and “re-scan”
b.) export your MariaDB, perhaps you can import some parts from your database

If you have a lot of files and only few database-entries (users and shares) re-build all.

there is about a VERY rough estimate 10GB of data on there,
the reason why there never was any backups was b/c I updated manually.
and can I just re fill out a new config.php file and put the DB info in it? Will that work?

I think there could be some problems:

'instanceid' => '***',

found the value in the path name: /data/appdata_***

'passwordsalt' => '***',

Perhaps you can reset all passwords with “occ”.

'secret' => ***',

???

Read Lost config.php - #2 by koenada

Please make a backup of your data and MariaDB before testing it.

Ok will do

is oc9w9uu04m0u the instanceid? I pulled this out of appdata_oc9w9uu04m0u/

Yes. I think it is ok.