[SOVED] Nextcloud acting up

Hello everyone! It’s me, I’m back with a new problem. This time I’ve been more diligent and digged as much as possible on Google to find an answer, but with no avail.
I’ve setup my Nextcloud istance on a Raspberry Pi on Docker. Everything works as expected and it’s even decent when combined with the cron job they suggest.
But there’s one issue that’s bugging me and I’d like to iron out: when I try to delete a bunch of files I get a notification that says:
"File could not be loaded. Please check your internet connection". If I reload the page all the files are in the bin as expected.
Then, when I try to recover them from the bin, I get this fatal error in the logs:
OCP\Lock\LockedException followed by my home directory and some other garbage regarding a lock acquired on the file.
As usual, just refreshing the page shows all the files recovered correctly.
If I delete the same files one at the time and restore them one at the time no error appears. I can load files on the istance and retrieve them without any issues.
All the files are on a brand new SSD that works fine.
What’s making me scratch my head is seeing my home path in the error details: "files/fad66d30f7250fa9645ce0eed34b6146"("home::[REDACTED]::scanner::files_trashbin/versions") is locked. What I think it’s happening is that my micro SD is getting called to do something for some reason and it’s not fast enough compared to the SSD and so this error appears. Not sure about that and i don’t know how to avoid Nextcloud going through my micro SD instead of living on the SSD.
Googling returns one open ticket to Nextcloud and that’s about it.

I hope I’ve given enough details and context. Thanks to everyone for the patience!

EDIT 1: just checked and the bin is correctly living on the SSD and not the micro SD card luckly.

If you navigate to “Settings > Administration > Basic settings” what does it say for the Background Jobs section? Is everything executing normally?

Yes, the cron job gets executed every 5 minutes. Since I’m on Docker I’m using this entry to update cron.php:

*/5 * * * * docker exec -u www-data nextcloud php cron.php

EDIT: pasted the wrong string. It’s 5 in crontab.

And it’s executing as expected?

What happens if you run something like: php occ files:scan --all in the docker container? (So for my setup, it’d be docker exec -it -u 33 nextcloud bash to open a Bash shell in the Nextcloud docker container, and then php occ files:scan --all. That should scan through all your files and see if anything is aberrant in terms of its state.

Fair warning though - this command can take a while if you have lots of files.

Starting scan for user 1 out of 1
+---------+-------+--------------+
| Folders | Files | Elapsed time |
+---------+-------+--------------+
| 12      | 40    | 00:00:01     |
+---------+-------+--------------+

Everything checks out I think.

It’s a fresh install I’m playing around with. Nothing important on it yet, just testing out some stuff.

1 Like

Yeah, errors would be red in your terminal. It doesn’t look like any files are actually locked…

It’s like a temporary lock. It gets lifted almost immediatly because just refreshing the page shows that everything is in it’s place and moved correctly between “home” and trash.

Is the Docker image installed to the SSD, or just the data volume?

Just the data volume is on the SSD. Everything else lives on the micro SD.

I don’t know enough about what is going through the filesystem on the MicroSD card, but that does sound plausible to me. I would think almost everything would be in memory, but maybe there’s a log file apache (or whatever server you are using) has to wait to write to, that’s somewhere in the image on your MicroSD?

Hopefully someone more knowledgeable about this aspect will come along.

EDIT:

If you’re using docker-compose you could try this:

logging:
    driver: none
1 Like

I don’t know either. The DB for Nextcloud lives on the SSD too, to avoid possible bottlenecks.
But there must be something screwy going on I’m not aware of.

Thanks a lot for having jumped in so fast, I really appreciated the effort!

P.S. I’m gonna give a try to that command once grasp what it does.

It’s been a while since the Nextcloud devs reverted their original advise, but for a while now it’s strongly discouraged to use an SD card as OS storage. Even DRAM-less cheap Chinese SSD’s from Aliexpress are way better then an SD card. You can get one of those for 20 bucks and have way better performance across the system.

1 Like

Unfortunately that’s what I’m rolling for now. I’m probably gonna move everything to the SSD for the future.
But for now I’m trying to figure out what’s going on, if I made a mistake or not.
For now the SD is working fine and I got everything going just fine (beside Nextcloud).

Found the solution to the issue:

My Nextcloud installation is working fine but Netdata was hitting the SD card pretty hard, causing queue times for very rapid Nextcloud operations like deleting a bunch of pics.
Reducing temporarely the Netdata logging abilities fixed the issue. I’m gonna move the logs to the SSD and everything should be fine and dandy.

Thanks for all the answers! I just had a shower thought now and turns out I made the right call.

UPDATE: Nextcloud is hitting the swap partition for some reason while transfering files. That’s why I was having those issues. I just found out today because SWAP was full with almost 7GB of free RAM (Pi 4 8GB).

2 Likes

Perfect!