7

私はvagrantでシェルプロビジョニングスクリプトを少しプロビジョニングしました(パペットが失敗するものをインストールするために..)スクリプト:

#!/bin/bash
echo 'provisioning librarian'
gem install librarian-puppet
librarian-puppet install

正常に実行されますsh prescript.sh が、vagrant プロビジョニングからは次のように失敗します。

D:/HashiCorp/Vagrant/embedded/gems/gems/net-scp-1.1.0/lib/net/scp.rb:385:in `awa
it_response_state': ☺scp: /tmp/vagrant-shell: Read-only file system (RuntimeErro
r)
        from D:/HashiCorp/Vagrant/embedded/gems/gems/net-scp-1.1.0/lib/net/scp.r
b:356:in `block (3 levels) in start_command'
        from D:/HashiCorp/Vagrant/embedded/gems/gems/net-ssh-2.6.7/lib/net/ssh/c
onnection/channel.rb:311:in `call'
        from D:/HashiCorp/Vagrant/embedded/gems/gems/net-ssh-2.6.7/lib/net/ssh/c
onnection/channel.rb:311:in `process'
        from D:/HashiCorp/Vagrant/embedded/gems/gems/net-ssh-2.6.7/lib/net/ssh/c
onnection/session.rb:217:in `block in preprocess'
        from D:/HashiCorp/Vagrant/embedded/gems/gems/net-ssh-2.6.7/lib/net/ssh/c
onnection/session.rb:217:in `each'
        from D:/HashiCorp/Vagrant/embedded/gems/gems/net-ssh-2.6.7/lib/net/ssh/c
onnection/session.rb:217:in `preprocess'
        from D:/HashiCorp/Vagrant/embedded/gems/gems/net-ssh-2.6.7/lib/net/ssh/c
onnection/session.rb:200:in `process'
        from D:/HashiCorp/Vagrant/embedded/gems/gems/net-ssh-2.6.7/lib/net/ssh/c
onnection/session.rb:164:in `block in loop'
        from D:/HashiCorp/Vagrant/embedded/gems/gems/net-ssh-2.6.7/lib/net/ssh/c
onnection/session.rb:164:in `loop'
        from D:/HashiCorp/Vagrant/embedded/gems/gems/net-ssh-2.6.7/lib/net/ssh/c
onnection/session.rb:164:in `loop'
        from D:/HashiCorp/Vagrant/embedded/gems/gems/net-ssh-2.6.7/lib/net/ssh/c
onnection/channel.rb:269:in `wait'
        from D:/HashiCorp/Vagrant/embedded/gems/gems/net-scp-1.1.0/lib/net/scp.r
b:279:in `upload!'
        from D:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.2.2/plugins/commu
nicators/ssh/communicator.rb:105:in `block in upload'
        from D:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.2.2/plugins/commu
nicators/ssh/communicator.rb:331:in `block in scp_connect'
        from D:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.2.2/plugins/commu
nicators/ssh/communicator.rb:139:in `connect'
        from D:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.2.2/plugins/commu
nicators/ssh/communicator.rb:329:in `scp_connect'
        from D:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.2.2/plugins/commu
nicators/ssh/communicator.rb:99:in `upload'
        from D:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.2.2/plugins/provi
sioners/shell/provisioner.rb:20:in `block (2 levels) in provision'
        from D:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.2.2/plugins/provi
sioners/shell/provisioner.rb:14:in `tap'
        from D:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.2.2/plugins/provi
sioners/shell/provisioner.rb:14:in `block in provision'
        from D:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.2.2/plugins/provi
sioners/shell/provisioner.rb:78:in `with_script_file'
        from D:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.2.2/plugins/provi
sioners/shell/provisioner.rb:12:in `provision'
        from D:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/a
ction/builtin/provision.rb:65:in `run_provisioner'
        from D:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/a
ction/builtin/provision.rb:53:in `block in call'
        from D:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/a
ction/builtin/provision.rb:49:in `each'
        from D:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/a
ction/builtin/provision.rb:49:in `call'
        from D:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/a
ction/warden.rb:34:in `call'
        from D:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.2.2/plugins/provi
ders/virtualbox/action/check_accessible.rb:18:in `call'
        from D:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/a
ction/warden.rb:34:in `call'
        from D:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/a
ction/runner.rb:61:in `block in run'
        from D:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/u
til/busy.rb:19:in `busy'
        from D:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/a
ction/runner.rb:61:in `run'
        from D:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/a
ction/builtin/call.rb:51:in `call'
        from D:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/a
ction/warden.rb:34:in `call'
        from D:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/a
ction/runner.rb:61:in `block in run'
        from D:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/u
