PackageProvider and PSRepository Broken - Ubuntu 20.04
See original GitHub issueSteps to reproduce
Get-PackageProvider
Get-PSRepository
Expected behavior
Name Version DynamicOptions
---- ------- --------------
NuGet 3.0.0.1 Destination, ExcludeVersion, Scope, SkipDependencies, Headers, FilterOnTag, Contains, AllowPrereleaseVersions, ConfigFile, SkipValidate
PowerShellGet 2.2.5.0 PackageManagementProvider, Type, Scope, AllowClobber, SkipPublisherCheck, InstallUpdate, NoPathUpdate, AllowPrereleaseVersions, Filter, Tag, Includes, DscR
Name InstallationPolicy SourceLocation
---- ------------------ --------------
PSGallery Untrusted https://www.powershellgallery.com/api/v2
Actual behavior
Get-PackageProvider: Unhandled Exception - Message:'The type initializer for 'Microsoft.PackageManagement.Internal.Utility.Extensions.FilesystemExtensions' threw an exception.' Name
:'TypeInitializationException' Stack Trace:' at Microsoft.PackageManagement.Internal.Utility.Extensions.FilesystemExtensions.MakeSafeFileName(String input)
at Microsoft.PackageManagement.Internal.Utility.Plugin.DynamicType.DefineDynamicType(Type interfaceType)
at Microsoft.PackageManagement.Internal.Utility.Plugin.DynamicType..ctor(Type interfaceType, OrderedDictionary`2 methods, List`2 delegates, List`1 stubs)
at Microsoft.PackageManagement.Internal.Utility.Plugin.DynamicType.<>c__DisplayClass9_0.<Create>b__3()
at Microsoft.PackageManagement.Internal.Utility.Extensions.DictionaryExtensions.GetOrAdd[TKey,TValue](IDictionary`2 dictionary, TKey key, Func`1 valueFunction)
at Microsoft.PackageManagement.Internal.Utility.Plugin.DynamicType.Create(Type tInterface, OrderedDictionary`2 instanceMethods, List`2 delegateMethods, List`1 stubMethods, List`2
usedInstances)
at Microsoft.PackageManagement.Internal.Utility.Plugin.DynamicInterface.CreateProxy(Type tInterface, Object[] instances)
at Microsoft.PackageManagement.Internal.Utility.Plugin.DynamicInterface.DynamicCast(Type tInterface, Object[] instances)
at Microsoft.PackageManagement.Internal.Utility.Plugin.DynamicInterface.DynamicCast[TInterface](Object[] instances)
at Microsoft.PackageManagement.Internal.Utility.Plugin.DynamicInterfaceExtensions.As[TInterface](Object instance)
at Microsoft.PowerShell.PackageManagement.Cmdlets.CmdletBase.get_PackageManagementHost()
at Microsoft.PowerShell.PackageManagement.Cmdlets.CmdletBase.SelectProviders(String[] names)
at Microsoft.PowerShell.PackageManagement.Cmdlets.GetPackageProvider.ProcessRecordAsync()
at Microsoft.PowerShell.PackageManagement.Cmdlets.AsyncCmdlet.<>c__DisplayClass83_0.<AsyncRun>b__0()'
DEBUG: 00:00:00.0000001 Calling ImportPackageProvider. providerName = 'PowerShellGet', requiredVersion='', minimumVersion = '', maximumVersion=''
DEBUG: 00:00:00.0001182 Calling ImportPackageProviderViaName. providerName = 'PowerShellGet', requiredVersion='', minimumVersion = '', maximumVersion=''
VERBOSE: PowerShell meta provider initialization failed.
VERBOSE: No match was found for the specified search criteria and provider name 'PowerShellGet'. Try 'Get-PackageProvider -ListAvailable' to see if the provider exists on the system
.
Get-PackageSource: /opt/microsoft/powershell/7/Modules/PowerShellGet/PSModule.psm1:9539
Line |
9539 | … ckageSources = PackageManagement\Get-PackageSource @PSBoundParameters
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Unable to find module providers (PowerShellGet).
Environment data
Name Value
---- -----
PSVersion 7.1.3
PSEdition Core
GitCommitId 7.1.3
OS Linux 5.4.0-1046-azure #48-Ubuntu SMP Tue Apr 1…
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Network Connectivity to powershellgallery.com
I am able to connect https://www.powershellgallery.com/api/v2 successfully, proxy is bypassed for this connection, on same network PowerShell 7.1.3 works fine with Ubuntu 18.04 distribution
* Trying 168.61.186.235:443...
* TCP_NODELAY set
* Connected to www.powershellgallery.com (168.61.186.235) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
Issue Analytics
- State:
- Created 2 years ago
- Comments:10 (2 by maintainers)
Top Results From Across the Web
PowerShell module repositories having issues on some ...
Clearly the repositories are sometimes broken and that's causing both Get-PSRepository to fail, and Install-Module to fail. Adding -ErrorAction Stop does cause ...
Read more >Problem with PSgallery and PSwindowsupdate no longer ...
Try Get-PSRepository to see all available registered module ... #write-host "not" Install-PackageProvider -Name NuGet -Force -Confirm:$false ...
Read more >Unable to find module repositories. "Get-PSRepository" ...
I was trying to install Az-Module in my Ubuntu power-shell, But It wasn't installing than I double checked the PSRepository and I came...
Read more >PowerShell Unable to find module providers (PowerShellGet)
Install-PackageProvider : Unable to find repository with SourceLocation ''. Use Get-PSRepository to see all available repositories.
Read more >Ubuntu 20.04 LTS for WSL 20.4.0.20220127
This package checks to see if WSL is installed before downloading the distro archive file. If this check fails, the install will fail....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@rjmholt It looks the problem is resolved, so I marked
Resolution-Answered
. Feel free to change the label if there is remaining issues to be looked into.Trying to install a module to
AllUsers
asroot
on a fresh 20.04 VM gave me permissions of755
on a newly installed module there (and the module directory itself), so this may be something idiosyncratic to CloudInit.