Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error saving lock file in v0.13 on M1 Mac using SMB backend #3720

Closed
jeffmaxton opened this issue Apr 24, 2022 · 5 comments · Fixed by #3752
Closed

Error saving lock file in v0.13 on M1 Mac using SMB backend #3720

jeffmaxton opened this issue Apr 24, 2022 · 5 comments · Fixed by #3752

Comments

@jeffmaxton
Copy link

jeffmaxton commented Apr 24, 2022

Output of restic version

restic version
restic 0.13.1 compiled with go1.18 on darwin/arm64
~/.restic

How did you run restic exactly?

from a script file with contents of:

#! /bin/bash -e

export RESTIC_REPOSITORY=/Volumes/restic-jeff/MBPr15
export RESTIC_PASSWORD= <<REDACTED>>

./restic_0.12.1_darwin_arm64 --verbose --tag MacBookAir2020 backup ~/Dendron

What backend/server/service did you use to store the repository?

SMB

Expected behavior

Not to error out creating lock file

Actual behavior

This is the results of running the script
(note that if I watch that folder in Finder, I do see a lock file beginning with that name appear and then disappear in the locks directory)

> ./backup-dendron.sh
open repository
repository 69a19a6a opened successfully, password is correct
lock repository
Save(<lock/071fe833f0>) returned error, retrying after 552.330144ms: sync /Volumes/restic-jeff/MBPr15/locks: no such file or directory
Save(<lock/071fe833f0>) returned error, retrying after 1.080381816s: sync /Volumes/restic-jeff/MBPr15/locks: no such file or directory
Save(<lock/071fe833f0>) returned error, retrying after 1.31013006s: sync /Volumes/restic-jeff/MBPr15/locks: no such file or directory
Save(<lock/071fe833f0>) returned error, retrying after 1.582392691s: sync /Volumes/restic-jeff/MBPr15/locks: no such file or directory
Save(<lock/071fe833f0>) returned error, retrying after 2.340488664s: sync /Volumes/restic-jeff/MBPr15/locks: no such file or directory
Save(<lock/071fe833f0>) returned error, retrying after 4.506218855s: sync /Volumes/restic-jeff/MBPr15/locks: no such file or directory
Save(<lock/071fe833f0>) returned error, retrying after 3.221479586s: sync /Volumes/restic-jeff/MBPr15/locks: no such file or directory
Save(<lock/071fe833f0>) returned error, retrying after 5.608623477s: sync /Volumes/restic-jeff/MBPr15/locks: no such file or directory
Save(<lock/071fe833f0>) returned error, retrying after 7.649837917s: sync /Volumes/restic-jeff/MBPr15/locks: no such file or directory
Save(<lock/071fe833f0>) returned error, retrying after 15.394871241s: sync /Volumes/restic-jeff/MBPr15/locks: no such file or directory
sync /Volumes/restic-jeff/MBPr15/locks: no such file or directory
github.com/restic/restic/internal/backend/local.(*Local).Save
	github.com/restic/restic/internal/backend/local/local.go:169
github.com/restic/restic/internal/limiter.rateLimitedBackend.Save
	github.com/restic/restic/internal/limiter/limiter_backend.go:30
github.com/restic/restic/internal/backend.(*RetryBackend).Save.func1
	github.com/restic/restic/internal/backend/backend_retry.go:66
github.com/cenkalti/backoff/v4.RetryNotifyWithTimer
	github.com/cenkalti/backoff/v4@v4.1.1/retry.go:55
github.com/cenkalti/backoff/v4.RetryNotify
	github.com/cenkalti/backoff/v4@v4.1.1/retry.go:34
github.com/restic/restic/internal/backend.(*RetryBackend).retry
	github.com/restic/restic/internal/backend/backend_retry.go:46
github.com/restic/restic/internal/backend.(*RetryBackend).Save
	github.com/restic/restic/internal/backend/backend_retry.go:60
github.com/restic/restic/internal/cache.(*Backend).Save
	github.com/restic/restic/internal/cache/backend.go:59
