-
Notifications
You must be signed in to change notification settings - Fork 10
Sync folder uploaded wrong after vagrant halt && vagrant up #11
Comments
Hi @kamlim1k, it would be helpful if you could provide some more background information. I found this in the Vagrant project's issue creation template and it would be helpful if you could fill in the details. Vagrant versionRun Host operating systemThis is the operating system that you run locally. Guest operating systemThis is the operating system you run in the virtual machine. Vagrantfile# Copy-paste your Vagrantfile here Please note, if you are using Homestead or a different Vagrantfile format, we Debug outputProvide a link to a GitHub Gist containing the complete debug output: |
Vagrant 1.9.1
|
Unfortunately, I don't currently have access to a Windows Server 2016 environment in order to test this so I think I'll need some more information.
|
vagrant-aws (0.7.2) I will try to setup simple vagrant configuration tomorrow and add logs and output. I haven't try rsync, maybe try tomorrow as well |
Finally had time to do some test image. Installed Plugins:
Vagrant File :
vagrant up :
Sync folders correctly : vagrant reload :
Synced folders incorrect (creates nested folder): |
Interesting... I was trying to setup/use rsync and looking into rsync code in vagrant found this in
Maybe that what should be added ? |
That looks promising, I'll take a look into it tomorrow. If you have time to try a local patch and let me know if it works, that would be appreciated. |
Sure, if anything need to be tested I will find time. |
I am guessing this never got fixed? I encountered this issue today and found this discussion. I have a folder "Tests" with a subfolder Scenarios that I want to copy to the VM. This results in the directory structure |
Looks like this/similar issue has generalized itself in recent versions of Vagrant (currently 2.2.5). The additional folder depth is created during the first boot which makes chef_zero provisioning fail because the cookbooks are one level deeper than expected. Seems like very few people are using this plugin now. What is the mainstream solution for Windows guests on AWS? I want to use the standard AWS AMIs where there is no SSHD. Preferably with minimal installations in bootstrap script. Host OS is Linux which means SMB is not an option. Any ideas welcome. |
Maybe a good idea to move to Windows 2019 and use the OpenSSH shipped by Microsoft. Perhaps simple to combine with cygwin rsync. Chocolatey has a small rsync package. |
egads I have it... or at least, part of it, for chef-solo provisioning. The two key codeblocks are these: https://github.com/hashicorp/vagrant/blob/b03f8f5aac3267a5e183e644a411ac244098e96a/plugins/communicators/winrm/shell.rb#L109-L128 is what gets called by this plugin first. https://github.com/WinRb/winrm-fs/blob/035ad88490ec09eef5e93a1bb00f36c71ec9efe9/lib/winrm-fs/core/file_transporter.rb#L178-L191 , which determines to where the final directory will be unzipped, expects the "to" destination to not include the folder basename -- it appends it. The first codeblock wants the "from" path to end in
to
But it's still getting nested-duplicated on subsequent |
In my experience it has been challenging to keep a vagrant setup with multiple plugins stable over time/years. I decided to remove plugins whenever possible and Microsoft shipping with OpenSSH gave an opportunity to drop this plugin. I now have a setup where Windows 2019 is bootstrapped (from the base AWS image) to enable the Microsoft-shipped OpenSSH, deploy an SSH key, install rsync with choco. The synced folders can then run rsync over SSH while core Vagrant communications is still winrm. I am now using a single Vagrant plugin (AWS). I need to do some clean-up of the bootstrap script but I can post tidbits if anyone is interested. |
@takesson that is sounding like the best approach. I'm on GCP and launching a windows server image within a nested debian instance, trying to be able to integrate with metasploitable3 https://github.com/rapid7/metasploitable3 . So I only need to provision the images once. Metasploitable's current approach is a bunch of gnarly one-off scripts, but there is a PR for switching the windows provisioning to chef. I'll probably do your openssh - choco - rsync thing too. I noticed that the prepared IE virtual machines that microsoft provides all have openssh installed -- even the old Windows 7 ones. These ones: https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/ |
Although, I should note that the nested dir bug I think belongs to WinRM ruby library -- not to this plugin. Regardless, I'm abandoning WinRM. |
Noteworthy @takesson, relevant to you asking about modern trends for provisioning windows vms with only winrm: the venerable https://github.com/ruzickap/packer-templates/blob/e1066391c8c0a8529eac221ec49bc19d42072662/windows.json#L130-L132 uses ansible over winrm to great success. Combined with podunk shell scripts. For my project (https://github.com/deargle/vuln-windows-2019/blob/master/Vagrantfile), I ended up just doing provisioning with powershell scripts, building off of a pre-packered win2019 instance. Enabling builtin openssh wasn't hard, https://github.com/deargle/vuln-windows-2019/blob/master/scripts/openssh-builtin.ps1. I didn't get as far as testing synced folders because I haven't tried adding chef yet, but again, I'll probably just do ansible if it comes to something that powershell can't handle. |
@deargle I agree it was not hard to enable builtin openssh and login with password. It was a bit trickier to get the public key configured to enable rsync. Figured it out and it seems stable now. I prefer to avoid maintaining any images/boxes so I can always use the latest available AMI on AWS. |
Cool, can you share your rsync public key solution?
…On Mon, Dec 2, 2019, 2:58 PM Thomas Åkesson ***@***.***> wrote:
@deargle <https://github.com/deargle> I agree it was not hard to enable
builtin openssh and login with password. It was a bit trickier to get the
public key configured to enable rsync. Figured it out and it seems stable
now.
I prefer to avoid maintaining any images/boxes so I can always use the
latest available AMI on AWS.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#11?email_source=notifications&email_token=AAI6Y7O3ZV2H6B33TWKGVTDQWWAG3A5CNFSM4C3M5UXKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEFVWH6Y#issuecomment-560686075>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAI6Y7OB242CBECGMZ4NSMLQWWAG3ANCNFSM4C3M5UXA>
.
|
Setting up SSH public key for the administrators group. Microsoft has configured OpenSSH such that individual keys for Administrator cannot be added without modifying config files. Note: I am doing rsync over SSH but the Vagrant communicator is still over WinRM. I tried the winssh communicator but it seemed broken. Anyone having success with the winssh communicator?
Install rsync via Chocolatey:
I have very basic Powershell skills so there might be things to clean up. |
Have configuration like this :
After initial
vagrant up
folder on guest created like this:After
vagrant halt && vagrant up
synced folder become like this :The text was updated successfully, but these errors were encountered: