Cannot purge AWS S3

What is the problem you are having with rclone?

Cannot purge AWS S3 bucket.

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

rclone v1.61.1

  • os/version: darwin 12.6.2 (64 bit)
  • os/kernel: 21.6.0 (arm64)
  • os/type: darwin
  • os/arch: arm64
  • go/version: go1.19.4
  • go/linking: dynamic
  • go/tags: none

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

AWS S3

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

rclone purge s3:hyperknot.com -vv --dump bodies

The rclone config contents with secrets removed.

[s3]
type = s3
provider = AWS

A log from the command with the -vv flag

--dump bodies in gist

hi,

incorrect region, the bucket is not in 'us-east-1' region at endpoint '', bucket is in 'eu-west-1' region

to the remote config, maybe add region = eu-west-1

can you re-post the config, please do not delete any lines, just redacted/remove text.

for this, --dump bodies should not be needed, keeps the log smaller.

The region redirect is working and has always been working. Purge was able to delete 99% of the files/versions, but is stuck on this.

The config contains nothing else:

[s3]
type = s3
provider = AWS
access_key_id = x
secret_access_key = x

Here is the log with region specified:

2023/02/16 02:38:53 DEBUG : rclone: Version "v1.61.1" starting with parameters ["rclone" "purge" "s3:hyperknot.com" "-vv" "--s3-region=eu-west-1"]
2023/02/16 02:38:53 DEBUG : Creating backend with remote "s3:hyperknot.com"
Enter configuration password:
password:
2023/02/16 02:38:55 DEBUG : Using config file from "/Users/user/.config/rclone/rclone.conf"
2023/02/16 02:38:55 DEBUG : s3: detected overridden config - adding "{91VpM}" suffix to name
2023/02/16 02:38:55 DEBUG : fs cache: renaming cache item "s3:hyperknot.com" to be canonical "s3{91VpM}:hyperknot.com"
2023/02/16 02:38:56 DEBUG : S3 bucket hyperknot.com: bucket is versioned: true
2023/02/16 02:38:56 DEBUG : Waiting for deletions to finish
2023/02/16 02:38:57 ERROR : Attempt 1/3 failed with 1 errors and: BucketNotEmpty: The bucket you tried to delete is not empty. You must delete all versions in the bucket.
	status code: 409, request id: CQ5NH2JFZPNB08D9, host id: MXxq7DsMQiZSqjL2mqW3BXng0qKt70ef0SHjyksNass65sBr+5x51XEH6f/yo5UTTOhcSwKAEws=
2023/02/16 02:38:57 DEBUG : Waiting for deletions to finish
2023/02/16 02:38:57 ERROR : Attempt 2/3 failed with 1 errors and: BucketNotEmpty: The bucket you tried to delete is not empty. You must delete all versions in the bucket.
	status code: 409, request id: CQ5H8MAFTZ8Q4CFV, host id: 3beYP/jM17lkip01XwW8YhYCHm/9I2uYxxxuZ2PzcWyfapS4ajM6vI64I8OgPiz8Vcer1vUt3+U=
2023/02/16 02:38:57 DEBUG : Waiting for deletions to finish
2023/02/16 02:38:57 ERROR : Attempt 3/3 failed with 1 errors and: BucketNotEmpty: The bucket you tried to delete is not empty. You must delete all versions in the bucket.
	status code: 409, request id: CQ5QGAWY7EJVQ9TP, host id: tA9S5ynQP1mASuyXidPunmzxPNJ29XgS1XlVKP5BpKdedK4herXI37xXwm8n5XeIsct1BSnbDn4=
2023/02/16 02:38:57 DEBUG : 6 go routines active
2023/02/16 02:38:57 Failed to purge: BucketNotEmpty: The bucket you tried to delete is not empty. You must delete all versions in the bucket.
	status code: 409, request id: CQ5QGAWY7EJVQ9TP, host id: tA9S5ynQP1mASuyXidPunmzxPNJ29XgS1XlVKP5BpKdedK4herXI37xXwm8n5XeIsct1BSnbDn4=

coud this be the reason why you cannot purge?

DEBUG : S3 bucket hyperknot.com: bucket is versioned: true
You must delete all versions in the bucket.

on the other hand,
the docs make it seem that purge will delete the current file and older versions.

But purge is exactly supposed to do that.

yes, that is what i get from reading the docs.

the 409 comes from aws.
might have to do with a setting in aws website console.

i do not know what the exact issue, but there should be enough for someone else to look at.

Hmm. By the look of your log you've got some 0 sized directory markers which rclone is ignoring.

Rclone doesn't make these - do you know which software does?

I think this is something rclone should be deleting for you but isn't at the moment.

I've used this bucket for many years with multiple tools, I have no idea which of them could have created them. Anyway I'm leaving the bucket as is so if you want I can test some PRs on it.

I've had a go at fixing that - can you try this?

v1.62.0-beta.6741.d1036599e.fix-s3-purge on branch fix-s3-purge (uploaded in 15-30 mins)

If you try first with -i then answer y to the first question and n to all subsequent ones you'll see what it is trying to do.

Hi Nick,

I've tried your build. It says that it's deleting the paths (writing "Deleted") but it's actually not. On subsequent run it tries to delete the same things.

Can you do a run with -vv --dump bodies and attach the result please? I need to know exactly what the path names are and what rclone is doing. If you want to email that log to me privately to nick@craig-wood.com that's fine - just put a link to this page in the email - thanks.

Sent the log in email. Since I've figured out that the problematic files in the upload did actually happen via rclone.

This was the full command in the upload script:

rclone sync --s3-bucket-acl=private --s3-acl=public-read --copy-links

Thanks for the log - that was very helpful.

GIve this a go

v1.62.0-beta.6763.f55bf8fb8.fix-s3-purge on branch fix-s3-purge (uploaded in 15-30 mins)

1 Like

Works perfectly, bucket purged! Thanks for the help!

Thanks for testing :slight_smile:

I've merged this to master now which means it will be in the latest beta in 15-30 minutes and released in v1.62

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.