Workaround for /usr/bin/jq: cannot execute binary file: Exec format error in Ubuntu on WSL
-bash: /usr/bin/jq: cannot execute binary file: Exec format error
(23) Failed writing body
Windows Defender and a bunch of other AV engines currently claim that the jq binary from the official Ubuntu Focal repository is malware.
Several reports to Microsoft have fallen on deaf ears.
It will quarantine jq and attempts to execute it will result in an error. A reinstall via apt is not possible. Restoring it from quarantine within the Windows Defender dashboard does not seem to work. The user can add Ubuntu’s WSL file system in the defender exclusion list but this is too broad for my liking. I decided to go with this workaround for now:
Replace /usr/bin/jq with the statically linked binary from jq’s GitHub repo
1) wget https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64
2) sha256sum jq-linux64
Should be af986793a515d500ab2d35f8d2aecd656e764504b789b66d7e1a0b727a124c44
3) sudo cp jq-linux64 /usr/bin/jq
4) sudo chmod 755 /usr/bin/jq
Leave a Reply