til/busy.rb:19:in `busy'
        from D:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/a
ction/runner.rb:61:in `run'
        from D:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/a
ction/builtin/call.rb:51:in `call'
        from D:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/a
ction/warden.rb:34:in `call'
        from D:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/a
ction/builtin/config_validate.rb:25:in `call'
        from D:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/a
ction/warden.rb:34:in `call'
        from D:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.2.2/plugins/provi
ders/virtualbox/action/check_virtualbox.rb:17:in `call'
        from D:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/a
ction/warden.rb:34:in `call'
        from D:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/a
ction/builder.rb:116:in `call'
        from D:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/a
ction/runner.rb:61:in `block in run'
        from D:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/u
til/busy.rb:19:in `busy'
        from D:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/a
ction/runner.rb:61:in `run'
        from D:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/m
achine.rb:147:in `action'
        from D:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.2.2/plugins/comma
nds/provision/command.rb:26:in `block in execute'
        from D:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/p
lugin/v2/command.rb:182:in `block in with_target_vms'
        from D:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/p
lugin/v2/command.rb:180:in `each'
        from D:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/p
lugin/v2/command.rb:180:in `with_target_vms'
        from D:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.2.2/plugins/comma
nds/provision/command.rb:25:in `execute'
        from D:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/c
li.rb:46:in `execute'
        from D:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/e
nvironment.rb:467:in `cli'
        from D:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.2.2/bin/vagrant:8
4:in `<top (required)>'
        from D:/HashiCorp/Vagrant/bin//../embedded/../embedded/gems/bin/vagrant:
23:in `load'
        from D:/HashiCorp/Vagrant/bin//../embedded/../embedded/gems/bin/vagrant:
23:in `<main>'

ここでのアドバイスに従って、私はすでに(sublimetext2を使用して)Windowsの行末をunixに変更しました。しかし、まだアイデアは失敗します

4

3 に答える 3

7

いくつかの可能性:

シンボリック リンクをサポートしていない VirtualBox の共有フォルダーを使用している可能性があります (修正されていない場合)。おそらく、VBoxManageこれを修正するためのコマンドがあると思われます。

VBoxManage setextradata VM_NAME VBoxInternal2/SharedFoldersEnableSymlinksCreate/SHARE_NAME 1

またはこれをVagrantファイルに入れます(SHARE_NAMEがこのファイルのv-rootであると仮定します):

config.vm.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/v-root", "1"]

その他の可能性については、https://www.virtualbox.org/ticket/10085#comment: 12 またはhttps://github.com/mitchellh/vagrant/issues/713のトピックに関する長いフォーラムを参照してください。

もう 1 つの可能性は、ブート プロセスの早い段階でスクリプトを実行しているために、ルート (または /tmp のみ) ファイルシステムが読み取り/書き込みモードで再マウントされていない可能性があります。 /etc/rc.2/S(num)(name) スクリプトと (num) が低すぎます。

于 2013-07-19T06:14:28.727 に答える
1

仮想マシンを実行中にこのエラーが発生しましvagrant upた。私の場合、仮想マシンの以前のコピーがバックグラウンドで実行されていたことが問題のようです。いくつかの歴史:

  • この同じプロジェクトの VM が以前にクラッシュしたことがあり (数時間前)、ターミナル ウィンドウ (macOS) を閉じて VM を再起動する必要がありました ( vagrant halt+を使用vagrant up)。
  • これで問題が解決したように見えたので、私は普通に進めて、それを忘れていました.
  • その後、Vagrantfile に変更を加え、すべてが機能することを確認した後、VM を破棄して新しい VM を作成しvagrant upましたが、このエラーが発生しました。
  • @AlexNorth-Keys の回答を読んだ後、VM が以前にクラッシュしたという事実を思い出したので、コンピューターを再起動することにしました。クラッシュした VM のコピーがバックグラウンドで実行されていて、プロジェクト フォルダーの共有が問題を引き起こしていることは確かです。

明らかにこれは単なる推測ですが、ホスト マシンを再起動すると問題が解決しました。

于 2017-06-26T21:39:36.083 に答える
0

私の場合、その理由は /etc/fstab が Vagrant インスタンスで変更されたためです。このファイルで遊んで問題が発生した場合は、次の解決策が考えられます。

  1. 放浪者のssh
  2. マウント -o 再マウント、rw /
  3. ここで、ファイル /etc/fstab を編集します。ナノ /etc/fstab
  4. 必要な変更を提供します (たとえば、nolockオプションを削除します)
  5. 放浪者を出る
  6. vagrant リロード
于 2020-06-24T10:03:41.850 に答える