s3cmd icon indicating copy to clipboard operation
s3cmd copied to clipboard

s3cmd get isn't working

Open mike-bhs opened this issue 9 years ago • 7 comments

For some reason s3cmd get isn't working by me when I'm trying to get file with public permission from my s3 bucket

$ s3cmd get s3://uploaded-videos/test.mp4 ./
download: 's3://uploaded-videos/test.mp4' -> './test.mp4'  [1 of 1]
download: 's3://uploaded-videos/test.mp4' -> './test.mp4'  [1 of 1]
download: 's3://uploaded-videos/test.mp4' -> './test.mp4'  [1 of 1]
ERROR: S3 error: 400 (Bad Request)

but when I used sync instead of get everything worked fine

$ s3cmd sync s3://uploaded-videos/test.mp4 ./
download: 's3://uploaded-videos/test.mp4' -> './test.mp4'  [1 of 1]
 41879599 of 41879599   100% in    1s    28.32 MB/s  done
Done. Downloaded 41879599 bytes in 1.4 seconds, 28.25 MB/s.

But this issue appears only when I'm trying to download videos, that were uploaded recently Older videos (which I have uploaded week ago) can be successfully downloaded using s3cmd get or s3cmd sync

mike-bhs avatar Mar 10 '17 12:03 mike-bhs

@malworm : Can you precise which version of s3cmd that you are using and if you target the standard aws S3 or a custom server.

Also, you can run s3cmd with the "-d" flag that will give you a lot of details about what is going on. That should give us enough information on what operation is failing in the case of your get.

fviard avatar Mar 14 '17 12:03 fviard

I have the same error for the Frankfurt region with server side encryption enabled. No issues with us-east-1 I didn't test other regions Debug Output: `jochen@Jochen-HP:~/test-enc-core$ s3cmd get s3://test-enc-core/file1 ./ -d DEBUG: s3cmd version 1.6.1 DEBUG: ConfigParser: Reading file '/home/jochen/.s3cfg' DEBUG: ConfigParser: access_key->AK...17_chars...Q DEBUG: ConfigParser: access_token-> DEBUG: ConfigParser: add_encoding_exts-> DEBUG: ConfigParser: add_headers-> DEBUG: ConfigParser: bucket_location->Ireland DEBUG: ConfigParser: ca_certs_file-> DEBUG: ConfigParser: cache_file-> DEBUG: ConfigParser: check_ssl_certificate->True DEBUG: ConfigParser: check_ssl_hostname->True DEBUG: ConfigParser: cloudfront_host->cloudfront.amazonaws.com DEBUG: ConfigParser: default_mime_type->binary/octet-stream DEBUG: ConfigParser: delay_updates->False DEBUG: ConfigParser: delete_after->False DEBUG: ConfigParser: delete_after_fetch->False DEBUG: ConfigParser: delete_removed->False DEBUG: ConfigParser: dry_run->False DEBUG: ConfigParser: enable_multipart->True DEBUG: ConfigParser: encoding->UTF-8 DEBUG: ConfigParser: encrypt->False DEBUG: ConfigParser: expiry_date-> DEBUG: ConfigParser: expiry_days-> DEBUG: ConfigParser: expiry_prefix-> DEBUG: ConfigParser: follow_symlinks->False DEBUG: ConfigParser: force->False DEBUG: ConfigParser: get_continue->False DEBUG: ConfigParser: gpg_command->/usr/bin/gpg DEBUG: ConfigParser: gpg_decrypt->%(gpg_command)s -d --verbose --no-use-agent --batch --yes --passphrase-fd %(passphrase_fd)s -o %(output_file)s %(input_file)s DEBUG: ConfigParser: gpg_encrypt->%(gpg_command)s -c --verbose --no-use-agent --batch --yes --passphrase-fd %(passphrase_fd)s -o %(output_file)s %(input_file)s DEBUG: ConfigParser: gpg_passphrase->pp...1_chars...p DEBUG: ConfigParser: guess_mime_type->True DEBUG: ConfigParser: host_base->s3.amazonaws.com DEBUG: ConfigParser: host_bucket->%(bucket)s.s3.amazonaws.com DEBUG: ConfigParser: human_readable_sizes->False DEBUG: ConfigParser: invalidate_default_index_on_cf->False DEBUG: ConfigParser: invalidate_default_index_root_on_cf->True DEBUG: ConfigParser: invalidate_on_cf->False DEBUG: ConfigParser: kms_key-> DEBUG: ConfigParser: limitrate->0 DEBUG: ConfigParser: list_md5->False DEBUG: ConfigParser: log_target_prefix-> DEBUG: ConfigParser: long_listing->False DEBUG: ConfigParser: max_delete->-1 DEBUG: ConfigParser: mime_type-> DEBUG: ConfigParser: multipart_chunk_size_mb->15 DEBUG: ConfigParser: multipart_max_chunks->10000 DEBUG: ConfigParser: preserve_attrs->True DEBUG: ConfigParser: progress_meter->True DEBUG: ConfigParser: proxy_host-> DEBUG: ConfigParser: proxy_port->0 DEBUG: ConfigParser: put_continue->False DEBUG: ConfigParser: recursive->False DEBUG: ConfigParser: recv_chunk->65536 DEBUG: ConfigParser: reduced_redundancy->False DEBUG: ConfigParser: requester_pays->False DEBUG: ConfigParser: restore_days->1 DEBUG: ConfigParser: secret_key->uI...37_chars...I DEBUG: ConfigParser: send_chunk->65536 DEBUG: ConfigParser: server_side_encryption->False DEBUG: ConfigParser: signature_v2->False DEBUG: ConfigParser: simpledb_host->sdb.amazonaws.com DEBUG: ConfigParser: skip_existing->False DEBUG: ConfigParser: socket_timeout->300 DEBUG: ConfigParser: stats->False DEBUG: ConfigParser: stop_on_error->False DEBUG: ConfigParser: storage_class-> DEBUG: ConfigParser: urlencoding_mode->normal DEBUG: ConfigParser: use_https->True DEBUG: ConfigParser: use_mime_magic->True DEBUG: ConfigParser: verbosity->WARNING DEBUG: ConfigParser: website_endpoint->http://%(bucket)s.s3-website-%(location)s.amazonaws.com/ DEBUG: ConfigParser: website_error-> DEBUG: ConfigParser: website_index->index.html DEBUG: Updating Config.Config cache_file -> DEBUG: Updating Config.Config follow_symlinks -> False DEBUG: Updating Config.Config verbosity -> 10 DEBUG: Unicodising 'get' using UTF-8 DEBUG: Unicodising 's3://test-enc-core/file1' using UTF-8 DEBUG: Unicodising './' using UTF-8 DEBUG: Command: get DEBUG: DeUnicodising u'file1' using UTF-8 DEBUG: Unicodising 'file1' using UTF-8 DEBUG: Applying --exclude/--include DEBUG: CHECK: file1 DEBUG: PASS: u'file1' INFO: Summary: 1 remote files to download DEBUG: DeUnicodising u'./' using UTF-8 DEBUG: DeUnicodising u'./' using UTF-8 DEBUG: DeUnicodising u'./file1' using UTF-8 DEBUG: Unicodising './file1' using UTF-8 DEBUG: DeUnicodising u'./file1' using UTF-8 DEBUG: DeUnicodising u'./file1' using UTF-8 DEBUG: String 'file1' encoded to 'file1' DEBUG: CreateRequest: resource[uri]=/file1 DEBUG: Using signature v4 DEBUG: get_hostname(test-enc-core): test-enc-core.s3.amazonaws.com DEBUG: canonical_headers = host:test-enc-core.s3.amazonaws.com x-amz-content-sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 x-amz-date:20170608T141825Z

DEBUG: Canonical Request: GET /file1

host:test-enc-core.s3.amazonaws.com x-amz-content-sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 x-amz-date:20170608T141825Z

host;x-amz-content-sha256;x-amz-date e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855

