【问题标题】:vagrant up "Error: Could not create directory '/home/username/.ssh'" when using cygwin使用 cygwin 时 vagrant up “错误:无法创建目录 '/home/username/.ssh'”
【发布时间】:2016-01-12 22:11:56
【问题描述】:

使用 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 提示符进行 vagrant up 时,也会发生这种情况。

【问题讨论】:

    标签: windows cygwin vagrant


    【解决方案1】:

    就我而言,这个错误似乎只发生在这个特定的盒子上。从太多额外的故障排除中,我终于发现使用大多数其他盒子都可以正常工作,例如https://github.com/CommanderK5/packer-centos-template/releases/download/0.7.1/vagrant-centos-7.1.box.

    我希望这可以节省其他人一些时间。

    【讨论】:

    • 我在使用 Debian 8 机器时遇到了同样的错误。还没有找到解决方案,但是用另一个盒子可以正常工作。在这里查看我的帖子:stackoverflow.com/questions/34858728
    • 我想知道“其他”框是否仅仅因为它们没有任何共享文件夹而起作用?我想我曾经注意到这一点,但并没有多想,因为我更专注于部署一些应用程序。一旦我有时间审查这两个盒子并测试这个理论,我会回来报告。
    • 好吧,我的另一个 Debian 盒子在没有 rsync 的情况下也能正常工作,默认情况下也有一个共享的 /vagrant 文件夹。所以我仍然想知道使用 rsync 的盒子有什么优势。
    【解决方案2】:

    在 Windows 下,RSync 将尝试更新 %HOME%/.ssh/known_hosts 文件。如果 %HOME% 未定义为您的环境变量之一,它可能会尝试在没有权限的地方添​​加/更新该文件,但会失败。解决方法:设置用户环境变量HOME为%USERPROFILE%。

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-09-23
      • 2021-02-03
      • 2016-11-12
      • 2020-10-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-09-04
      相关资源
      最近更新 更多