2

Using vagrant 1.8.1, when trying to do a "vagrant up --provider virtualbox" for a box that has already been init'd, I get an "Error: Could not create directory '/home/username/.ssh'."

Per directions here - https://atlas.hashicorp.com/centos/boxes/7the following:

command:

vagrant init centos/7; vagrant up --provider virtualbox

Output:

There was an error when attempting to rsync a synced folder.
Please inspect the error message below for more info.

Host path: /cygdrive/c/VMs/vagrant/centos7-util/
Guest path: /home/vagrant/sync
Command: rsync --verbose --archive --delete -z --copy-links --chmod=ugo=rwX --no-perms --no-owner --no-group --rsync-path sudo rsync -e ssh -p 2222 -o ControlMaster=auto -o ControlPath=C:/DEV/cygwin64/tmp/ssh.540 -o ControlPersist=10m -o StrictHostKeyChecking=no -o IdentitiesOnly=true -o UserKnownHostsFile=/dev/null -i 'C:/VMs/vagrant/centos7-util/.vagrant/machines/default/virtualbox/private_key' --exclude .vagrant/ /cygdrive/c/VMs/vagrant/centos7-util/ vagrant@127.0.0.1:/home/vagrant/sync
Error: Could not create directory '/home/username/.ssh'.
Warning: Permanently added '[127.0.0.1]:2222' (ECDSA) to the list of known hosts.
mm_receive_fd: no message header
process_mux_new_session: failed to receive fd 0 from slave
mux_client_request_session: read from master failed: Connection reset by peer
Failed to connect to new control master
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(226) [sender=3.1.2]

I originally didn't have a /home/username/.ssh directory, and so I tried with a manually created directory, and then also with a symlink to my existing c:/users/username/.ssh directory, but always get this same error.

update: I tried reverting to vagrant 1.7.4, and get the same error. Also, this occurs when trying to do a vagrant up via git bash, cygwin, or windows cmd prompt.

swv
  • 691
  • 1
  • 12
  • 28

2 Answers2

2

For my case, it appears that this error is only occuring with this specific box. From too much additional troubleshooting, I finally found that using most any other box works fine, e.g. https://github.com/CommanderK5/packer-centos-template/releases/download/0.7.1/vagrant-centos-7.1.box.

I hope that this saves someone else some time.

swv
  • 691
  • 1
  • 12
  • 28
  • 2
    I experience the same error with a Debian 8 box. Didn't find the solutions yet, but with another box it works fine. See my post here: http://stackoverflow.com/questions/34858728/ – brasileric Jan 19 '16 at 07:35
  • I wonder if the "other" boxes work simply because they don't have any shared folders? I think I noticed that at one point, but didn't think much of it, as I was focused more on just getting some apps deployed. I'll report back once I have time to review both boxes and test this theory. – swv Jan 20 '16 at 13:41
  • well, my other Debian box which works well without rsync has also a shared /vagrant folder by default. So i'm still wondering what is the advantage of boxes which use rsync. – brasileric Jan 20 '16 at 13:54
0

Under Windows, RSync will try and update the %HOME%/.ssh/known_hosts file. If %HOME% is not defined as one of your environment variables, it may try and add/update that file where it has no permissions, and fail. Solution: Set user environment variable HOME to be %USERPROFILE%.

source: https://github.com/mitchellh/vagrant-aws/wiki/Common-Pitfalls

Glennular
  • 17,827
  • 9
  • 58
  • 77