Suddenly can't login into Nextcloud

Hi friends,
Two days ago I woke up to a non-working Nextcloud.
I installed NC four moths ago using NextCloudPi Docker install for Unraid and up until now everything worked flawlessly.
However, for the past two days, when I try to login to my Nextcloud domain I see this message.


I also can’t connect to NC using the iOS or MacOS apps.

Any idea what caused this?
Maybe an unattended automatic update of NCP or the NC OS version?

I’m able to login into the NCP dashboard, but not Nextcloud.
Here’s a photo of my NCP’s System Info:

I’m running NCP on UnRAID 6.10.3. All my server files are installed on two WD Red 4TB SSD running in a BTRFS chach pool.
All other docker apps I’m running on the server are working properly. Only NC is acting up, so I’m assuming it’s not a corrupt drive.

Hope someone can help.

Hello, as the error indicates have you checked if your data directory have file called .ocdata?

1 Like

Hi Amanuel, thank you for your reply.
There was no .ocdata file in my nextcloud/data folder.
I created an empty file called .ocdata and now the nextcloud desktop loads, but every file or photo I try to open, won’t open and is showing me an error message.
Photo thumbnails are also not showing, as they used to in the past.

I also can’t upload new files manually using the desktop website. When I try I see a “forbidden” message.

Uploading with the Mac Nextcloud app also fails

you have to make sure that your web server user have read/write/execute permission on /data directory (drwxr-x—), and on .ocdata too (-rw-r–r–)

1 Like

Thank you for the suggestion.
Unfortunately, changing the permission for the .ocdata file did not solve the issue.
I still can’t view files or photos using Nextcloud’s online dashboard.
Could it be related to the fact in the past I enabled server side encryption, and now that .ocdata was recreated as a new file, the encryption is not allowing me to view the encrypted files/photos?

Amanuel, please help!
Today all my backed up files and folders are no longer showing on the nextcloud server and they were also automatically deleted from my notebook computer that was synced to my Nextcloud server using the Nextcloud Desktop Mac app.
This means I lost years of saved data! :scream:
Is there any way to restore the files?

Don’t you have backup system for your nextcloud server? You should have one.

Could it be related to the fact in the past I enabled server side encryption,

this might be a problem too. Can you bring and post your issue on telegram Nextcloud group, there you can get much better solution.

