sops icon indicating copy to clipboard operation
sops copied to clipboard

Latest (3.7.2) linux amd64 binary not working

Open nklmilojevic opened this issue 4 years ago • 7 comments

-bash: ./sops-v3.7.2.linux.amd64: cannot execute binary file: Exec format error

Did something go wrong in the CI process? macOS binary is completely fine.

nklmilojevic avatar Mar 09 '22 20:03 nklmilojevic

@nklmilojevic this may be a silly question, but are you trying to do bash ./sops-v3.7.2.linux.amd64? Because it seems to work when you just invoke it without trying to make bash parse it as a script:

root@36faa215eb37:/# bash sops-v3.7.2.linux.amd64
sops-v3.7.2.linux.amd64: sops-v3.7.2.linux.amd64: cannot execute binary file
root@36faa215eb37:/# ./sops-v3.7.2.linux.amd64 -h
NAME:
   sops - sops - encrypted file editor with AWS KMS, GCP KMS, Azure Key Vault, age, and GPG support

USAGE:
   sops is an editor of encrypted files that supports AWS KMS and PGP
  [..]

FnTm avatar Mar 09 '22 21:03 FnTm

@FnTm It is not a silly question, all suggestions are welcome :)

 5.4.0-1019-gcp #19-Ubuntu SMP Tue Jun 23 15:46:40 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
$ wget https://github.com/mozilla/sops/releases/download/v3.7.2/sops-v3.7.2.linux.amd64
Saving to: ‘sops-v3.7.2.linux.amd64’

sops-v3.7.2.linux.amd64                                 100%[==============================================================================================================================>]  24.39M  28.2MB/s    in 0.9s

2022-03-09 21:35:58 (28.2 MB/s) - ‘sops-v3.7.2.linux.amd64’ saved [25573664/25573664]

$ chmod +x sops-v3.7.2.linux.amd64
$ ./sops-v3.7.2.linux.amd64 --version
-bash: ./sops-v3.7.2.linux.amd64: cannot execute binary file: Exec format error

Don't know why is it trying to use bash to execute when I'm clearly executing the binary itself. Am I missing someting obvious?

nklmilojevic avatar Mar 09 '22 21:03 nklmilojevic

It seems to be built with the wrong architecture.

% file ~/Downloads/sops-v3.7.2.linux.amd64
~/Downloads/sops-v3.7.2.linux.amd64: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), statically linked, Go BuildID=BV9XBEHJegT6xOjMgkdr/vnn6LGCxeAwZUWOu7MBs/BUhtoJEVbcXWaliWIqXY/aGyuk_ewS-IqGheG3Sag, not stripped

cw-sakamoto avatar Mar 10 '22 07:03 cw-sakamoto

This commit seems like it could have something to do with this issue - https://github.com/mozilla/sops/commit/c58653474cfc3939f526b2beea5aca9d41b626a0

FnTm avatar Mar 10 '22 07:03 FnTm

Looked at things with fresh eyes, and I think this is what's happening:

  • The build step that creates the .linux.amd64 file just copies a binary which is already vendored, with the assumption that this binary is the arch=amd64 binary. That binary was a byproduct of creating rpm/deb package steps.
  • My introduction of ARM64 deb/rpm builds (https://github.com/mozilla/sops/pull/891/files#diff-76ed074a9305c04054cdebb9e9aad2d818052b07091de1f20cad0bbac34ffb52R90) modified the situation by building arm64 builds as the last ones, thus the assumption about the arch of the existing file was wrong.

That is why I think that particular build is not as expected.

FnTm avatar Mar 10 '22 12:03 FnTm

Is a new release planned to address this, or is a fix just going to have to wait until the other issues in the 3.7.3 milestone are also complete? Alternatively, could someone manually attach the 3.7.2 amd64 build to the existing github release?

philomory avatar Mar 11 '22 02:03 philomory

Thank you @FnTm for the fix in #1026

New binaries have been uploaded.

ajvb avatar Mar 11 '22 18:03 ajvb