Nfs: enabling file locking (flock)

lockingnfs

I'm having trouble finding really any information at all on how to make file locking work for NFS mounts, to resolve client errors like ENOLCK (No locks available).

I understand that in NFSv3 file locking was handled by separate services, and in NFSv4 it is handled by the main protocol.

I thought it would be nice if we could consolidate the various scenarios and resolve this all in one place. How do you enable file locking for NFS versions 3 and 4?

I'm personally on debian buster on a raspberry pi. I set up NFS basically following the debian buster handbook, but I'm getting the "no locks available" error when I try to lock a file.

Best Answer

By starting rpc.lockd and rpc.statd daemons, or whatever alternatives your OS has for this.

P.S. and this has nothing to do witrh the NFS protocol version which mentioned in the first comment, lol (experts everywhere, eh ?).