github.com/restic/restic/internal/repository.(*Repository).SaveUnpacked
	github.com/restic/restic/internal/repository/repository.go:330
github.com/restic/restic/internal/repository.(*Repository).SaveJSONUnpacked
	github.com/restic/restic/internal/repository/repository.go:310
github.com/restic/restic/internal/restic.(*Lock).createLock
	github.com/restic/restic/internal/restic/lock.go:163
github.com/restic/restic/internal/restic.newLock
	github.com/restic/restic/internal/restic/lock.go:107
github.com/restic/restic/internal/restic.NewLock
	github.com/restic/restic/internal/restic/lock.go:68
main.lockRepository
	github.com/restic/restic/cmd/restic/lock.go:42
main.lockRepo
	github.com/restic/restic/cmd/restic/lock.go:23
main.runBackup
	github.com/restic/restic/cmd/restic/cmd_backup.go:556
main.glob..func2
	github.com/restic/restic/cmd/restic/cmd_backup.go:61
github.com/spf13/cobra.(*Command).execute
	github.com/spf13/cobra@v1.2.1/command.go:856
github.com/spf13/cobra.(*Command).ExecuteC
	github.com/spf13/cobra@v1.2.1/command.go:974
github.com/spf13/cobra.(*Command).Execute
	github.com/spf13/cobra@v1.2.1/command.go:902
main.main
	github.com/restic/restic/cmd/restic/main.go:98
runtime.main
	runtime/proc.go:250
runtime.goexit
	runtime/asm_arm64.s:1259
unable to create lock in backend
>

Steps to reproduce the behavior

Run Restic with any command that requires creating a lock file

Do you have any idea what may have caused this?

Something in v0.13.0 seems to have caused this.
I get this error with both the 0.13.0 and 0.13.1 binaries, but when I run with the 0.12.1 binary it works fine.

The symptom seems to be very similar to a prior issue: #2395

Do you have an idea how to solve the issue?

Unfortunately, no. For now I've reverted back to running v0.12.1

Did restic help you today? Did it make you happy in any way?

Restic has been an awesome backup tool...but something in v13 broke it for me :(

@fd0 fd0 added the type: bug label Apr 27, 2022
@fd0
Copy link
Member

fd0 commented Apr 27, 2022

Thanks for the report! It is another case of a file system which does not support the sync() syscall, and it looks like our code does not catch it. Can you build restic yourself with the following patch and try again? That should tell us exactly what error it is, so we can amend our check.

diff --git a/internal/backend/local/local.go b/internal/backend/local/local.go
index 0ae023b8..a92ce091 100644
--- a/internal/backend/local/local.go
+++ b/internal/backend/local/local.go
@@ -2,6 +2,7 @@ package local
 
 import (
 	"context"
+	"fmt"
 	"hash"
 	"io"
 	"io/ioutil"
@@ -166,6 +167,9 @@ func (b *Local) Save(ctx context.Context, h restic.Handle, rd restic.RewindReade
 	// Ignore error if filesystem does not support fsync.
 	err = f.Sync()
 	syncNotSup := errors.Is(err, syscall.ENOTSUP)
+	if err != nil {
+		fmt.Fprintf(os.Stderr, "sync error (%T): %#v, notsupported: %v\n", err, err, syncNotSup)
+	}
 	if err != nil && !syncNotSup {
 		return errors.WithStack(err)
 	}

@MichaelEischer
Copy link
Member

Searching for the error in the go source code turns up syscall.ENOENT. I've no idea why one would return that error when sync is not supported...

@fd0
Copy link
Member

fd0 commented May 2, 2022

@MichaelEischer
Copy link
Member

MichaelEischer commented May 11, 2022

Another case: https://forum.restic.net/t/since-the-last-update-i-get-the-operation-not-supported-error/5006

I think the problem in the forum is unrelated as the error reports a different operation and path.

@MichaelEischer
Copy link
Member

Could you test whether #3752 fixes the problem for you?

@fd0 fd0 closed this as completed in #3752 May 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants