this post was submitted on 21 Aug 2023
16 points (90.0% liked)

Selfhosted

40006 readers
622 users here now

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.

Rules:

  1. Be civil: we're here to support and learn from one another. Insults won't be tolerated. Flame wars are frowned upon.

  2. No spam posting.

  3. Posts have to be centered around self-hosting. There are other communities for discussing hardware or home computing. If it's not obvious why your post topic revolves around selfhosting, please include details to make it clear.

  4. Don't duplicate the full text of your blog or github here. Just post the link for folks to click.

  5. Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).

  6. No trolling.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

founded 1 year ago
MODERATORS
 

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):

  1. Copy over the data: # rsync -Aax data-backup data-directory
  2. Drop the existing database: # nextcloud.mysql-client -e "DROP DATABASE nextcloud"
  3. Create a new database: # nextcloud.mysql-client -e "CREATE DATABASE nextcloud"
  4. 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.

top 5 comments
sorted by: hot top controversial new old
[–] JadBlackstone@lemmy.one 8 points 1 year ago (2 children)

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-changes

[–] skilltheamps@feddit.de 1 points 1 year ago

Ahh that's very helpful! I made a cron job to scan regularly as a bandaid solution before...

[–] Kalcifer@lemm.ee 1 points 1 year ago* (last edited 1 year ago)

I enabled that in /var/snap/nextcloud/current/nextcloud/config/config.php with 'filesystem_check_changes' => 1,, but it did not fix the issue. It did seem to remove one error that was popping up, but I am still getting a prompt stating that the file could not be created (which is strange because, when I did a file scan, it shows that they were created), and the files are still not displayed.

It should also be noted that I restart nextcloud after applying the changes with # snap restart nextcloud.

[–] SmallAlmond@lemmy.dbzer0.com 1 points 1 year ago (1 children)

occ files:scan --all (or something like that)

[–] Kalcifer@lemm.ee 2 points 1 year ago

occ files:scan --all (or something like that)

I have already done this, as was mentioned in the post.