使用vagrant 1.8.1,当尝试为已经初始化的框执行“vagrant up --provider virtualbox”时,我收到“错误:无法创建目录”/ home /用户名/ .ssh'。“
每个方向 - https://atlas.hashicorp.com/centos/boxes/7the以下:
命令:
vagrant init centos/7; vagrant up --provider virtualbox
输出:
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]
我最初没有/home/username/.ssh目录,因此我尝试使用手动创建的目录,然后使用符号链接到我现有的c:/users/username/.ssh目录,但是总是得到同样的错误。
更新:我尝试恢复到vagrant 1.7.4,并得到同样的错误。此外,当尝试通过git bash,cygwin或windows cmd提示进行流浪时,会发生这种情况。
答案 0 :(得分:2)
对于我的情况,似乎只有这个特定的框出现此错误。从太多额外的故障排除,我终于发现使用大多数其他任何盒子工作正常,例如https://github.com/CommanderK5/packer-centos-template/releases/download/0.7.1/vagrant-centos-7.1.box
我希望这能节省一些时间。
答案 1 :(得分:0)
在Windows下,RSync将尝试更新%HOME%/。ssh / known_hosts文件。如果%HOME%未定义为您的某个环境变量,它可能会尝试在没有权限的情况下添加/更新该文件,并失败。解决方案:将用户环境变量HOME设置为%USERPROFILE%。
来源:https://github.com/mitchellh/vagrant-aws/wiki/Common-Pitfalls