Yesterday, through my own fault, managed to delete and lose my nextcloud config.php file (technically the whole jail was deleted). I still have the sql DB and data directory.
I attempted to rebuild my nextcloud instance. After setting up the jail, I was able to access the web UI where it asked for SQL settings, admin user, data directory.
I’m able to fill out the settings but when I save, it’s noted the admin user already exists (which is should as it’s in the database) and I’m brought back to the settings page.
Am I basically out luck here or is it possible to get around this? For instance, maybe just resetting the admin user password or something? I’d rather not lose my calendars and contacts (which I assume are stored in the database). The data wasn’t being encrypted (hadn’t set it up) so I think I should just be able to copy that back if needed (or just reupload manually).
Unfortunately, I’m leaning toward not being able to fix this because of the secret and hash in the config file but thought I’d double check.
I was able to add ‘installed’ = True to a clean install config.php to at least regain access into the server. Unfortunately, I couldn’t get around an issue with the secret key for each user. I believe this is probably due to the different password salt or something in the newer config.php file.
Gaining access at least allowed me to get to the calendars and contacts to back them up. A rebuilt/fresh install still needs to be done but at least I was able to back up some of the apps I was using.
One other tip for others who run into this: you can recover the instance ID by looking in the data folder for an appdata_INSTANCE_ID folder (where INSTANCE_ID is the instance ID you seek!).
If you already re-ran the Nextcloud installer, then there should be multiple appdata_ folders – one with a more recent date than the other. The name of the older folder should include the instance ID you lost when config.php was lost.
Do you have BTRFS, or other FS with snapshots? You could restore your config.php.
Also try to check under .../nextcloud/data/updater-xxxx/backups/ if you have any backup from older update. This could give you config.php with salt back.