質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.50%
VirtualBox

VirtualBoxは、現在米オラクル社が開発している、 x86仮想化ソフトウェア・パッケージの一つです。

Vagrant

Vagrantは、VirtualBox上の仮想マシンを コマンドラインから作成してくれるソフトウェアです。 ビルド環境など容易に構築が可能です。

Q&A

解決済

1回答

7413閲覧

ローカルとvargrentをrsyncしたくvagrantfileを編集したところ、vagrant up中に以下のエラーメッセージが発生しました。何が原因かアドバイスを頂けないでしょうか?

EndoDaijiro

総合スコア13

VirtualBox

VirtualBoxは、現在米オラクル社が開発している、 x86仮想化ソフトウェア・パッケージの一つです。

Vagrant

Vagrantは、VirtualBox上の仮想マシンを コマンドラインから作成してくれるソフトウェアです。 ビルド環境など容易に構築が可能です。

0グッド

0クリップ

投稿2016/05/27 08:20

編集2016/05/27 08:48

###前提・実現したいこと
windows10環境でrsyncを使い、ローカル開発フォルダとvagrantの公開フォルダの同期を行いたいです。

しかし、ローカルとvargrentをrsyncしようとvagrantfileを編集したところ、vagrant up中に以下のエラーメッセージが発生しました。何が原因かアドバイスを頂けないでしょうか?

Error: Could not create directory '/home/hoge/.ssh'
という部分がどこを指しているのか、どのように編集すべきなのか不明であり特に悩んでいます。よろしくお願いいたします。

###発生している問題・エラーメッセージ
■windowsコマンドプロンプト

default: Guest Additions Version: 4.3.28
default: VirtualBox Version: 5.0
==> default: Configuring and enabling network interfaces...
==> default: Rsyncing folder: /c/Users/username/hoge/src/ => /home/test/public
==> default: - Exclude: [".vagrant/", ".git/", "vendor/"]

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

Host path: /c/Users/username/hoge/src/
Guest path: /home/test/public
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:/Users/ENDODA~1/AppData/Local/Temp/ssh.566 -o ControlPersist=10m -o StrictHostKeyChecking=no -o IdentitiesOnly=true -o UserKnownHostsFile=/dev/null -i 'C:/Users/endodaijiro/wonder/.vagrant/machines/default/virtualbox/private_key' --exclude .vagrant/ --exclude .git/ --exclude vendor/ /c/Users/username/hoge/src/ vagrant@127.0.0.1:/home/test/public
Error: Could not create directory '/home/hoge/.ssh'.
Warning: Permanently added '[127.0.0.1]:2222' (RSA) 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]

###該当のソースコード

■vagrantfile config.vm.network :public_network,ip:"192.168.xx.xxx",bridge:"en1: Ethernet" config.vm.synced_folder "C:\\Users\\username\\hoge\\src", "/home/test/public", type: "rsync", owner: "vagrant", group: "vagrant", rsync__exclude: [".git/", "vendor/"]

###試したこと
参考にして試したものになります。
Windows+cygwin+sshで”Could not create directory”が出るとき

Windows + vagrant 1.8.1 + cwRsync 5.5.0 だと、synced_folderでエラーになる

###補足情報(言語/FW/ツール等のバージョンなど)
①Virtual Box(version 5.0.20-106931-Win)
②Vagrat(version 1.8.1)
③rsync(version 5.4.1.20150827)

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

ベストアンサー

原因は別の所で、Vagrantの下記バグに相当すると思われます。
rsync doesn't work on Vagrant 1.8.0 #6702
arthuroyさんが投稿しているとおり、下記の対応で解決する場合があります。お試しください。

  1. $VAGRANT_HOME\embedded\gems\gems\vagrant-1.8.0\plugins\synced_folders\rsync\helper.rb を適当なテキストエディタ(メモ帳以外)で開く。(1.8.1だとバージョン部分は1.8.1かも知れませんのでご注意を)
  2. 77〜79行目の下記の行を削除する。

Ruby

1"-o ControlMaster=auto " + 2"-o ControlPath=#{controlpath} " + 3"-o ControlPersist=10m " +

なお、/home/hoge/.sshが作られないの方は無視しても動くはずです。エラーを無くしたい場合は、MSYS2版rsyncをMSYS2環境で使う、Cygwin版rysncをCygwin環境で使うと言った手順で解決できます。

投稿2016/05/27 09:44

編集2016/05/27 09:45
raccy

総合スコア21733

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

EndoDaijiro

2016/05/30 04:13

raccy様 的確なアドバイス頂きありがとうございました!無事にrsyncし問題解決することができました!まさかVagrantのバグが問題をややこしくしていたとは。。 Cygwin環境でrsyncでエラー表示問題もクリアし、とても感謝しております。本当にありがとうございました!これでバリバリと開発することができます。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.50%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問