Vagrant 資料一覧

仮想マシン作成時に「"vboxsf" file system is not available」というメッセージが出て共有ディレクトリのマウントに失敗する

2014/11/09更新

対応バージョン: 1.4.3

仮想マシン作成時に以下のメッセージが出て共有ディレクトリのマウントに失敗する。

% vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
[default] Importing base box 'centos70_64'...
[default] Matching MAC address for NAT networking...
[default] Setting the name of the VM...
[default] Clearing any previously set forwarded ports...
[default] Clearing any previously set network interfaces...
[default] Preparing network interfaces based on configuration...
[default] Forwarding ports...
[default] -- 22 => 2222 (adapter 1)
[default] Booting VM...
[default] Waiting for machine to boot. This may take a few minutes...
[default] Machine booted and ready!
[default] Mounting shared folders...
[default] -- /vagrant
Failed to mount folders in Linux guest. This is usually beacuse
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 vagrant`,gid=`getent group vagrant | cut -d: -f3` /vagrant /vagrant
mount -t vboxsf -o uid=`id -u vagrant`,gid=`id -g vagrant` /vagrant /vagrant

これはVirtualBox Guest Additionsのカーネルモジュールが正しくビルドされていないのが原因なので以下のように同モジュールをビルドし直して仮想マシンを再起動すればよい。

% vagrant ssh -c "sudo /etc/init.d/vboxadd setup"
Removing existing VirtualBox non-DKMS kernel modules     [  OK  ]
Building the VirtualBox Guest Additions kernel modules
Building the main Guest Additions module                 [  OK  ]
Building the shared folder support module                [  OK  ]
Building the OpenGL support module                       [  OK  ]
Doing non-kernel setup of the Guest Additions            [  OK  ]
Starting the VirtualBox Guest Additions                  [  OK  ]
Connection to 127.0.0.1 closed.

% vagrant reload

% vagrant ssh -c "LANG=C df -h /vagrant"
Filesystem      Size  Used Avail Use% Mounted on
none            455G  103G  353G  23% /vagrant