Sync() errors on Mac over SMB

This is in reference to my earlier thread.

So I was going to mount the repo by first mounting the smb share, then doing a restic mount on my Mac. However, it appears I can’t even list the snapshots on my Mac. It’s fine, and I can still restore the profile using restic restore on my Windows box, but I found this odd and thought I’d report it.

akrabu-macbook-air:~ akrabu$ restic -r /Volumes/b$/restic --password-file /Volumes/b$/!Apps/Restic/password.txt snapshots

repository 3cc4819d opened successfully, password is correct

Save(<lock/07d5ca9565>) returned error, retrying after 552.330144ms: Sync: sync /Volumes/b$/restic/locks/07d5ca956503c160e8dbda361a5f5cb04d2551e5761cd2126d8d3d00915a73dd: operation not supported

Save(<lock/07d5ca9565>) returned error, retrying after 1.080381816s: Sync: sync /Volumes/b$/restic/locks/07d5ca956503c160e8dbda361a5f5cb04d2551e5761cd2126d8d3d00915a73dd: operation not supported

Save(<lock/07d5ca9565>) returned error, retrying after 1.31013006s: Sync: sync /Volumes/b$/restic/locks/07d5ca956503c160e8dbda361a5f5cb04d2551e5761cd2126d8d3d00915a73dd: operation not supported

Save(<lock/07d5ca9565>) returned error, retrying after 1.582392691s: Sync: sync /Volumes/b$/restic/locks/07d5ca956503c160e8dbda361a5f5cb04d2551e5761cd2126d8d3d00915a73dd: operation not supported

Save(<lock/07d5ca9565>) returned error, retrying after 2.340488664s: Sync: sync /Volumes/b$/restic/locks/07d5ca956503c160e8dbda361a5f5cb04d2551e5761cd2126d8d3d00915a73dd: operation not supported

signal interrupt received, cleaning up

Any idea what’s going on?

Could be my repo is still somewhat damaged even after running prune (see prior thread), but Windows can list the snapshots (and apparently restore) without issue.

I’ll try to mount the repo directly from the external drive hosting it once this restore (and a few ongoing backups) are finished and report back.

EDIT: Apparently it’s a locking issue. I can use --no-lock and list snapshots, but I still can’t mount. Does mounting require exclusive access?

Are you using credentials that don’t have write access?

Nope. Using the same user credentials that the backup itself uses. Just did a double-check, and that user has complete read-write access to the volume. I also copied a text file and then deleted it from inside the repo. Not a problem.

Aha, I see. I misinterpreted the error message.

The sync operation is failing, presumably because Mac’s CIFS driver does not support it. I’m not sure what could be done about this… @fd0, would it make sense to ignore the “operation not supported” errno for Sync()? If the underlying storage doesn’t support it, there’s not much we can do about it anyway.

1 Like

Yep, that’d be the best course of action I think. People use all sorts of odd file systems with the local backend…

3 Likes

I’m having the same sync ... operation not supported issue on my Mac (so smb is not working on the latest MacOs, Catalina or v10.15, either).

FWIW, I think this issue wasn’t present when I started using restic, almost three years ago. Pretty soon I switched to the faster sftp, and have been using that since.
Now I needed to do a restore, and when trying over SMB, got the error message.

Having the same issue on macOS 10.15.1 initializing a restic repo on a smb share:

$ mount
…
//myuser@myserver/myshare on /Volumes/myshare (smbfs, nodev, nosuid, mounted by myuser)
…
$ restic init --repo /Volumes/myshare/tmp/restic-repo
enter password for new repository: …
enter password again: …
Fatal: create key in repository at /Volumes/myshare/tmp/restic-repo failed: Sync: sync /Volumes/myshare/tmp/restic-repo/keys/a17237c3c5fdf5b580c34d747ac9eaba1f4f86f1304b2b10f6054822c60ce793: operation not supported
$ restic version
+restic 0.9.6 compiled with go1.13.4 on darwin/amd64

I have full write access to that folder.

Is there any solution or workaround for this problem yet? I’m having the same issue which currently holds me back of using restic. Or is it possible to ignore the “operation not supported” error for Sync() like proposed?
Thanks in advance!

Help wanted, we’d welcome a PR that fixes this as per @fd0’s comment. Please include the symptoms and such in the description of it.

Sure, use something better than SMB for your precious repository, e.g. rest-server.

Okay. I looked into the code and as far as I understood sync errors should be completely ignored? If so I guess I’d have to remove the error handling in this and the following 3 lines. Is that right? But to be honest I don’t really feel comfortable doing that because I just looked into the code for 5 minutes and don’t really feel confident that I can estimate possible other consequences if I just remove this error handling.

Unfortunately my setup is a bit special and this isn’t really an option in my case.

Looking at the code you referenced it sure seems like that is what needs to be ignored. You can try that modification and then build restic yourself (check the documentation, it’s really easy and all you need is Go), and see if it solves the problem for you. Please report back regardless.

There’s also the archiver_test.go that tests Sync(), so that would probably need to be dealt with as well. I haven’t digged into the code but I have a feeling that one isn’t as tied to the local filesystem backend so perhaps it’s not as straight forward to just remove that as well. Needs investigating.

Ignoring the “operation not supported” error is already implemented by the following PR (I’ve rebased it to the current master branch just now):

The Sync() call in the archiver test shouldn’t be a problem, as the temporary test repositories typically reside on a local filesystem which supports the Sync operation.

2 Likes

The PR that @MichaelEischer revived has now been merged to the master branch. In order to use it (and a lot of other improvements at the same time), you can use the latest master builds, the fix should be in the most recent one there.

1 Like