You are completely right. I should have had a proper backup routine set up, but I didn’t get around to set it up yet. I’m still learning the land of self hosting.
I was relying on the cache parity. I didn’t think NCP updates could create such an issue :((((

I tried to ask for help in the Nextcloud telegram group, but, unfortunately, the answer I got was that UnRAID is a shitty software and I wasn’t really offered any help, other than fend for myself :frowning:

I’ll try to help; please forgive any typos, nowhere near a computer at the moment -

The first thing I’d do is to check the integrity of the storage location - if you’re on btrfs, something like ‘btrfs scrub start -d /mnt/cache’. The ‘-d’ option gives per-device stats at the end of the scrub, and once it completes, it’ll give an exit code of either 0 if it’s ‘all clear’, or 1-3 if it finds something/has issues.

Also, what are your volume mounts like for the container? Did you directly map ‘/mnt/cache/’, or did you use something like ‘/mnt/user//’? Is this a ‘cache only’ directory, or do you have mover enabled for it?

Having enabled server-side encryption really limits your recovery options, restricting you to only the tools available within NC. I’d first want to verify we’re using the same NC image, that it didn’t get updated for some reason. Are you using anything to auto update containers?

Check to see when the image was updated last (‘docker image list’ command, look at the ‘CREATED’ line). If this lines up with when you set up the container 4 months ago, you’re clear on this part at least. Otherwise, rolling back the container might be helpful.

What are you using for your database? Are you able to manually browse the database (using sqlite3/pgadmin/adminer/etc)?

A couple spitball ideas that might be helpful:

  • Issue a filesystem scan from NC - “./occ files:scan-app-data” and “./occ files:scan --all”
  • Run a repair - “./occ maintenance:repair”

Based on the fact that your .ocdata file up and disappeared though, I’m not holding out hope that the data is recoverable, especially with encryption enabled… Nothing to do with unraid IMO (unless maybe you did some manual mover stuff, which could bork it up), but more likely an issue with either the filesystem or the drives hosting it.

I know it’s been mentioned earlier, and I don’t want to seem like I’m kicking you while you’re down or anything, but at the very least, a backup should’ve been taken prior to enabling encryption so you at least had one point in time where the data could be worked with outside of the NC ecosystem in order to help enable a recovery op… I sincerely hope you’re able to get the data back, but if not, please do keep this in mind in the future.

Hi @teambvd , thank you so much for taking the time to try to help! I really appreciate it :pray:

I apologize in advance for not understanding everything and knowing how to take the steps you suggested. I’m a beginner to home servers and I;m not a developer so many things that might be obvious to some are not to me.
I’ll try to follow my answers to your questions and suggestions.

  1. As I’m on UnRAID, should I run the Scrub command for my cache drive from the UI interface?
    Should I also tick the “Repair corrupted blocks”?

  1. From what I see, the container data folder was mapped to: /mnt/user/appdata/nextcloudpi

  1. I had server-side-encryption enabled :frowning:

  2. I’m not on the same container version I installed initially. a few days ago I ran a manual container update. I assumed it was advisable to update the containers on a regular basis (I guess I was wrong) :frowning:

  3. I believe the Nextcloudpi UnRAID container is configured to automatically create a mariadb database.
    I’m not sure how to manually browse the database with sqlite3/pgadmin/adminer/etc. Can you please explain?

  4. Can you please explain how to start and use occ commands on UnRAID?

Once again, many thanks for you assistance. I really appreciate it :pray: :pray:

@mjeshurun I’m not explicitly familiar with the NextclouPi docker, and the methods to run the occ command (which is a php tool) are specific to the container implementation. The way to do so on the official nextcloud container is covered here - they also run everything as the user “www-data”. The linuxserver container though, uses s6 for their services/execution, and the user “abc”, so the command for them (with their php8 container at least) would look like:

s6-setuidgid abc php8 -f /config/www/nextcloud occ <commands>

You’ll have to check out the NextcloudPi docs to confirm whatever they’re using.

As you’ve confirmed you’d set up nextcloud encryption (which btw isn’t recommended by the nextcloud devs unless using remote storage), the first thing you need to do is verify the key’s are still intact - by default, they’re saved in the main data directory. See here for further information, but you can check where they should be with

occ encryption:show-key-storage-root

My main concern is that the container you used might’ve inadvertently stored the keys in a location that was wiped when you did the upgrade (in which case, you’re out of luck). If the keys are still intact, you can use the ‘decrypt-all’ occ command (from the link above) to decrypt everything, then simply re-deploy a new nextcloud server.

One other note - you do need to keep your containers up to date, but unraid’s method of ‘just remove the old one and start the new’ will break things. You need to follow the update process as specified by either nextcloud, or your image maintainer.

Thank you, @teambvd .
I will search how to run the occ using UnRAID and will test your suggestion.

I have another piece of information that might be useful in trouble shooting this issue.
When I log into the Nextcloud’s web dashboard, I can still see files and folders names and sizes which I cannot properly open.

However, when I search the actual folders on my UnRAID server using the built-in file browser, these files and folders are not shown.

Does it mean the files were deleted and the desktop file list is wrong, or does it actually gives hope the files are just hidden (or some other problem)?

The method of executing occ is specific to the container maintainer (NextcloudPi in this case), not the hypervisor (Unraid) - youll need to check the container maintainers documentation for this part.

As to folders disappearing -

The nextcloud UI is showing what the database has recorded for what files/folders are where. In any healthy deployment, the UI will match whats seen on the physical storage. In your case though, theres no longer any doubt - youve experienced data loss.

Whether its because of storage failure, a configuration issue, or user error, theres not enough information to say… but data has certainly been lost based on the images provided. Sorry to be the bearer of bad news here!

Looks like youre not the only one to lose data after a NexcloudPi upgrade - might be worth talking to the maintaner:

@teambvd can you please help me with trying to re-scan all my Nextcloud files?

In the other topic related to this files disappearing issue, @spiritualcrab said he ran the occ command occ files:scan --all .

Do you know if the NextcloudPi command: nc-scan (within the NCP dashboard) is identical in function to the occ command: occ files:scan --all ?

I would like to try to re-scan my files, as @spiritualcrab did, but I’m not sure if the nc-scan command is similar to the occ command he mentioned.
I don’t currently know how to run occ commands for NCP installed as a docker app.

You might’ve misread my earlier message - the method to run OCC is specific to the container maintainer. I’d noted how to run OCC with the linuxserver and nextcloud maintained images, but I don’t know what the requirements are for nextcloudpi would would have to defer to the image maintainer.

I see. Thank you for the clarification.
I ran nc-scan using the NCP dashboard, but alas, it seems all my files were indeed deleted and are not retrievable.
I’m lucky I had a partial backup from 4 months ago. At least not all data was lost.
I’ll start using NC again after the new backup SSD I ordered will arrive and after I make the necessary server settings changes so that this type of issue won’t happen again.
I still have hope for a better future :slight_smile:

I’d personally use one of the more prevalent nextcloud containers for your next deployment. The new AIO container directly from the nextcloud devs looks promising, or of course you can go with something like the linuxserver container. The main reason for my pointing towards those is that there’s less ‘customization’ to them, so all the guides that are out there are more directly applicable to one’s setup and can be used without having to translate them to commands specifically used by that one image.

I’ve used linuxserver’s images for years now without issue. The only concern there is, if you decide to use plugins that require glibc (facial recognition for instance), their use of the alpine base image can make that somewhat painful in some instances.

Only other thing worth noting is php8 - there’s some significant performance improvements with php8 vs 7, so I’d go for an image that has php8 over 7 if possible.

1 Like

Just hopping in from the side to add some info :pray:

There is a shortcut command for occ in NCP called ncc which you can use instead, however the regular occ command already written out should work just as well in NCP