Skip to content
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

Can't install .NET 8 runtime with dotnet-install scripts on MacOS #20293

Closed
Snegovikufa opened this issue Jan 15, 2025 · 7 comments
Closed

Can't install .NET 8 runtime with dotnet-install scripts on MacOS #20293

Snegovikufa opened this issue Jan 15, 2025 · 7 comments

Comments

@Snegovikufa
Copy link

Here is the sample code I use to download and install .NET runtime:

#!/usr/bin/env sh

mkdir -p "/usr/local/share/dotnet/"
INSTALL_PATH="/usr/local/share/dotnet/dotnet-install.sh"

if [ ! -f "$INSTALL_PATH" ]; then
	curl https://builds.dotnet.microsoft.com/dotnet/scripts/v1/dotnet-install.sh > $INSTALL_PATH
    chmod +x $INSTALL_PATH
fi

# Install net8.0 runtime
sh $INSTALL_PATH --channel 8.0 --install-dir /usr/local/share/dotnet --runtime dotnet --verbose 

Unfortunately, the script fails to install the .NET runtime after changes in dotnet/core#9671. Here is the verbose log output that actually says nothing about the error:

dotnet-install: Note that the intended use of this script is for Continuous Integration (CI) scenarios, where:
dotnet-install: - The SDK needs to be installed without user interaction and without admin rights.
dotnet-install: - The SDK installation doesn't need to persist across multiple CI runs.
dotnet-install: To set up a development environment or to run apps, use installers rather than this script. Visit https://dotnet.microsoft.com/download to get the installer.

dotnet-install: Calling: machine_has curl
dotnet-install: Calling: calculate_vars 
dotnet-install: Calling: get_normalized_architecture_from_architecture <auto>
dotnet-install: Calling: get_machine_architecture 
dotnet-install: Normalized architecture: 'x64'.
dotnet-install: Calling: get_normalized_os 
dotnet-install: Calling: get_current_os_name 
dotnet-install: Normalized OS: 'osx'.
dotnet-install: Calling: get_normalized_quality 
dotnet-install: Normalized quality: ''.
dotnet-install: Calling: get_normalized_channel 8.0
dotnet-install: Normalized channel: '8.0'.
dotnet-install: Calling: get_normalized_product dotnet
dotnet-install: Normalized product: 'dotnet-runtime'.
dotnet-install: Calling: resolve_installation_path /usr/local/share/dotnet
dotnet-install: InstallRoot: '/usr/local/share/dotnet'.
dotnet-install: Calling: get_normalized_architecture_for_specific_sdk_version Latest 8.0 x64
dotnet-install: Calling: get_current_os_name 
dotnet-install: Calling: get_download_link_from_aka_ms 
dotnet-install: Retrieving primary payload URL from aka.ms for channel: '8.0', quality: '', product: 'dotnet-runtime', os: 'osx', architecture: 'x64'.
dotnet-install: Constructed aka.ms link: 'https://aka.ms/dotnet/8.0/dotnet-runtime-osx-x64.tar.gz'.
dotnet-install: Calling: get_http_header https://aka.ms/dotnet/8.0/dotnet-runtime-osx-x64.tar.gz true
dotnet-install: Calling: machine_has curl
dotnet-install: Calling: get_http_header_curl https://aka.ms/dotnet/8.0/dotnet-runtime-osx-x64.tar.gz true
dotnet-install: Received response: HTTP/1.1 301 Moved Permanently
Server: Kestrel
Location: https://builds.dotnet.microsoft.com/dotnet/Runtime/8.0.12/dotnet-runtime-8.0.12-osx-x64.tar.gz
Request-Context: appId=cid-v1:d94c0f68-64bf-4036-8409-a0e761bb7ee1
X-Response-Cache-Status: True
Content-Length: 0
Expires: Wed, 15 Jan 2025 12:39:15 GMT
Cache-Control: max-age=0, no-cache, no-store
Pragma: no-cache
Date: Wed, 15 Jan 2025 12:39:15 GMT
Connection: keep-alive
Strict-Transport-Security: max-age=31536000 ; includeSubDomains

