ContainerProvider icon indicating copy to clipboard operation
ContainerProvider copied to clipboard

Bits Transfer failed when using WinRM to execute Install-ContainerImage, Find-Package

Open selvik opened this issue 8 years ago • 11 comments

Hi All, Would you know why these commands (Find-Package, Install-ContanerImage) fail when executed via WinRM on a remote TP5 VM on Azure?

@jayshah-msft, @KrishnaV-MSFT : Any hints would greatly help us troubleshoot this. Thank you very much.

-Selvi

This is the error I see for Install-ContainerImage:


powershell -command "& {&'Install-ContainerImage' -Name WindowsServerCore -Version 10.0.14300.1010}"

WARNING: Cannot bind argument to parameter 'fastPackageReference' because it is an empty string. WARNING: The property 'version' cannot be found on this object. Verify that the property exists. WARNING: The property 'Name' cannot be found on this object. Verify that the property exists. WARNING: Cannot find path 'C:\Users\ubuntu\AppData\Local\ContainerImage\ContainerImageGallery_ContainerImageSearchIndex.txt' because it does not exist. WARNING: Cannot find drive. A drive with the name 'CleanUp' does not exist. WARNING: Save-HTTPItem: Bits Transfer failed. Job State: ExitCode = -2147023651 WARNING: Based on customer feedback, we are updating the Containers PowerShell module to better align with Docker. As part of that some cmdlet and parameter names may change in future releases. To learn more about these changes as well as to join in the design process or provide usage feedback please refer to http://aka.ms/windowscontainers/powershell , stderr: PackageManagement\Save-Package : No match was found for the specified search criteria and package name 'WindowsServerCore'. Try Get-PackageSource to see all available registered package sources. At C:\Program Files\WindowsPowerShell\Modules\ContainerImage\0.6.4.0\ContainerImage.psm1:492 char:23

  • ... $downloadOutput = PackageManagement\Save-Package @PSBoundParameters
  •                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : ObjectNotFound: (Microsoft.Power...ets.SavePackage:SavePackage) [Save-Package], Exceptio n
    • FullyQualifiedErrorId : NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cmdlets.SavePackage

The property 'Name' cannot be found on this object. Verify that the property exists. At C:\Program Files\WindowsPowerShell\Modules\ContainerImage\0.6.4.0\ContainerImage.psm1:494 char:5

  • $Destination = GenerateFullPath -Location $Location `
    
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:) [], PropertyNotFoundException
    • FullyQualifiedErrorId : PropertyNotFoundStrict

Install-ContainerOSImage : Cannot bind argument to parameter 'WimPath' because it is an empty string. At C:\Program Files\WindowsPowerShell\Modules\ContainerImage\0.6.4.0\ContainerImage.psm1:502 char:39

  • Install-ContainerOSImage -WimPath $Destination `
    
  •                                   ~~~~~~~~~~~~
    
    • CategoryInfo : InvalidData: (:) [Install-ContainerOSImage], ParameterBindingValidationException
    • FullyQualifiedErrorId : ParameterArgumentValidationErrorEmptyStringNotAllowed,Install-ContainerOSImage

Remove-Item : Cannot bind argument to parameter 'Path' because it is null. At C:\Program Files\WindowsPowerShell\Modules\ContainerImage\0.6.4.0\ContainerImage.psm1:512 char:8

  • rm $Destination
    
  •    ~~~~~~~~~~~~
    
    • CategoryInfo : InvalidData: (:) [Remove-Item], ParameterBindingValidationException
    • FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.RemoveItemCommand

Error for Find-Package

powershell -command "& {&'Find-Package' –provider ContainerImage}"

WARNING: Cannot bind argument to parameter 'fastPackageReference' because it is an empty string. WARNING: The property 'version' cannot be found on this object. Verify that the property exists. WARNING: The property 'Name' cannot be found on this object. Verify that the property exists. WARNING: Cannot find path 'C:\Users\ubuntu\AppData\Local\ContainerImage\ContainerImageGallery_ContainerImageSearchIndex.txt' because it does not exist. WARNING: Cannot find drive. A drive with the name 'CleanUp' does not exist. WARNING: Save-HTTPItem: Bits Transfer failed. Job State: ExitCode = -2147023651


