Rsync copyto failed to create bucket

What is the problem you are having with rclone?

rclone copyto fails due to insufficient privileges (likely tries to create a new bucket unnecessarily) while rclone sync works for copying the same file to the same dest.

When I run rclone copyto, I get the following:

$ rclone copyto /mnt/data/b2test/b2backup.timestamp backblaze:testbucket743vlosf244
2024/12/15 13:10:26 ERROR : b2backup.timestamp: Failed to copy: failed to create bucket: Unknown 401  (401 unauthorized)
2024/12/15 13:10:26 ERROR : Attempt 1/3 failed with 1 errors and: failed to create bucket: Unknown 401  (401 unauthorized)
2024/12/15 13:12:11 ERROR : b2backup.timestamp: Failed to copy: failed to create bucket: Unknown 401  (401 unauthorized)
2024/12/15 13:12:11 ERROR : Attempt 2/3 failed with 1 errors and: failed to create bucket: Unknown 401  (401 unauthorized)
2024/12/15 13:13:48 ERROR : b2backup.timestamp: Failed to copy: failed to create bucket: Unknown 401  (401 unauthorized)
2024/12/15 13:13:48 ERROR : Attempt 3/3 failed with 1 errors and: failed to create bucket: Unknown 401  (401 unauthorized)
2024/12/15 13:13:48 NOTICE: Failed to copyto: failed to create bucket: Unknown 401  (401 unauthorized)

To compare, the output of rclone sync:

$ rclone sync /mnt/data/b2test backblaze:testbucket743vlosf244 -vv        
2024/12/15 13:07:31 DEBUG : rclone: Version "1.68.1" starting with parameters ["rclone" "sync" "/mnt/data/b2test" "backblaze:testbu
cket743vlosf244" "-vv"]                                                                                                            
2024/12/15 13:07:31 DEBUG : Creating backend with remote "/mnt/data/b2test"
2024/12/15 13:07:31 DEBUG : Using config file from "/home/uint/.config/rclone/rclone.conf"                                         
2024/12/15 13:07:31 DEBUG : Creating backend with remote "backblaze:testbucket743vlosf244"                                         
2024/12/15 13:07:33 DEBUG : b2backup.timestamp: Sizes differ (src 38 vs dst 33)                
2024/12/15 13:07:33 DEBUG : B2 bucket testbucket743vlosf244: Waiting for checks to finish
2024/12/15 13:07:33 DEBUG : B2 bucket testbucket743vlosf244: Waiting for transfers to finish   
2024/12/15 13:07:34 DEBUG : b2backup.timestamp: sha1 = b1d6a1099e8a8d4c04556f0d5cffa8ce408b6b80 OK                                 
2024/12/15 13:07:34 INFO  : b2backup.timestamp: Copied (replaced existing)                     
2024/12/15 13:07:34 DEBUG : Waiting for deletions to finish                                                                        
2024/12/15 13:07:34 INFO  : 
Transferred:             38 B / 38 B, 100%, 0 B/s, ETA -
Checks:                 1 / 1, 100%
Transferred:            1 / 1, 100%
Elapsed time:         2.4s

2024/12/15 13:07:34 DEBUG : 11 go routines active

This looks similar to an issue other people reported for S3-compatible storages, so I added no_check_bucket = true to config but it did not seem to help. I am not sure if it's supposed to work for Backblaze that I am using.

I also use a key with the following permission list:

listBuckets, listFiles, readBucketEncryption,
readBucketNotifications, readBucketReplications,
readBuckets, readFiles, shareFiles, writeBucketEncryption,
writeBucketNotifications, writeBucketReplications, writeFiles

(compared to default, delete permissions were removed)

Run the command 'rclone version' and share the full output of the command.

rclone 1.68.1
- os/version: gentoo 2.17 (64 bit)
- os/kernel: 6.6.58-gentoo-r1 (x86_64)
- os/type: linux
- os/arch: amd64
- go/version: go1.23.1
- go/linking: dynamic
- go/tags: none

Which cloud storage system are you using? (eg Google Drive)

Backblaze

The command you were trying to run (eg rclone copy /tmp remote:tmp)

rclone copyto /mnt/data/b2test/b2backup.timestamp backblaze:testbucket743vlosf244

Please run 'rclone config redacted' and share the full output. If you get command not found, please make sure to update rclone.

[backblaze]
type = b2
account = XXX
key = XXX
no_check_bucket = true

A log from the command that you were trying to run with the -vv flag

welcome to the forum,

try rclone copy

that flag is for s3, not backblaze. so can remove it.

Thank you!

Tried, it gives the same error message (verbose log also looks more or less the same):

$ rclone copy /mnt/data/b2test/b2backup.timestamp backblaze:testbucket743vlosf244
2024/12/15 17:28:14 ERROR : b2backup.timestamp: Failed to copy: failed to create bucket: Unknown 401  (401 unauthorized)
2024/12/15 17:28:14 ERROR : Attempt 1/3 failed with 1 errors and: failed to create bucket: Unknown 401  (401 unauthorized)
2024/12/15 17:29:58 ERROR : b2backup.timestamp: Failed to copy: failed to create bucket: Unknown 401  (401 unauthorized)
2024/12/15 17:29:58 ERROR : Attempt 2/3 failed with 1 errors and: failed to create bucket: Unknown 401  (401 unauthorized)
2024/12/15 17:31:37 ERROR : b2backup.timestamp: Failed to copy: failed to create bucket: Unknown 401  (401 unauthorized)
2024/12/15 17:31:37 ERROR : Attempt 3/3 failed with 1 errors and: failed to create bucket: Unknown 401  (401 unauthorized)
2024/12/15 17:31:37 NOTICE: Failed to copy: failed to create bucket: Unknown 401  (401 unauthorized)

first, i would test using only default values for everything.
get that working before trying custom config.

With the default config it worked. Though you are right, the key was indeed the problem.

When I created a custom key, I used a set of privileges from the default key (and removed some). But, default key was limited to one bucket, and the custom one I created wasn't. So, looks like copy and copyto, when invoked for a non-bucket-restricted key, perform some additional operations that need corresponding permissions which were missing in my case (because the original key did not need them).

After I regenerated my custom key being limited to a single bucket, it works well. Thanks for the help!