Workaround
A workaround that I decided to go with was to simply extend my backup of the nextcloud snap to simply include the entirety of /var/snap/nextcloud
instead of just taking the data directory, and the dump of the database. If I restore /var/snap/nextcloud
, everything is immediately restored to its previous working order. This seems to accomplish what I want.
I still have no idea what was causing the previous issue, though. I’m thinking that it might be that some important files, or directories are being left out in the previous backup that nextcloud is expecting to be present, but I’m really not sure.
Original Post
I have been scratching my head for hours over this – I’m really not sure what the problem could be. I have nextcloud installed as a Snap on Ubuntu Server.
Here’s how I went about restoring the backup (fresh install of nextcloud):
- Copy over the data:
# rsync -Aax data-backup data-directory
- Drop the existing database:
- Create a new database:
- Restore the dumped database:
# nextcloud.mysql-client nextcloud < database-dump
When I log in to nextcloud in the browser, it initially appears that it worked fine: calendar data, task data, contacts, etc. are all properly loaded, and the images viewer is displaying images; however, when you look at the files tab, there’s nothing there, and, when you try to create a folder, it spits out an error saying “Unable to create folder”. If I run nextcloud.occ files:scan --all
it can see all the files in the data directory just fine, it’s just not able to display them in the files taband I cannot figure out why. I would really appreciate any help, ideas, or suggestions.
There is a config parameter to rescan you files on each request.
I used it once after i copied files into the datadirectory via cli an nextcloud did not recognize them.
You should only enable it temporary, since its is slow but it might help in your case if you do it once.
https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/config_sample_php_parameters.html#filesystem-check-changesAhh that’s very helpful! I made a cron job to scan regularly as a bandaid solution before…
Sounds like a permission problem, probably when you did copy the files then permission did change from like www-data into your user, simplest solution would be to change the permissions for those files (for example to 777 as a temporary solution)
for example to 777 as a temporary solution
Just tried this, and still nothing.
chmod -R 777 data-directory
Check also all parent directories, as the whole path need to have access (execute) permissions.
Tried this. Still nothing.