LoginSignup
5
6

More than 5 years have passed since last update.

Vagrant 事始め 番外編 02 - 共有フォルダの共有に失敗する

Last updated at Posted at 2018-04-13

新しく作成した Vagrantbox を起動している途中で、共有フォルダが作成できないというエラーが発生しました。

> vagrant up
==> default: Attempting graceful shutdown of VM...
==> default: Checking if box 'centos/7' is up to date...
==> default: Clearing any previously set forwarded ports...
Vagrant is currently configured to create VirtualBox synced folders with the `SharedFoldersEnableSymlinksCreate` option enabled. If the Vagrant guest is not trusted, you may want to disable this option. For more information on this option, please refer to the VirtualBox manual:

  https://www.virtualbox.org/manual/ch04.html#sharedfolders

This option can be disabled globally with an environment variable:

  VAGRANT_DISABLE_VBOXSYMLINKCREATE=1

or on a per folder basis within the Vagrantfile:

  config.vm.synced_folder '/host/path', '/guest/path', SharedFoldersEnableSymlinksCreate: false

...

==> default: Mounting shared folders...
    default: /vagrant_data => C:/Vagrant/centos7/data
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 vagrant_data /vagrant_data

The error output from the command was:

mount: unknown filesystem type 'vboxsf'

最終行に表示された mount: unknown filesystem type 'vboxsf' でピンときたので、起動に失敗した仮想マシンのプラグインのインストール状態を確認します。

共有フォルダ有効化に必要なプラグインを確認する

> vagrant plugin list
No plugins installed.

vagrant-vbguest (Virtualbox Guest Additions) がインストールされていないです。

共有フォルダ有効化に必要なプラグインをインストールする

vagrant-vbguest を手動でインストールします。

> vagrant plugin install vagrant-vbguest
Installing the 'vagrant-vbguest' plugin. This can take a few minutes...
Fetching: micromachine-2.0.0.gem (100%)
Fetching: vagrant-vbguest-0.15.1.gem (100%)
Installed the plugin 'vagrant-vbguest (0.15.1)'!

プラグインの状態を確認しようとしたら、仮想マシンが起動している必要があると警告が出たので、vagrant up をします。

> vagrant vbguest --status
VM must be running to open SSH connection. Run `vagrant up` to start the virtual machine.

> vagrant up
...

プラグインに必要なソフトウェアのインストールがしばらく続きます。完了したら、vagrant vbguest --status で確認します。

> vagrant vbguest --status
[default] GuestAdditions 5.2.8 running --- OK.

これで共有フォルダが利用できるようになりました。

5
6
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
5
6