Skip to content

Failed to install using bash on Windows #2667

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
3 tasks done
lucasssvaz opened this issue Jul 16, 2024 · 20 comments
Closed
3 tasks done

Failed to install using bash on Windows #2667

lucasssvaz opened this issue Jul 16, 2024 · 20 comments
Assignees
Labels
conclusion: resolved Issue was resolved topic: infrastructure Related to project infrastructure type: imperfection Perceived defect in any part of project

Comments

@lucasssvaz
Copy link

Describe the problem

Since the latest release I can't install through the script. It originally started happening in our CI and I tested locally to make sure it is also happening.

https://github.com/espressif/arduino-esp32/actions/runs/9957218514/job/27508776142

As seen on the CI, this only happens in Windows.

To reproduce

lucas@Desktop-Win MINGW64 ~
$ curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | sh
Installing in /c/Users/lucas/bin
ARCH=64bit
OS=Windows
Using curl as download tool
Downloading https://downloads.arduino.cc/arduino-cli/arduino-cli_1.0.2_Windows_64bit.zip
Failed to install arduino-cli

lucas@Desktop-Win MINGW64 ~
$ curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | sh -s 1.0.1
Installing in /c/Users/lucas/bin
ARCH=64bit
OS=Windows
Using curl as download tool
Downloading https://downloads.arduino.cc/arduino-cli/arduino-cli_1.0.1_Windows_64bit.zip
Failed to install arduino-cli

lucas@Desktop-Win MINGW64 ~
$ curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | sh -s nightly-latest
Installing in /c/Users/lucas/bin
ARCH=64bit
OS=Windows
Using curl as download tool
Downloading https://downloads.arduino.cc/arduino-cli/nightly/arduino-cli_nightly-latest_Windows_64bit.zip
Failed to install arduino-cli

lucas@Desktop-Win MINGW64 ~
$ curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | BINDIR=. sh
Installing in .
ARCH=64bit
OS=Windows
Using curl as download tool
Downloading https://downloads.arduino.cc/arduino-cli/arduino-cli_1.0.2_Windows_64bit.zip
Failed to install arduino-cli

Expected behavior

Normal installation.

Arduino CLI version

1.0.2

Operating system

Windows

Operating system version

Windows 10/windows-latest

Additional context

No response

Issue checklist

  • I searched for previous reports in the issue tracker
  • I verified the problem still occurs when using the nightly build
  • My report contains all necessary details
@lucasssvaz lucasssvaz added the type: imperfection Perceived defect in any part of project label Jul 16, 2024
@P-R-O-C-H-Y
Copy link

@pillo79 Can you please take a look?

@pillo79
Copy link
Contributor

pillo79 commented Jul 24, 2024

cc @umbynos

@P-R-O-C-H-Y
Copy link

@umbynos
Copy link
Contributor

umbynos commented Jul 25, 2024

Hello, I just tried on a Windows machine with git bash installed and everything seems to work just fine:

$ curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | sh
Installing in /c/Users/Arduino/bin
ARCH=64bit
OS=Windows
Using curl as download tool
Downloading https://downloads.arduino.cc/arduino-cli/arduino-cli_1.0.3_Windows_64bit.zip
Archive:  /tmp/arduino-cli_1.0.3_Windows_64bit.zip
  inflating: /tmp/arduino-cli/arduino-cli.exe
  inflating: /tmp/arduino-cli/LICENSE.txt
arduino-cli  Version: 1.0.3 Commit: 8b6ad258 Date: 2024-07-23T08:45:25Z installed successfully in /c/Users/Arduino/bin

Additionally, if you are installing the arduino-cli in a workflow I recommend using https://github.com/arduino/setup-arduino-cli

@lucasssvaz
Copy link
Author

lucasssvaz commented Jul 25, 2024

Just run it again on a fresh install with git bash on Win 10 and same error happens:

lucas@Desktop-Win MINGW64 ~
$ curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | sh
Installing in /c/Users/lucas/bin
ARCH=64bit
OS=Windows
Using curl as download tool
Downloading https://downloads.arduino.cc/arduino-cli/arduino-cli_1.0.3_Windows_64bit.zip
Failed to install arduino-cli

@cmaglie
Copy link
Member

cmaglie commented Jul 25, 2024

Could you run with curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | bash -x so we have a bit more logs?

@lucasssvaz
Copy link
Author