selvik avatar May 02 '16 04:05 selvik

@selvik Are you behind a Proxy?

jayshah-msft avatar May 02 '16 04:05 jayshah-msft

@jayshah-msft Thanks for the reply.

Not that I know of. My VM is on Azure with these ports open:

  • 5985,5986 (for WinRM)
  • 3389 (RDP)
  • 2376 (Docker) Do I need any other ports open?

Also these commands when directly executed on the hosts work well. Its only when they are invoked using WinRM do I get these errors.

selvik avatar May 02 '16 04:05 selvik

@selvik Ok thanks for the information, will investigate and let you know asap.

jayshah-msft avatar May 02 '16 04:05 jayshah-msft

@jayshah-msft Thanks a lot for taking a look. Any hints for us to troubleshoot further will also be great.

I've attached a Golang file to reproduce the issue. Replace machineDnsName, username and password to valid values for an Azure VM deployed from TP5 (full UI) and its user-password credentials.

Can be run using go run install_containers.go after unzipping and replacing these values.

install_containers.zip

selvik avatar May 02 '16 04:05 selvik

Is this a regression ? I see a note in this commit with two different alternatives for downloading a file: https://github.com/PowerShell/ContainerProvider/commit/654421d55499341086c8c41b13b52c224d56ce38

selvik avatar May 02 '16 07:05 selvik

Hi @selvik, can I ask what do you get if you run powershell -command "& {&'Find-ContainerImage'}" ?

quoctruong avatar May 02 '16 16:05 quoctruong

powershell -ExecutionPolicy Unrestricted -command "& {&Find-ContainerImage}"

stdout: WARNING: Cannot bind argument to parameter 'fastPackageReference' because it is an empty string. WARNING: The property 'version' cannot be found on this object. Verify that the property exists. WARNING: The property 'Name' cannot be found on this object. Verify that the property exists. WARNING: Cannot find path 'C:\Users\ubuntu\AppData\Local\ContainerImage\ContainerImageGallery_ContainerImageSearchIndex.txt' because it does not exist. WARNING: Cannot find drive. A drive with the name 'CleanUp' does not exist. WARNING: Save-HTTPItem: Bits Transfer failed. Job State: ExitCode = -2147023651 , stderr:

selvik avatar May 02 '16 17:05 selvik

@quoctruong @jayshah-msft A workaround was posted here and it helps: https://github.com/Microsoft/Virtualization-Documentation/issues/228#issuecomment-216251530

selvik avatar May 02 '16 17:05 selvik

Hi @selvik, glad to know that there is a workaround. Can I ask do you have this issue if you use "New-PSSession" to create a remote session and then use Invoke-Command with -Session to invoke the command "Find-ContainerImage" on the remote machine?

quoctruong avatar May 02 '16 18:05 quoctruong

Hi @selvik, I created an AzureVM and connected to a remote PSSession using these steps (http://www.techdiction.com/2016/02/11/configuring-winrm-over-https-to-enable-powershell-remoting/). I then ran Find-ContainerImage in the PSSession and everything worked. I also tried "Invoke-Command -Session $session -ScriptBlock { Find-ContainerImage }" where $session is created using New-PSSession and it worked too. Do you mind providing more details in how ran your remote commands?

quoctruong avatar May 02 '16 21:05 quoctruong

Hi @quoctruong, Thanks a lot for looking at this issue! Our use case (like many others) is to connect to the Azure VM using a non-windows machine - in my case Linux (so there is no PSSession). So I use WinRM protocol and a Golang client for WinRM to do this. If you look at my comment above: https://github.com/PowerShell/ContainerProvider/issues/9#issuecomment-216104273 I have provided the Golang program to reproduce the error. You will have to replace the machineDnsName (say 'azuretest.cloudapp.net'), username (replace xxx) and password (replace zzz) variables in the code.

selvik avatar May 02 '16 22:05 selvik