HTTP/1.1 200 OK
Content-Type: application/octet-stream
Content-MD5: 7Um/KnsoHaOiyrfwZkKdLA==
Last-Modified: Tue, 14 Jan 2025 18:04:02 GMT
ETag: 0x8DD34C5D413275F
x-ms-request-id: c8045e3b-201e-0081-3ce0-66c5ba000000
x-ms-version: 2009-09-19
x-ms-lease-status: unlocked
x-ms-blob-type: BlockBlob
Date: Wed, 15 Jan 2025 12:39:15 GMT
Connection: keep-alive
Akamai-GRN: 0.6b741002.1736944755.3c896901

dotnet-install: Calling: sanitize_redirect_url https://builds.dotnet.microsoft.com/dotnet/Runtime/8.0.12/dotnet-runtime-8.0.12-osx-x64.tar.gz
dotnet-install: Checking configured feeds for the asset at Runtime/8.0.12/dotnet-runtime-8.0.12-osx-x64.tar.gz
dotnet-install: Checking https://builds.dotnet.microsoft.com/dotnet/Runtime/8.0.12/dotnet-runtime-8.0.12-osx-x64.tar.gz
dotnet-install: Calling: check_url_exists https://builds.dotnet.microsoft.com/dotnet/Runtime/8.0.12/dotnet-runtime-8.0.12-osx-x64.tar.gz
dotnet-install: Calling: machine_has curl
dotnet-install: Found a match at https://builds.dotnet.microsoft.com/dotnet/Runtime/8.0.12/dotnet-runtime-8.0.12-osx-x64.tar.gz
dotnet-install: The redirect location retrieved: 'https://builds.dotnet.microsoft.com/dotnet/Runtime/8.0.12/dotnet-runtime-8.0.12-osx-x64.tar.gz'.
dotnet-install: Retrieved primary payload URL from aka.ms link: 'https://builds.dotnet.microsoft.com/dotnet/Runtime/8.0.12/dotnet-runtime-8.0.12-osx-x64.tar.gz'.
dotnet-install: Downloading using legacy url will not be attempted.
dotnet-install: Version: '8.0.12'.
dotnet-install: Calling: get_specific_product_version  8.0.12 https://builds.dotnet.microsoft.com/dotnet/Runtime/8.0.12/dotnet-runtime-8.0.12-osx-x64.tar.gz
dotnet-install: Calling: get_specific_product_version_url  8.0.12 true https://builds.dotnet.microsoft.com/dotnet/Runtime/8.0.12/dotnet-runtime-8.0.12-osx-x64.tar.gz
dotnet-install: Constructed productVersion link: https://builds.dotnet.microsoft.com/dotnet/Runtime/8.0.12/runtime-productVersion.txt
dotnet-install: Calling: get_specific_product_version_url  8.0.12 false https://builds.dotnet.microsoft.com/dotnet/Runtime/8.0.12/dotnet-runtime-8.0.12-osx-x64.tar.gz
dotnet-install: Constructed productVersion link: https://builds.dotnet.microsoft.com/dotnet/Runtime/8.0.12/productVersion.txt
dotnet-install: Checking for the existence of https://builds.dotnet.microsoft.com/dotnet/Runtime/8.0.12/runtime-productVersion.txt
dotnet-install: Calling: machine_has curl
dotnet-install: Calling: is_dotnet_package_installed /usr/local/share/dotnet shared/Microsoft.NETCore.App 8.0.12
dotnet-install: Calling: combine_paths /usr/local/share/dotnet shared/Microsoft.NETCore.App
dotnet-install: combine_paths: root_path=/usr/local/share/dotnet
dotnet-install: combine_paths: child_path=shared/Microsoft.NETCore.App
dotnet-install: Calling: combine_paths /usr/local/share/dotnet/shared/Microsoft.NETCore.App 8.0.12
dotnet-install: combine_paths: root_path=/usr/local/share/dotnet/shared/Microsoft.NETCore.App
dotnet-install: combine_paths: child_path=8.0.12
dotnet-install: is_dotnet_package_installed: dotnet_package_path=/usr/local/share/dotnet/shared/Microsoft.NETCore.App/8.0.12
dotnet-install: Generated 1 links.
dotnet-install: Link 0: aka.ms, 8.0.12, https://builds.dotnet.microsoft.com/dotnet/Runtime/8.0.12/dotnet-runtime-8.0.12-osx-x64.tar.gz
dotnet-install: Calling: install_dotnet 
dotnet-install: Archive path: /tmp/dotnet.na8TxMry4
dotnet-install: Attempting to download using aka.ms link https://builds.dotnet.microsoft.com/dotnet/Runtime/8.0.12/dotnet-runtime-8.0.12-osx-x64.tar.gz
dotnet-install: Calling: download https://builds.dotnet.microsoft.com/dotnet/Runtime/8.0.12/dotnet-runtime-8.0.12-osx-x64.tar.gz /tmp/dotnet.na8TxMry4
dotnet-install: Calling: machine_has curl
dotnet-install: Calling: downloadcurl https://builds.dotnet.microsoft.com/dotnet/Runtime/8.0.12/dotnet-runtime-8.0.12-osx-x64.tar.gz /tmp/dotnet.na8TxMry4
dotnet-install: Calling: machine_has curl
# There is no further output