lucas@Desktop-Win MINGW64 ~
$ curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | bash -x
+ PROJECT_OWNER=arduino
+ PROJECT_NAME=arduino-cli
+ EFFECTIVE_BINDIR=
+ DEFAULT_BINDIR=/c/Users/lucas/bin
+ trap bye EXIT
+ initDestination
+ '[' -n '' ']'
+ '[' '!' -d /c/Users/lucas/bin ']'
+ EFFECTIVE_BINDIR=/c/Users/lucas/bin
+ echo 'Installing in /c/Users/lucas/bin'
Installing in /c/Users/lucas/bin
+ set -e
+ initArch
++ uname -m
+ ARCH=x86_64
+ case $ARCH in
+ ARCH=64bit
+ echo ARCH=64bit
ARCH=64bit
+ initOS
++ uname -s
+ OS=MINGW64_NT-10.0-19045
+ case "$OS" in
+ OS=Windows
+ echo OS=Windows
OS=Windows
+ initFallbackArch
+ case "${OS}_${ARCH}" in
+ initDownloadTool
+ command -v curl
+ DOWNLOAD_TOOL=curl
+ echo 'Using curl as download tool'
Using curl as download tool
+ downloadFile ''
+ '[' -z '' ']'
+ checkLatestVersion
+ CHECKLATESTVERSION_REGEX='v\?[0-9][A-Za-z0-9\.-]*'
+ CHECKLATESTVERSION_LATEST_URL=https://github.com/arduino/arduino-cli/releases/latest
+ '[' curl = curl ']'
++ curl -SsL https://github.com/arduino/arduino-cli/releases/latest
++ grep -o '<title>Release v\?[0-9][A-Za-z0-9\.-]* · arduino/arduino-cli'
++ grep -o 'v\?[0-9][A-Za-z0-9\.-]*'
+ CHECKLATESTVERSION_TAG=v1.0.3
+ '[' v1.0.3 = '' ']'
+ TAG=v1.0.3
+ APPLICATION_DIST_PREFIX=arduino-cli_1.0.3_
+ '[' Windows = Windows ']'
+ APPLICATION_DIST_EXTENSION=.zip
+ APPLICATION_DIST=arduino-cli_1.0.3_Windows_64bit.zip
+ case "$TAG" in
+ DOWNLOAD_URL_PREFIX=https://downloads.arduino.cc/arduino-cli/
+ DOWNLOAD_URL=https://downloads.arduino.cc/arduino-cli/arduino-cli_1.0.3_Windows_64bit.zip
+ INSTALLATION_TMP_FILE=/tmp/arduino-cli_1.0.3_Windows_64bit.zip
+ echo 'Downloading https://downloads.arduino.cc/arduino-cli/arduino-cli_1.0.3_Windows_64bit.zip'
Downloading https://downloads.arduino.cc/arduino-cli/arduino-cli_1.0.3_Windows_64bit.zip
++ getFile https://downloads.arduino.cc/arduino-cli/arduino-cli_1.0.3_Windows_64bit.zip /tmp/arduino-cli_1.0.3_Windows_64bit.zip
++ GETFILE_URL=https://downloads.arduino.cc/arduino-cli/arduino-cli_1.0.3_Windows_64bit.zip
++ GETFILE_FILE_PATH=/tmp/arduino-cli_1.0.3_Windows_64bit.zip
++ '[' curl = curl ']'
+++ curl -s -w '%{http_code}' -L https://downloads.arduino.cc/arduino-cli/arduino-cli_1.0.3_Windows_64bit.zip -o /tmp/arduino-cli_1.0.3_Windows_64bit.zip
++ GETFILE_HTTP_STATUS_CODE=000
++ echo 000
+ httpStatusCode=000
+ '[' 000 -ne 200 ']'
+ '[' -n '' ']'
+ '[' 000 -ne 200 ']'
+ echo 'Did not find a release for your system: Windows 64bit'
Did not find a release for your system: Windows 64bit
+ echo 'Trying to find a release using the GitHub API.'
Trying to find a release using the GitHub API.
+ LATEST_RELEASE_URL=https://api.github.com/repos/arduino/arduino-cli/releases/tags/v1.0.3
+ '[' curl = curl ']'
++ curl -sL --write-out 'HTTPSTATUS:%{http_code}' https://api.github.com/repos/arduino/arduino-cli/releases/tags/v1.0.3
+ HTTP_RESPONSE=HTTPSTATUS:000
+ bye
+ BYE_RESULT=43
+ '[' 43 '!=' 0 ']'
+ echo 'Failed to install arduino-cli'
Failed to install arduino-cli
+ exit 43

@cmaglie
Copy link
Member

cmaglie commented Jul 25, 2024

I tried the same and on my PC I get:

+++ curl -s -w '%{http_code}' -L https://downloads.arduino.cc/arduino-cli/arduino-cli_1.0.3_Windows_64bit.zip -o /tmp/arduino-cli_1.0.3_Windows_64bit.zip
++ GETFILE_HTTP_STATUS_CODE=200
++ echo 200
+ httpStatusCode=200

it seems that your curl returns 000 instead of 200 🤔
could you try:

curl -s -w '%{http_code}' -L https://downloads.arduino.cc/arduino-cli/arduino-cli_1.0.3_Windows_64bit.zip -o /tmp/arduino-cli_1.0.3_Windows_64bit.zip

@cmaglie
Copy link
Member

cmaglie commented Jul 25, 2024

Also a curl --version mine is:

$ curl --version
curl 7.61.1 (x86_64-w64-mingw32) libcurl/7.61.1 OpenSSL/1.0.2p (WinSSL) zlib/1.2.11 libidn2/2.0.5 nghttp2/1.33.0
Release-Date: 2018-09-05
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp smtp smtps telnet tftp
Features: AsynchDNS IDN IPv6 Largefile SSPI Kerberos SPNEGO NTLM SSL libz TLS-SRP HTTP2 HTTPS-proxy MultiSSL Metalink

@lucasssvaz
Copy link
Author

lucas@Desktop-Win MINGW64 ~
$ curl -s -w '%{http_code}' -L https://downloads.arduino.cc/arduino-cli/arduino-cli_1.0.3_Windows_64bit.zip -o /tmp/arduino-cli_1.0.3_Windows_64bit.zip
000


lucas@Desktop-Win MINGW64 ~
$ curl --version
curl 8.8.0 (x86_64-w64-mingw32) libcurl/8.8.0 Schannel zlib/1.3.1 brotli/1.1.0 zstd/1.5.6 libidn2/2.3.7 libpsl/0.21.5 libssh2/1.11.0
Release-Date: 2024-05-22
Protocols: dict file ftp ftps gopher gophers http https imap imaps ipfs ipns ldap ldaps mqtt pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: alt-svc AsynchDNS brotli HSTS HTTPS-proxy IDN IPv6 Kerberos Largefile libz NTLM PSL SPNEGO SSL SSPI threadsafe UnixSockets zstd

@cmaglie
Copy link
Member

cmaglie commented Jul 25, 2024

Please, try:

curl -I -L https://downloads.arduino.cc/arduino-cli/arduino-cli_1.0.3_Windows_64bit.zip