DEBUG: signature-v4 headers: {'x-amz-content-sha256': 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', 'Authorization': 'AWS4-HMAC-SHA256 Credential=AKIAJPKLNXBYJUYCY7XQ/20170608/Ireland/s3/aws4_request,SignedHeaders=host;x-amz-content-sha256;x-amz-date,Signature=beeec00cb59852a1bbbe78eff4cafe15c7487e8aa2589bc690fdf24233a5b5dd', 'x-amz-date': '20170608T141825Z'} DEBUG: Unicodising './file1' using UTF-8 download: 's3://test-enc-core/file1' -> './file1' [1 of 1] DEBUG: get_hostname(test-enc-core): test-enc-core.s3.amazonaws.com DEBUG: ConnMan.get(): creating new connection: https://test-enc-core.s3.amazonaws.com DEBUG: Using ca_certs_file None DEBUG: Recognized AWS S3 host, disabling initial SSL hostname check DEBUG: httplib.HTTPSConnection() has only context DEBUG: non-proxied HTTPSConnection(test-enc-core.s3.amazonaws.com) DEBUG: format_uri(): /file1 DEBUG: Response: {'status': 400, 'headers': {'x-amz-id-2': 'Ah0RyOvxFsVfrVPybojehJPHax6A3cvrRhPe5fTOdaT2xZFXfH9ha0KmB59/1UvdFvq4FsqT3jE=', 'server': 'AmazonS3', 'transfer-encoding': 'chunked', 'connection': 'close', 'x-amz-request-id': 'EE700BA58D910CEB', 'date': 'Thu, 08 Jun 2017 14:18:30 GMT', 'content-type': 'application/xml'}, 'reason': 'Bad Request'} DEBUG: Falling back to signature v2 DEBUG: Using signature v2 DEBUG: SignHeaders: 'GET\n\n\n\nx-amz-content-sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855\nx-amz-date:Thu, 08 Jun 2017 14:18:31 +0000\n/test-enc-core/file1' DEBUG: Unicodising './file1' using UTF-8 download: 's3://test-enc-core/file1' -> './file1' [1 of 1] DEBUG: get_hostname(test-enc-core): test-enc-core.s3.amazonaws.com DEBUG: ConnMan.get(): creating new connection: https://test-enc-core.s3.amazonaws.com DEBUG: Recognized AWS S3 host, disabling initial SSL hostname check DEBUG: httplib.HTTPSConnection() has only context DEBUG: non-proxied HTTPSConnection(test-enc-core.s3.amazonaws.com) DEBUG: format_uri(): /file1 DEBUG: Response: {'status': 400, 'headers': {'x-amz-region': 'eu-central-1', 'x-amz-id-2': 'tGpzCxkxf0N25dw8W4LYBOxAcLue8WQs+x0b9k/i6gIwn5wHrdqoycRx0ZTDUcmCxZZGoqw0syo=', 'server': 'AmazonS3', 'transfer-encoding': 'chunked', 'connection': 'close', 'x-amz-request-id': '1E3CFC9C57720BA8', 'date': 'Thu, 08 Jun 2017 14:18:30 GMT', 'content-type': 'application/xml'}, 'reason': 'Bad Request'} DEBUG: S3Error: 400 (Bad Request) DEBUG: HttpHeader: x-amz-region: eu-central-1 DEBUG: HttpHeader: x-amz-id-2: tGpzCxkxf0N25dw8W4LYBOxAcLue8WQs+x0b9k/i6gIwn5wHrdqoycRx0ZTDUcmCxZZGoqw0syo= DEBUG: HttpHeader: server: AmazonS3 DEBUG: HttpHeader: transfer-encoding: chunked DEBUG: HttpHeader: connection: close DEBUG: HttpHeader: x-amz-request-id: 1E3CFC9C57720BA8 DEBUG: HttpHeader: date: Thu, 08 Jun 2017 14:18:30 GMT DEBUG: HttpHeader: content-type: application/xml DEBUG: object_get failed for './file1', deleting... DEBUG: DeUnicodising u'./file1' using UTF-8 ERROR: S3 error: 400 (Bad Request) `

Jochen2584 avatar Jun 08 '17 14:06 Jochen2584

Same here for Frankfurt region. No issues downloading it with awscli, that worked for me. (pip install awscli; aws s3 cp s3://[BUCKET]/[FILE] [LOCAL_FILE])

DenisStad avatar Apr 13 '18 15:04 DenisStad

@DenisStad Can you try with the last version 2.0.1 ? And eventually with the last MASTER version?

Also, if you were able to post a debug output ("-d") flag it could help understand the issue. And btw, is there any special / non ascii characters in the file name of the files having issue to transfer?

fviard avatar Apr 13 '18 15:04 fviard

Oh interesting, I was on 1.6.1. I was on a new distribution and did apt-get install s3cmd, so I assumed I had the latest. Uninstalled it, did pip install s3cmd, now am on 2.0.1 and it works!

Filename is data.7z.

Distro is Ubuntu 16.04.4 LTS. After doing apt-get update, still shows 1.6.1 as latest version, but not sure if there is an official way to install s3cmd.

DenisStad avatar Apr 13 '18 15:04 DenisStad

ok, so a probably already fixed issue. pip install s3cmd is the best "official" way to install s3cmd as it is always the most up to date.

There is more private apt repos for s3cmd, and so update are up to the maintainers of the distributions.

fviard avatar Apr 13 '18 16:04 fviard

great, that also solved my issue! Thanks for sharing

kveys avatar Oct 17 '19 14:10 kveys