I have slightly modified the installation script to print the executed commands that are executed internally and might fail:

1019a1020,1021
>     
>     say 41
1022c1024
<         file_size=$(curl -sI  "$zip_uri" | grep -i content-length | awk '{ num = $2 + 0; print num }')
---
>         file_size=$(curl -v -sI  "$zip_uri" | grep -i content-length | awk '{ num = $2 + 0; print num }')
1028a1031,1032
>     
>     say 42
1036a1041,1042
>     
>     say 43
1646a1653
>             say "download_completed"
1651a1659
>     say 3
1657a1666,1667
>     say 4
> 
1658a1669,1670
>     
>     say 5
1919a1932
> say "check_min_reqs"
1920a1934
> say "calculate_vars"
1922a1937
> say "generate_download_links"
1929a1945
> say "install_dotnet"

What I expected to see is the output of the:

3
4
41
42
43
5

It seems that the script fails at the 41 step. I would appreciate any help.
After further investigation, I have two versions of the successful and failed installation: good.log and bad.log. I attached them to the issue. Please note that nothing was changed between the script runs. I just waited till the script failed (~10 minutes or so).

The difference between the logs is that when the archive was redirected to 95.101.35.88:443 the installation fails and when I redirected to 13.107.246.62:443 everything installs correctly.

good.log
bad.log

Bad

