0

Vagrant バージョン 1.6.3

バーチャルボックス 4.3.12

VBoxGuestAdditions-4.3.2

ホスト OS -> Windows 8

ゲスト OS -> CentOS 6.5

これが Vagrentfile のコンテンツである場合、Vagrant synced_folder は正常に動作します

config.vm.synced_folder ".", "/vagrant", disabled: true
config.vm.synced_folder ".", "/var/www"

しかし、synced_folder (/var/www) 内のファイルまたはディレクトリのアクセス許可を変更できません。 https://github.com/mitchellh/vagrant/issues/897

この問題を解決するために、Vagrentfile https://serverfault.com/questions/398414/vagrant-set-default-share-permissionsに次の変更を加えました

config.vm.synced_folder ".", "/vagrant", disabled: true
config.vm.synced_folder ".", "/var/www",
:owner=> 'shiva',
:group=> 'shiva',
:mount_options=> ['dmode=>777', 'fmode=>666']

(「shiva」は私が作成したユーザーです。デフォルトのユーザー「vagrant」を削除しました)

問題は、vagrant up を実行しようとすると、このエラーが表示されることです

==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
==> default: Forwarding ports...
default: 22 => 2222 (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2222
default: SSH username: shiva
default: SSH auth method: password
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Remote connection disconnect. Retrying...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
==> default: Mounting shared folders...
default: /var/www => C:/Users/Shiva/CentOSDevEnv_v1_1

Failed to mount folders in Linux guest. This is usually because
the "vboxsf" file system is not available. Please verify that
the guest additions are properly installed in the guest and
can work properly. The command attempted was:

mount -t vboxsf -o uid=`id -u shiva`,gid=`getent group shiva | cut -d: -
f3`,dmode=>777,fmode=>666 var_www /var/www
mount -t vboxsf -o uid=`id -u shiva`,gid=`id -g shiva`,dmode=>777,fmode=
>666 var_www /var/www

私はすでにこのリンクを通過してい ます https://github.com/mitchellh/vagrant/issues/3341

Rubyの構文(Vagrantfileの構文)がわかりません。私は本当にここで立ち往生しています、助けてください。

4

1 に答える 1

2

エラーは私のVagrantfile構文にありました、私の悪い:(

これは正しい構文です

:mount_options=> ['dmode=777', 'fmode=666']

しかし、 vagrant が次のような正しいエラー情報を表示できると、より役に立ちます。

"Error in Vagrantfile syntax" 

それ以外の

"This is usually because the "vboxsf" file system is not available. Please verify that
the guest additions are properly installed in the guest and can work properly."
于 2014-09-16T03:50:30.243 に答える