(sorry for the long testing I'm a bit lost here... I'm trying to figure out what's happening with your curl)

@lucasssvaz
Copy link
Author

$ curl -I -L https://downloads.arduino.cc/arduino-cli/arduino-cli_1.0.3_Windows_64bit.zip
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0 15.2M    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0HTTP/1.1 200 OK
Date: Thu, 25 Jul 2024 19:33:01 GMT
Content-Type: application/zip
Content-Length: 15942283
Connection: keep-alive
CF-Ray: 8a8e94497e5f82e5-GIG
CF-Cache-Status: HIT
Accept-Ranges: bytes
Age: 110287
ETag: "438dd459e3cc8f312ef882d68fe80c7e-2"
Last-Modified: Tue, 23 Jul 2024 08:50:16 GMT
Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
Vary: Accept-Encoding
Via: 1.1 50fb19eda678e6a896981a444fb09aa6.cloudfront.net (CloudFront)
x-amz-cf-id: EdXDluf2OaIATJSTfNQyCMWwwUWccwY9vL_N2Z0sHOL3-zfg9r-a9w==
x-amz-cf-pop: MIA3-P3
x-amz-id-2: UuCPkJ05XTtqAYF6C/j1UuPYSF4VkHTdHn0n7Ncf7sXObkC4kqyFPB+H47ZSpvK/cjh8uUw43gWmWkaD7F/uFA==
x-amz-replication-status: COMPLETED
x-amz-request-id: FS133ZNW0HKYM6RF
x-amz-server-side-encryption: AES256
x-amz-version-id: ZCRd.9ppRtjB1b51.DEElxqFRdJLGARl
x-cache: Miss from cloudfront
Server: cloudflare

@lucasssvaz
Copy link
Author

lucas@Desktop-Win MINGW64 ~
$ curl -s -w '%{http_code}\n' -fL https://downloads.arduino.cc/arduino-cli/arduino-cli_1.0.3_Windows_64bit.zip ; echo "Exit code: $?"
000
Exit code: 43

From MAN:

43
Internal error. A function was called with a bad parameter.

BTW, If I do:

curl -L https://downloads.arduino.cc/arduino-cli/arduino-cli_1.0.3_Windows_64bit.zip -o arduino-cli.zip

It downloads fine.

@cmaglie
Copy link
Member

cmaglie commented Jul 30, 2024

At this point, I'm wondering if it's better to check both the exit code AND the HTTP status code (that may be 000 that means... "something" happened...).
I'm also keen to remove the -s, it will be a bit more verbose in normal conditions but will help to diagnose the problem in case of errors.

@per1234 per1234 added the topic: infrastructure Related to project infrastructure label Aug 4, 2024
@cmaglie
Copy link
Member

cmaglie commented Oct 25, 2024

@lucasssvaz
sorry for the long delay.
I've made a patch to install.sh, now it should display a better error message thanks to a --show-error flag:

$ curl -s http://asdhkjashdkjahd.com                            <- no error displayed due to -s
$ curl -s http://asdhkjashdkjahd.com --show-error
curl: (6) Could not resolve host: asdhkjashdkjahd.com

If you're still experiencing the error, would you like to give it a try?

The patch is here #2738
The updated install.sh can be downloaded here: https://raw.githubusercontent.com/arduino/arduino-cli/aed5066b2e52091aea87f5e992eb280be38c81d5/install.sh

@lucasssvaz
Copy link
Author

@cmaglie Just tested, still some issue with libcurl:

lucas@Desktop-Win MINGW64 ~
$ curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/aed5066b2e52091aea87f5e992eb280be38c81d5/install.sh | sh
Installing in /c/Users/lucas/bin
ARCH=64bit
OS=Windows
Using curl as download tool
Downloading https://downloads.arduino.cc/arduino-cli/arduino-cli_1.0.4_Windows_64bit.zip
curl: (43) A libcurl function was given a bad argument
Failed to install arduino-cli

@cmaglie
Copy link
Member

cmaglie commented Oct 25, 2024

It seems to be a problem with curl 8.8.0 -> curl/curl#13845
Can you try to update curl?

@lucasssvaz
Copy link
Author

I am using the curl version packed with git and even trying to update it fails, so probably this is the reason XD

C:\Users\lucas>git update-git-for-windows
Git for Windows 2.45.2.windows.1 (64-bit)
Update 2.47.0.windows.2 is available
curl: (43) A libcurl function was given a bad argument

I will reinstall everything and report back

@lucasssvaz
Copy link
Author

Now it works as expected, it was an issue with the curl version packed with git for windows. Thanks for the help debugging!

lucas@Desktop-Win MINGW64 ~
$ curl --version
curl 8.10.1 (x86_64-w64-mingw32) libcurl/8.10.1 Schannel zlib/1.3.1 brotli/1.1.0 zstd/1.5.6 libidn2/2.3.7 libpsl/0.21.5 libssh2/1.11.0
Release-Date: 2024-09-18
Protocols: dict file ftp ftps gopher gophers http https imap imaps ipfs ipns ldap ldaps mqtt pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: alt-svc AsynchDNS brotli HSTS HTTPS-proxy IDN IPv6 Kerberos Largefile libz NTLM PSL SPNEGO SSL SSPI threadsafe UnixSockets zstd

lucas@Desktop-Win MINGW64 ~
$ curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/aed5066b2e52091aea87f5e992eb280be38c81d5/install.sh | sh
Installing in /c/Users/lucas/bin
ARCH=64bit
OS=Windows
Using curl as download tool
Downloading https://downloads.arduino.cc/arduino-cli/arduino-cli_1.0.4_Windows_64bit.zip
Archive:  /tmp/arduino-cli_1.0.4_Windows_64bit.zip
  inflating: /tmp/arduino-cli/arduino-cli.exe
  inflating: /tmp/arduino-cli/LICENSE.txt
arduino-cli  Version: 1.0.4 Commit: a0d912da Date: 2024-08-12T13:42:36Z installed successfully in /c/Users/lucas/bin

@cmaglie
Copy link
Member

cmaglie commented Oct 25, 2024

Thank you for your responsiveness!

Even if not related to Arduino CLI, at least now:

  • we have improved the error reporting
  • we now know where this curl: (43) A libcurl function was given a bad argument comes from!

@cmaglie cmaglie closed this as completed Oct 25, 2024
@cmaglie cmaglie added the conclusion: resolved Issue was resolved label Oct 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
conclusion: resolved Issue was resolved topic: infrastructure Related to project infrastructure type: imperfection Perceived defect in any part of project
Projects
None yet
Development

No branches or pull requests

6 participants