EDIT: Found solution, see below question.
So my nextcloud server had segmentation fault issues and I was not able to do a proper migration. Instead, I need to make use of my backup data, which does not include the snapshot of the database as described in the docs, but has only the folder structure. When copying everything over to a new server, there were many issues, one of them being that the permissions were not set correctly.
Do you have a resource or a tutorial what steps I need to take to recover my server from the folder structure alone (i.e. app, data, database)?
I’m using docker-compose to set up the server, so following the docker-compose.yml file it should be fairly easy to reproduce my former configuration.
Nextcloud version: 26
Operating system and version: docker-compose
Steps to replicate it:
- Copy all the data from one server
- Try to start the container from another server, including all the data
- Face permissions errors
Please tell me if you need more details.
SOLUTION OF THE PROBLEM
So Indeed, I managed to recover my nextcloud server fully using the answer of Factor Three, i.e. the third answer, of this stackoverflow post:
However, some steps are missing in the answer, which I want to provide now. First, it’s important to get the container with the same version as before (this is a no-brainer, but I only realized it late). Then, the main ingredient are the permissions, as outlined in the stackoverflow answer. To this end, first clone a new nextcloud entity with the same docker-compose.yml but without the data you want to insert. This is only a dry-run to understand what permissions you need. Create an dummy admin in the browser as you did for the old server in order to populate the database. Afterwards you can check the permissions of your directories with ls -la. Then, use (with sudo if you did not unlock non-sudo docker)
docker exec -u www-data -it nextcloud-app /bin/bash
with this command you go into the virtual container (use the correct container name) with the user www-data. Then, you can use ls -la to understand the permissions, users and groups of the directories you mounted. Do the same for the mysql container (or whatever database you use). Note that there is a user mysql which does not exist in the non-virtual directory and is displayed with user 999 if there outside of the virtual environment (which you cannot set- as far as I understand, it’s set automatically when you use a user in docker which does not exist outside). After you have noted down all permissions etc., you shut down the server and replace the directories with the ones you have rescued from the old server. Put the server into maintenance mode with the config.php file. Then, make sure to implement all permissions (chmod) and user rights (chown) on your server level. After this, you can start the server again, in order to go into the virtual environment of the container.
Inside of the virtual containers, change the permissions and user rights as you have found out earlier (with the -u root option in order to be able to change everything). Then, exit the bash and shut down the server. Then start it again. Now, it should work (at least it did for me). Good luck!