"notmuch new" Unable to get write lock

I’m trying to access my mail via a machine on which I installed Nixos a few weeks ago.

The database is on an nfs server and I’ve used it via a debian system. On nix, I get:

[andy@cathcart:~]$ notmuch new
A Xapian exception occurred opening database: Unable to get write lock on /home/andy/mail/.notmuch/xapian: locking probably not supported by this FS

[andy@cathcart:~]$ notmuch --version
notmuch 0.29.1

on debian it works. The version there is notmuch 0.28.4.

I have read and write access to the xapian direcory from nix. Does anyone have advice?


It may give you some clues to try and create a lockfile manually in that nfs location, just so you’d find out if it’s a notmuch specific issue or a general issue with the NFS mount. See linux - What is the best way to ensure only one instance of a Bash script is running? - Stack Overflow

lockfile is available by nixpkgs.procmail.

Thanks to doronbehar for the reply.

However, I got it to work by changing the options for the filesystem in /etc/nixos/configuration.nix to include the “nolock” option. I believe that with the “lock” option, the file server should do locking. However, I failed to get that to work. With the “nolock” option, files are only locked on the local machine. So I must now ensure that I only modify the DB from a single machine.

For reference, here is the block from my configuration.nix file:

    fileSystems."/mnt/precious" = {
        device = "";
	      fsType = "nfs";
        options = [ "defaults" "nolock" ] ;