Please describe the problem.

When enabling an S3 remote with hybrid encryption, I get a file locking error:

$ git annex enableremote s3remote
git-annex: .git/annex/creds/__S3_REMOTE_UUID_REDACTED__: openFile: resource busy (file is locked)

I can confirm that this happens when no previous process is running (and lsof shows nothing open before running enableremote), for example in the motivating case here of cloning to a new, freshly-mounted HDD.

If I copy the .git/annex/creds/__S3_REMOTE_UUID_REDACTED__ file from an existing clone of the repository to this new one, then enableremote works fine.

$ git annex enableremote s3remote              
enableremote s3remote (encryption update) (to gpg keys: HEXREDACTED) ok
(recording state in git...)

What steps will reproduce the problem?

For me, with a source a repository that has a pre-configured S3 special remote:

$ git show git-annex:remote.log
__UUID__ bucket=bucket-name cipher=__base64_jibberish__ cipherkeys=GPGKEY_HEX datacenter=US host=s3.eu-central-003.backblazeb2.com name=s3remote partsize=512MiB port=80 protocol=https s3creds=__base64_jibberish__ signature=v4 storageclass=STANDARD type=S3 timestamp=168000000.0s

Then, to reproduce this:

git clone /path/to/established-repo new_clone
cd new_clone
git annex init new_clone
git annex enableremote s3remote

What version of git-annex are you using? On what operating system?

The latest:

$ git annex version
git-annex version: 10.20230926-g44a7b4c9734adfda5912dd82c1aa97c615689f57

Please provide any additional information below.

Have you had any luck using git-annex before? (Sometimes we get tired of reading bug reports all day and a lil' positive end note does wonders)

A great deal, we use it daily in our research and I also use it on some personal files -- thanks for all your efforts Joey et al.!

Reproduced and fixed. done --Joey