PowerShell / PowerShellGallery

236 stars 66 forks source link

Ubuntu 20.04.6 LTS from Powershell 7.4.1 can't download any PowerShellGallery module #271

Closed Igor-ABI closed 3 months ago

Igor-ABI commented 7 months ago

Prerequisites

Steps to reproduce

From Self-hosted agent for DevOps with Ubuntu 20.04.6 LTS and PowerShell 7.4.1 With root account any module installation process is failing since more than a month, any idea what can be the issue? I applied TLS1.2 mitigation but doesn't do any difference in Ubuntu [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

PS /home/Root_SH> Install-Module -Name Az.Accounts -RequiredVersion 2.17.0

Untrusted repository You are installing the modules from an untrusted repository. If you trust this repository, change its InstallationPolicy value by running the Set-PSRepository cmdlet. Are you sure you want to install the modules from 'PSGallery'? [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "N"): Y WARNING: Source Location 'https://www.powershellgallery.com/api/v2/package/Az.Accounts/2.17.0' is not valid. Install-Package: Package 'Az.Accounts' failed to download.

Expected behavior

Install-Package: Package 'Az.Accounts' COMPLETED

Actual behavior

**WARNING: Source Location 'https://www.powershellgallery.com/api/v2/package/Az.Accounts/2.17.0' is not valid.
Install-Package: Package 'Az.Accounts' failed to download.**

Error details

No response

Environment data

PS /home/Root_SH> $PSVersionTable.PSVersion

Major  Minor  Patch  PreReleaseLabel BuildLabel
-----  -----  -----  --------------- ----------
7      4      1

Version

7.4.1

Visuals

image

alerickson commented 7 months ago

@Igor-ABI what's the response when you run invoke-webrequest "https://www.powershellgallery.com/api/v2/package/Az.Accounts/2.17.0"?

Igor-ABI commented 7 months ago

Thks Alerickson for the answer! looks network related!

OUTPUT of the invoke-webrequest

cmdlet Invoke-WebRequest at command pipeline position 1 Supply values for the following parameters: Uri: https://www.powershellgallery.com/api/v2/package/Az.Accounts/2.17.0 Invoke-WebRequest: Network is unreachable