Open philipmw opened 2 weeks ago
Hi, stat
is a HEAD
request, which doesn't have a body, so we don't have additional information to return here.
It's very weird that HEAD can return a 400
response since the request seems correct to me. Could you share more details about your setup? If you are using a static key, please double-check if the access key and secret key are configured correctly.
Hello! I didn't realize that this is a HEAD request and that there's no more info to show me.
Yes, this problem has been perplexing me. I quadruple checked the access key, and it is the same bucket config that I use for restic that works. (Though I have not tried restic with this bucket.)
Here is my full rustic.toml
:
[backup]
glob-files = ["/Users/pmw/Documents/laptop/backups/includes.dat"]
[repository]
repository = "opendal:s3"
repo-hot = "opendal:s3"
password-file = "/Users/pmw/Documents/laptop/backups/restic-repo-password.dat"
[repository.options]
access_key_id = "AKIA..."
secret_access_key = "..."
[repository.options-cold]
bucket = "pmw-backups-laptop-rustic-cold"
default_storage_class = "DEEP_ARCHIVE"
[repository.options-hot]
bucket = "pmw-backups-laptop-rustic-hot"
Hi, @philipmw, thank you for providing more information on this. It's really helpful.
I now believe it's related to the DEEP_ARCHIVE
storage class, which needs to be restored before it can be read. Calling stat
(also known as HeadObject
) on an archived file may return a 400 error. Please refer to https://docs.aws.amazon.com/AmazonS3/latest/API/API_RestoreObject.html for more details.
To verify my answer, please try using s3cmd
to send a HeadObject or GetObject request to the same object.
cc @simonsan and @aawsome, perhaps we should consider handling config
differently by not storing it as DEEP_ARCHIVE
.
Thanks. The command I am running is rustic init
, and both buckets are newly created and empty. I don't know what archived objects rustic is trying to stat or what I can do to get around it.
Thanks. The command I am running is
rustic init
, and both buckets are newly created and empty. I don't know what archived objects rustic is trying to stat or what I can do to get around it.
Hi, by setting default_storage_class = "DEEP_ARCHIVE"
, all files written in pmw-backups-laptop-rustic-cold
will be in DEEP_ARCHIVE
storage class.
Is this not what I should be doing? I do want the -cold
bucket to be in Deep Archive, and my understanding is that rustic supports this. An example of someone else configuring Deep Archive: https://kmh.prasil.info/posts/rustic-cold-storage-glacier-migration-configuration/
What's the right way to use Deep Archive with rustic?
Actually rustic should write the config file into the cold storage location as DEEP_ARCHIVE
, if it is specified like that.
While rustic will not access any file/object in the cold storage, it requires to list contents. For config
, it uses Operator::exists
which seems to be calling stat
internally. I wonder why this would return a 400 error.
@philipmw Did you ensure you have s3:GetObject
and s3:ListBucket
permission on your S3 bucket? If the error really is a 400 Bad Request
error, the AWS docu says that only occurs when using encryption and wrong encryption request headers. Can you double check on this?
Actually another test to rule out any permission stuff would be to run the same config without using default_storage_class
and see if the error still exists...
I am having a problem configuring rustic with a set of hot and cold S3 buckets. That may be its own bug, as I believe all permissions are properly configured, but the meta-bug that I want to report here is that rustic doesn't give me enough debug information, even at trace log level, to root-cause the issue.
What I want: for rustic to print the S3 response so I can see why S3 is returning a 400 status code.
What I get: just the status code and headers. S3 has a bunch of reasons why it would give a 400 status code, so I need more.
My request: print the full response from S3 when the log level is trace or even debug.
This is what the AWS CLI does -- when verbose output is enabled, I see the full request and response payload.