dotnet-install: Archive path: /var/folders/wn/ps_wwvpx7pq9clhkrgdwmyzw0000gq/T//dotnet.WwtRKDleV
dotnet-install: Attempting to download using aka.ms link https://builds.dotnet.microsoft.com/dotnet/Runtime/8.0.12/dotnet-runtime-8.0.12-osx-x64.tar.gz
dotnet-install: Calling: download https://builds.dotnet.microsoft.com/dotnet/Runtime/8.0.12/dotnet-runtime-8.0.12-osx-x64.tar.gz /var/folders/wn/ps_wwvpx7pq9clhkrgdwmyzw0000gq/T//dotnet.WwtRKDleV
dotnet-install: Calling: machine_has curl
dotnet-install: Calling: downloadcurl https://builds.dotnet.microsoft.com/dotnet/Runtime/8.0.12/dotnet-runtime-8.0.12-osx-x64.tar.gz /var/folders/wn/ps_wwvpx7pq9clhkrgdwmyzw0000gq/T//dotnet.WwtRKDleV
dotnet-install: download_completed
dotnet-install: 3
dotnet-install: 4
dotnet-install: 41
dotnet-install: Calling: machine_has curl
*   Trying 95.101.35.88:443...
* Connected to builds.dotnet.microsoft.com (95.101.35.88) port 443 (#0)
* ALPN: offers h2
* ALPN: offers http/1.1
*  CAfile: /etc/ssl/cert.pem
*  CApath: none
* [CONN-0-0][CF-SSL] (304) (OUT), TLS handshake, Client hello (1):
} [332 bytes data]
* [CONN-0-0][CF-SSL] (304) (IN), TLS handshake, Server hello (2):
{ [122 bytes data]
* [CONN-0-0][CF-SSL] (304) (IN), TLS handshake, Unknown (8):
{ [35 bytes data]
* [CONN-0-0][CF-SSL] (304) (IN), TLS handshake, Certificate (11):
{ [2440 bytes data]
* [CONN-0-0][CF-SSL] (304) (IN), TLS handshake, CERT verify (15):
{ [79 bytes data]
* [CONN-0-0][CF-SSL] (304) (IN), TLS handshake, Finished (20):
{ [52 bytes data]
* [CONN-0-0][CF-SSL] (304) (OUT), TLS handshake, Finished (20):
} [52 bytes data]
* SSL connection using TLSv1.3 / AEAD-AES256-GCM-SHA384
* ALPN: server accepted http/1.1
* Server certificate:
*  subject: C=US; ST=WA; L=Redmond; O=Microsoft Corporation; CN=builds.dotnet.microsoft.com
*  start date: Dec 26 21:03:32 2024 GMT
*  expire date: Dec 21 21:03:32 2025 GMT
*  subjectAltName: host "builds.dotnet.microsoft.com" matched cert's "builds.dotnet.microsoft.com"
*  issuer: C=US; O=Microsoft Corporation; CN=Microsoft Azure ECC TLS Issuing CA 07
*  SSL certificate verify ok.
> HEAD /dotnet/Runtime/8.0.12/dotnet-runtime-8.0.12-osx-x64.tar.gz HTTP/1.1
> Host: builds.dotnet.microsoft.com
> User-Agent: curl/7.87.0
> Accept: */*
> 
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Content-Type: application/octet-stream
< Content-MD5: 7Um/KnsoHaOiyrfwZkKdLA==
< Last-Modified: Tue, 14 Jan 2025 18:04:02 GMT
< ETag: 0x8DD34C5D413275F
< x-ms-request-id: c8045e3b-201e-0081-3ce0-66c5ba000000
< x-ms-version: 2009-09-19
< x-ms-lease-status: unlocked
< x-ms-blob-type: BlockBlob
< Date: Wed, 15 Jan 2025 14:03:18 GMT
< Connection: keep-alive
< Akamai-GRN: 0.5423655f.1736949798.20bd8044
< 
* Connection #0 to host builds.dotnet.microsoft.com left intact
# There is no further output

Good

dotnet-install: Archive path: /var/folders/wn/ps_wwvpx7pq9clhkrgdwmyzw0000gq/T//dotnet.jVqebQqGU
dotnet-install: Attempting to download using aka.ms link https://builds.dotnet.microsoft.com/dotnet/Runtime/8.0.12/dotnet-runtime-8.0.12-osx-x64.tar.gz
dotnet-install: Calling: download https://builds.dotnet.microsoft.com/dotnet/Runtime/8.0.12/dotnet-runtime-8.0.12-osx-x64.tar.gz /var/folders/wn/ps_wwvpx7pq9clhkrgdwmyzw0000gq/T//dotnet.jVqebQqGU
dotnet-install: Calling: machine_has curl
dotnet-install: Calling: downloadcurl https://builds.dotnet.microsoft.com/dotnet/Runtime/8.0.12/dotnet-runtime-8.0.12-osx-x64.tar.gz /var/folders/wn/ps_wwvpx7pq9clhkrgdwmyzw0000gq/T//dotnet.jVqebQqGU
dotnet-install: download_completed
dotnet-install: 3
dotnet-install: 4
dotnet-install: 41
dotnet-install: Calling: machine_has curl
*   Trying 13.107.246.62:443...
* Connected to builds.dotnet.microsoft.com (13.107.246.62) port 443 (#0)
* ALPN: offers h2
* ALPN: offers http/1.1
*  CAfile: /etc/ssl/cert.pem
*  CApath: none
* [CONN-0-0][CF-SSL] (304) (OUT), TLS handshake, Client hello (1):
} [332 bytes data]
* [CONN-0-0][CF-SSL] (304) (IN), TLS handshake, Server hello (2):
{ [88 bytes data]
* [CONN-0-0][CF-SSL] (304) (OUT), TLS handshake, Client hello (1):
} [365 bytes data]
* [CONN-0-0][CF-SSL] (304) (IN), TLS handshake, Server hello (2):
{ [155 bytes data]
* [CONN-0-0][CF-SSL] (304) (IN), TLS handshake, Unknown (8):
{ [19 bytes data]
* [CONN-0-0][CF-SSL] (304) (IN), TLS handshake, Certificate (11):
{ [4419 bytes data]
* [CONN-0-0][CF-SSL] (304) (IN), TLS handshake, CERT verify (15):
{ [264 bytes data]
* [CONN-0-0][CF-SSL] (304) (IN), TLS handshake, Finished (20):
{ [52 bytes data]
* [CONN-0-0][CF-SSL] (304) (OUT), TLS handshake, Finished (20):
} [52 bytes data]
* SSL connection using TLSv1.3 / AEAD-AES256-GCM-SHA384
* ALPN: server accepted h2
* Server certificate:
*  subject: CN=builds.dotnet.microsoft.com
*  start date: Dec 23 00:00:00 2024 GMT
*  expire date: Jun 23 23:59:59 2025 GMT
*  subjectAltName: host "builds.dotnet.microsoft.com" matched cert's "builds.dotnet.microsoft.com"
*  issuer: C=US; O=DigiCert, Inc.; CN=GeoTrust Global TLS RSA4096 SHA256 2022 CA1
*  SSL certificate verify ok.
* Using HTTP2, server supports multiplexing
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* h2h3 [:method: HEAD]
* h2h3 [:path: /dotnet/Runtime/8.0.12/dotnet-runtime-8.0.12-osx-x64.tar.gz]
* h2h3 [:scheme: https]
* h2h3 [:authority: builds.dotnet.microsoft.com]
* h2h3 [user-agent: curl/7.87.0]
* h2h3 [accept: */*]
* Using Stream ID: 1 (easy handle 0x7fd39380fc00)
> HEAD /dotnet/Runtime/8.0.12/dotnet-runtime-8.0.12-osx-x64.tar.gz HTTP/2
> Host: builds.dotnet.microsoft.com
> user-agent: curl/7.87.0
> accept: */*
> 
* Connection state changed (MAX_CONCURRENT_STREAMS == 128)!
< HTTP/2 200 
< date: Wed, 15 Jan 2025 14:07:00 GMT
< content-type: application/octet-stream
< content-length: 30718172
< content-md5: 7Um/KnsoHaOiyrfwZkKdLA==
< last-modified: Tue, 14 Jan 2025 18:04:02 GMT
< etag: 0x8DD34C5D413275F
< x-ms-request-id: 81f16f0d-501e-001d-2212-6768dc000000
< x-ms-version: 2009-09-19
< x-ms-lease-status: unlocked
< x-ms-blob-type: BlockBlob
< x-azure-ref: 20250115T140700Z-r1f5b675b7d2ztwkhC1ATHet1s0000000ehg000000005cms
< x-fd-int-roxy-purgeid: 1
< x-cache: TCP_HIT
< accept-ranges: bytes
< 
* Connection #0 to host builds.dotnet.microsoft.com left intact
dotnet-install: 42
dotnet-install: Remote file https://builds.dotnet.microsoft.com/dotnet/Runtime/8.0.12/dotnet-runtime-8.0.12-osx-x64.tar.gz size is 30718172 bytes.
dotnet-install: 43
dotnet-install: 5
dotnet-install: Extracting archive from https://builds.dotnet.microsoft.com/dotnet/Runtime/8.0.12/dotnet-runtime-8.0.12-osx-x64.tar.gz
dotnet-install: Calling: extract_dotnet_package /var/folders/wn/ps_wwvpx7pq9clhkrgdwmyzw0000gq/T//dotnet.jVqebQqGU /usr/local/share/dotnet 30718172
dotnet-install: Calling: copy_files_or_dirs_from_list /var/folders/wn/ps_wwvpx7pq9clhkrgdwmyzw0000gq/T//dotnet.Qqpvzugqu /usr/local/share/dotnet false
dotnet-install: Calling: get_cp_options false
dotnet-install: Calling: copy_files_or_dirs_from_list /var/folders/wn/ps_wwvpx7pq9clhkrgdwmyzw0000gq/T//dotnet.Qqpvzugqu /usr/local/share/dotnet true
dotnet-install: Calling: get_cp_options true
dotnet-install: Calling: validate_remote_local_file_sizes /var/folders/wn/ps_wwvpx7pq9clhkrgdwmyzw0000gq/T//dotnet.jVqebQqGU 30718172
dotnet-install: Downloaded file size is 30718172 bytes.
dotnet-install: The remote and local file sizes are equal.
dotnet-install: Temporary archive file /var/folders/wn/ps_wwvpx7pq9clhkrgdwmyzw0000gq/T//dotnet.jVqebQqGU was removed
dotnet-install: Checking installation: version = 8.0.12
dotnet-install: Calling: is_dotnet_package_installed /usr/local/share/dotnet shared/Microsoft.NETCore.App 8.0.12
dotnet-install: Calling: combine_paths /usr/local/share/dotnet shared/Microsoft.NETCore.App
dotnet-install: combine_paths: root_path=/usr/local/share/dotnet
dotnet-install: combine_paths: child_path=shared/Microsoft.NETCore.App
dotnet-install: Calling: combine_paths /usr/local/share/dotnet/shared/Microsoft.NETCore.App 8.0.12
dotnet-install: combine_paths: root_path=/usr/local/share/dotnet/shared/Microsoft.NETCore.App
dotnet-install: combine_paths: child_path=8.0.12
dotnet-install: is_dotnet_package_installed: dotnet_package_path=/usr/local/share/dotnet/shared/Microsoft.NETCore.App/8.0.12
dotnet-install: Installed version is 8.0.12
dotnet-install: Calling: combine_paths /usr/local/share/dotnet 
dotnet-install: combine_paths: root_path=/usr/local/share/dotnet
dotnet-install: combine_paths: child_path=
dotnet-install: Calling: get_absolute_path /usr/local/share/dotnet/
dotnet-install: Adding to current process PATH: `/usr/local/share/dotnet`. Note: This change will be visible only when sourcing script.
dotnet-install: Note that the script does not resolve dependencies during installation.
dotnet-install: To check the list of dependencies, go to https://learn.microsoft.com/dotnet/core/install, select your operating system and check the "Dependencies" section.
dotnet-install: Installation finished successfully.
@Snegovikufa
Copy link
Author

Here is the modified script to compare it with the original:
dotnet-install.sh.txt

@Snegovikufa Snegovikufa changed the title Can't install .NET 8 runtime with dotnet-install scripts Can't install .NET 8 runtime with dotnet-install scripts on MacOS Jan 15, 2025
@baronfel
Copy link
Member

Looking at those IPs:

Are there perhaps networking/routing issues for your location coming into play?

@richlander
Copy link
Member

@Snegovikufa -- Can you reach out so that we can do some quick tests with you. [email protected].

@Snegovikufa
Copy link
Author

Looking at those IPs:

* [95.101.35.88](https://whatismyipaddress.com/ip/95.101.35.88) is Italy

* [13.107.246.62](https://whatismyipaddress.com/ip/13.107.246.62) is Redmond

Are there perhaps networking/routing issues for your location coming into play?

I think that the main reason why the script fails is that it expects to get the content-length header and compare the content length defined in the header to validate it with the downloaded content later, in the extract_dotnet_package using validate_remote_local_file_sizes.

13.107.246.62

< content-length: 30718172

95.101.35.88

There is no content-length header.

@richlander
Copy link
Member

Please try again. We just made a change to our CDN.

@Snegovikufa
Copy link
Author

Confirm it works. Thank you.

@richlander
Copy link
Member

Thanks for the report.

The content-length header was missing on HEAD requests. Akamai made a fix to our CDN so that it is now there.

$ curl -s --head https://builds.dotnet.microsoft.com/dotnet/Runtime/8.0.12/dotnet-runtime-8.0.12-win-x86.zip | tail -n 3
Content-Length: 30606275
Akamai-GRN: 0.4f4ddb17.1737038288.506e7c81

This is where the install script relies on that:

https://github.com/dotnet/install-scripts/blob/e5e7b1b1b219ed51465843c66f338f5a36f0d80a/src/dotnet-install.sh#L1022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants