This hasn’t ever been explained anywhere in the Nextcloud client but it might fail in your computer. However, the client is mostly not to blame but the tight setup of OpenBSD for its users. The issue happens (not just in OpenBSD) if you have a large Nextcloud folder to sync, Nextcloud client tends to open files very quickly to check whether or not they changed! At least in OpenBSD the limit is not wide enough for the client and you get a “You have too many open files” error so you have to increase it: I think this could be better documented in the package of Nextcloud client.
How to fix this?
First, check which login class your user pertains to. Usually accounts are created as default BUT if you’re a single computer user you probably are “staff”. My login.conf shows the following entry:
#
# Staff have fewer restrictions and can login even when nologins are set.
#
staff:\
:datasize-cur=1536M:\
:datasize-max=infinity:\
:maxproc-max=512:\
:maxproc-cur=256:\
:ignorenologin:\
:requirehome@:\
:openfiles-max=2048:\
:openfiles-cur=1024:\
:stacksize-cur=8M:\
:tc=default:
If you don’t know whether you’re default or staff or something else, type user info $USER
and check the “class” line.
Pay attention to (you guessed that) openfiles-max and openfiles-cur. These two entries are the ones that need to be enlarged. You could check how many files you’ve got in your folder and infer from that info an open files limit. Or you could just make a rather large entry and go from there. I read a recommendation elsewhere about enlarging this to over 100000. I didn’t go that far but I opted for the “guessing” option.
And then you should run:
# cap_mkdb
Also, you need to do two more things:
Add the following to your sysctl.conf:
kern.maxfiles=[the limit number]
(Just the number, not the brackets).
The last part is to reboot. If you did it alright your Nextcloud client won’t crash and it’ll start syncing (or at least it’ll ask for your password and then it’ll start doing its stuff). If you DON’T wanna reboot type:
sysctl kern.maxfiles=[the number]
This configuration will remain as long as the computer is on. Bear in mind that this setting is global and not only valid to Nextcloud but systemwide.
You don’t HAVE to do this
I did this because I wanted to have the normal GUI experience of Nextcloud. However, if you’re a weirdo and don’t mind it, Nextcloud has a command line client (nextcloudcmd) that syncs whenever it’s ordered to and it works without this hassle. It just syncs and says good-bye! It doesn’t run like a service as you’d expect. You have to add the following parameters (which is explained well in Nextcloud docs but anyway):
$ nextcloudcmd -s -u [your username] -p [your password] [Your Nextcloud folder] [The instance URL]
The “-s” is a parameter so nextcloud shuts up because this command is rather verbose (it doesn’t even go to stdout or at least I couldn’t find the way to send its output there).
That’s it. (Tested in a laptop with OpenBSD 6.9)