目的
Vagrant で仮想マシンは起動できるのですが、共有フォルダのマウントに失敗しています。
発生しているエラー
default: /vagrant => [動かしている環境]
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=500,gid=500 vagrant /vagrant
The error output from the command was:
/sbin/mount.vboxsf: mounting failed with the error: No such device
対応手順
$ vagrant plugin install vagrant-vbguest
Installing the 'vagrant-vbguest' plugin. This can take a few minutes...
Installed the plugin 'vagrant-vbguest (0.15.1)'!
$ vagrant vbguest --status
[default] GuestAdditions versions on your host (5.2.6) and guest (4.3.8) do not match.
guest が古いので、vbguest プラグインで更新します。
$ vagrant vbguest
[default] GuestAdditions versions on your host (5.2.6) and guest (4.3.8) do not match.
Loaded plugins: fastestmirror
Setting up Install Process
Loading mirror speeds from cached hostfile
* base: ftp.jaist.ac.jp
* extras: ftp.jaist.ac.jp
* remi-safe: mirrors.thzhost.com
* updates: ftp.jaist.ac.jp
No package kernel-devel-2.6.32-573.7.1.el6.x86_64 available.
Package gcc-4.4.7-18.el6.x86_64 already installed and latest version
Package binutils-2.20.51.0.2-5.47.el6_9.1.x86_64 already installed and latest version
Package 1:make-3.81-23.el6.x86_64 already installed and latest version
Package 4:perl-5.10.1-144.el6.x86_64 already installed and latest version
Package bzip2-1.0.5-7.el6_0.x86_64 already installed and latest version
Nothing to do
Copy iso file /Applications/VirtualBox.app/Contents/MacOS/VBoxGuestAdditions.iso into the box /tmp/VBoxGuestAdditions.iso
Mounting Virtualbox Guest Additions ISO to: /mnt
Installing Virtualbox Guest Additions 5.2.6 - guest version is 4.3.8
Verifying archive integrity... All good.
Uncompressing VirtualBox 5.2.6 Guest Additions for Linux........
VirtualBox Guest Additions installer
Removing installed version 5.2.6 of VirtualBox Guest Additions...
You may need to restart your guest system to finish removing the guest drivers.
Copying additional installer modules ...
Installing additional modules ...
VirtualBox Guest Additions: Building the VirtualBox Guest Additions kernel modules.
This system is currently not set up to build kernel modules.
Please install the Linux kernel "header" files matching the current kernel
for adding new hardware support to the system.
The distribution packages containing the headers are probably:
kernel-devel kernel-devel-2.6.32-573.7.1.el6.x86_64
VirtualBox Guest Additions: Starting.
VirtualBox Guest Additions: Building the VirtualBox Guest Additions kernel modules.
This system is currently not set up to build kernel modules.
Please install the Linux kernel "header" files matching the current kernel
for adding new hardware support to the system.
The distribution packages containing the headers are probably:
kernel-devel kernel-devel-2.6.32-573.7.1.el6.x86_64
An error occurred during installation of VirtualBox Guest Additions 5.2.6. Some functionality may not work as intended.
In most cases it is OK that the "Window System drivers" installation failed.
VirtualBox Guest Additions: Starting.
VirtualBox Guest Additions: Building the VirtualBox Guest Additions kernel modules.
This system is currently not set up to build kernel modules.
Please install the Linux kernel "header" files matching the current kernel
for adding new hardware support to the system.
The distribution packages containing the headers are probably:
kernel-devel kernel-devel-2.6.32-573.7.1.el6.x86_64
groupadd: group 'vboxadd' already exists
modprobe vboxguest failed
The log file /var/log/vboxadd-setup.log may contain further information.
ゲスト側の /var/log/vboxadd-setup.log
は下記が残っていました。
Building the main Guest Additions module.
/tmp/vbox.0/Makefile.include.header:141: *** Error: unable to find the headers of the Linux kernel to build against. Specify KERN_VER=<version> (currently 2.6.32-573.7.1.el6.x86_64) and run Make again. Stop.
Creating user for the Guest Additions.
Creating udev rule for the Guest Additions kernel module.
modprobe vboxguest failed
ここでエラーを追うのはストップしようと思い Vagrant を再起動すると、共有フォルダがマウントされるようになりました。
$ vagrant halt
$ vagrant up
※注意: 根本解決はしていません