LoginSignup
12
11

More than 5 years have passed since last update.

Vagrantの共有フォルダ設定時にエラーが出た時の対処(CentOS/7,v1611.01)

Last updated at Posted at 2017-08-18

Qiita初投稿です。Vagrantfileで共有フォルダを設定したらエラーが出て止まったので、その時の原因と対処法を残しておきます。

環境

vagrant boxの種類。(Vagrantfileの設定)。さくらVPSも使用しているのでそちらのCentOS7のバージョンと合わせています。

  • vagrantのバージョン:1.9.7
  • config.vm.box = "centos/7"
  • config.vm.box_version = "1611.01"

共有フォルダ設定で次の一文を記載すると下記のエラーが発生

config.vm.synced_folder "./provisioning/share", "/home/share"
エラーメッセージ
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_share /home/vagrant/share

The error output from the command was:

mount: unknown filesystem type 'vboxsf'

どうもGuest Additionsに問題がありそう。

原因

vagrant up後のメッセージを読み返すと、以下のメッセージを見逃していました。

==> default: Checking for guest additions in VM...
    default: No guest additions were detected on the base box for this VM! Guest
    default: additions are required for forwarded ports, shared folders, host only
    default: networking, and more. If SSH fails on this machine, please install
    default: the guest additions and repackage the box to continue.

そもそもGuest Additionsがこのボックスにはないと言われてますね。

対処

Guest Additionsをインストールするため以下のプラグインを追加。詳細

$ vagrant plugin install vagrant-vbguest

再度vagrant upを実行すると途中で以下の一文があったので無事にインストールされた模様。

Installing Virtualbox Guest Additions 5.1.22 - guest version is unknown

問題なく共有フォルダの設定が出来てvagrantが起動しました。

12
11
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
12
11