LoginSignup
14
14

More than 5 years have passed since last update.

Vagrant エラー(Guest Additions - vboxsf)

Last updated at Posted at 2017-07-02

vagrantを使っていてエラーで困った時に調べた内容をメモしておきます。


共有フォルダがマウントできない

vagrant upコマンドを打つと下記のようなエラーが表示される場合の対応。

コマンドプロンプト
$ vagrant up
     ・
     ・
     ・
Vagrant was unable to mount VirtualBox shared folders. this is usually
because the filesystem "vboxsf" is not available. This filesystem is
made available via the VirtualBox Guest Additions and kernel module.
Please Verify that these guest additions are properly installed in the
guest. This is not a bug in Vagrant and is usually caused by a faulty
Vagrant box. For context, the command attempted was:

mount -t vboxsf -o uid=1000,gid=1000 home_vagrant_opt_ /home/vagrant/opt

The error output from the command was:

mount: unknown filesystem type 'vboxsf'

原因

ホスト ⇔ ゲスト間のフォルダ共有機能は、Guest Additionsが提供しており、
ホスト(VirtualBox)とゲスト(Guest Additions)でバージョン不一致があると
マウントエラーが起きるとのことらしい。

対策

「vagrant-vbguest」というプラグインをインストールして対応する。

$ vagrant plugin install vagrant-vbguest
$ vagrant vbguest
$ vagrant vbguest --status
GuestAdditions 5.0.16 running --- OK.
$ vagrant reload

その他

逆にvbguestにて自動更新するとエラーになる場合もあるようです。
そういった場合は、下記のようにVagrantfileに追記して、自動更新をストップする方法もあるようです。

Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|
  config.vm.box = "centos/7"

  # auto update off
  if Vagrant.has_plugin?("vagrant-vbguest") then
    config.vbguest.auto_update = false
  end
end

参考文献


14
14
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
14
14