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

file upload failed on Win10 #18

Closed
onlyfang opened this issue Jul 31, 2015 · 13 comments · Fixed by #19
Closed

file upload failed on Win10 #18

onlyfang opened this issue Jul 31, 2015 · 13 comments · Fixed by #19

Comments

@onlyfang
Copy link

I have a script to upload a Powershell script with winrm-fs to remote machine then run it with winrm.cmd.

It works well on Windows 7 and 8.1. I tried to run it on Windows 10 machine recently and find it always failed at file upload.

/Library/Ruby/Gems/2.0.0/gems/winrm-fs-0.2.1/lib/winrm-fs/core/command_executor. (WinRM::FS::WinRMUploadError)ss': powershell\n#< CLIXML
<Objs Version="1.1.0.1" xmlns="http://schemas.microsoft.com/powershell/2004/04"><Obj S="progress" RefId="0"><TN RefId="0"><T>System.Management.Automation.PSCustomObject</T><T>System.Object</T></TN><MS><I64 N="SourceId">1</I64><PR N="Record"><AV>Preparing modules for first use.</AV><AI>0</AI><Nil /><PI>-1</PI><PC>-1</PC><T>Completed</T><SR>-1</SR><SD> </SD></PR></MS></Obj></Objs>
    from /Library/Ruby/Gems/2.0.0/gems/winrm-fs-0.2.1/lib/winrm-fs/core/command_executor.rb:47:in `run_cmd'
    from /Library/Ruby/Gems/2.0.0/gems/winrm-fs-0.2.1/lib/winrm-fs/core/command_executor.rb:38:in `run_powershell'
    from /Library/Ruby/Gems/2.0.0/gems/winrm-fs-0.2.1/lib/winrm-fs/core/upload_orchestrator.rb:97:in `remote_checksum'
    from /Library/Ruby/Gems/2.0.0/gems/winrm-fs-0.2.1/lib/winrm-fs/core/upload_orchestrator.rb:86:in `out_of_date?'
    from /Library/Ruby/Gems/2.0.0/gems/winrm-fs-0.2.1/lib/winrm-fs/core/upload_orchestrator.rb:40:in `block in upload_file'
    from /Library/Ruby/Gems/2.0.0/gems/winrm-fs-0.2.1/lib/winrm-fs/core/upload_orchestrator.rb:72:in `with_command_executor'
    from /Library/Ruby/Gems/2.0.0/gems/winrm-fs-0.2.1/lib/winrm-fs/core/upload_orchestrator.rb:39:in `upload_file'
    from /Library/Ruby/Gems/2.0.0/gems/winrm-fs-0.2.1/lib/winrm-fs/file_manager.rb:111:in `upload'
    from test.rb:34:in `<main>'

My code to upload file is like:

endpoint = "http://#{ip}:5985/wsman"
winrm = WinRM::WinRMWebService.new(endpoint, :plaintext, :user => myuser, :pass => mypass, :basic_auth_only => true)

fs = WinRM::FS::FileManager.new(winrm)
fs.upload('hello.ps1', 'C:/hello.ps1')

If I copy the file manually to Win10 machine, winrm.cmd can run normally. I assume this is not WinRM config problem on remote machine.

@mwrock
Copy link
Member

mwrock commented Jul 31, 2015

I tried to reproduce this last night. I've been on win 10 now since late last year on the previews and have done alot of winrm FROM win 10 but none TO win10. Last night I was not able to succesfully authenticate from an ubuntu host to win10 via winrm. I had no problem connecting to win8.1 and couuld connect from win8.1 to win10 but only via powershell remoting. I did all the needed winrm/firewall tweaking that typically gets things working.

I was just talking with @smurawski and we stumbled on this topic and he mentioned that winrm is basically broken on win10 RTM and MS is aware of it. Did not go into details.

Sounds like you are able to at least authenticate. Is that correct? I may try to get a cleanly installed win10 VM running and see if I have better luck there.

@smurawski
Copy link

We've hit instances where WinRM in WMF 5 April preview and Win10 versions where WinRM replies with 500 errors rather then 401 auth negotiation. This is a breaking change from previous behavior and has been reported to Microsoft, but no currently released WMF or Win10 rev has a fix yet.

@onlyfang
Copy link
Author

onlyfang commented Aug 1, 2015

Yes, I am able to authenticate and execute command successfully on Win10 machine. I am connecting from OSX.

@mwrock
Copy link
Member

mwrock commented Aug 1, 2015

Grabbed an eval ISO and had no problem authenticating to a win 10 VM built with that and easily reproduced this problem. Merged a fix.

@sneal
Copy link
Member

sneal commented Nov 11, 2015

😢 I'm running into this problem with test-kitchen 1.4.2.

@mwrock
Copy link
Member

mwrock commented Nov 11, 2015

@sneal test-kitchen uses winrm-transport which I'm hoping to merge into winrm-fs (I recently got diverted from that effort but hope to get back to it soon). I released @smurawski 's fix yesterday which is pretty much a duplicate of #19 in this gem. So to fix test-kitchen:

gem install winrm-transport -v 1.0.3

@TheFrogDaddy
Copy link

TheFrogDaddy commented Jun 25, 2016

I'm on the latest version yet I still appear to receive this?

(WinRM::FS::WinRMUploadError)s/winrm-fs-0.2.3/lib/winrm-fs/core/command_executor.rb:59:in``assert_command_success': powershell\n#<......

Any ideas?

Cheers

@mwrock
Copy link
Member

mwrock commented Jun 26, 2016

Latest version of which gem @TheFrogDaddy? Your stack trace indicates you are using 0.2.3 of winrm-fs but 0.4.3 is latest.

@TheFrogDaddy
Copy link

TheFrogDaddy commented Jun 26, 2016

Sorry yes, I was on an old version and I've updated that now by downloading latest Vagrant. This didn't resolve my issue though. I've pinned it down to the chocolatey install powershell script breaking any subsequent winrm-fs uploads, it seems to be affecting comms with box somehow. I've raised an issue with them. chocolatey/choco#834

/opt/vagrant/embedded/gems/gems/winrm-fs-0.3.2/lib/winrm-fs/core/file_transporter.rb:378:in parse_response': [WinRM::FS::Core::FileTransporter] Upload failed (exitcode: 0), but stderr present (WinRM::FS::Core::FileTransporterFailed)`

Not sure if you've seen this?

@smurawski
Copy link

@TheFrogDaddy You are still using an old version of the gem

/opt/vagrant/embedded/gems/gems/winrm-fs-0.3.2

To deal with that error you'll need the latest 0.4.3.

@TheFrogDaddy
Copy link

TheFrogDaddy commented Jun 27, 2016

@smurawski, thanks for this. 0.3.2 is actually what comes shipped with the latest Vagrant. I'll look into getting this updated manually for now. Thanks.

@mwrock
Copy link
Member

mwrock commented Jul 13, 2016

Sorry I'm trying to catch up on old issues. So what happens sometimes if you update to a later WMF is it may reset some winrm settings which could be causing problems here.

@dragon788
Copy link

dragon788 commented Jul 18, 2016

@mwrock I think you are onto something. I have a box built with PS4 and when I update with Choco to PS5 after a reboot it immediately starts throwing this error. It seems like I can connect to WinRM, I just get the "failure" message of "Preparing modules for first use." This could be something the plugin just needs to ignore or redirect to a different level of output?

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

Successfully merging a pull request may close this issue.

6 participants