Vagrant起動時に共有フォルダのマウントに失敗したら


Vagrant起動時に共有フォルダのマウントに失敗したら | Bamboo lath 日々の記録毎回調べるのが面倒なのでメモ。

vagrantの起動時に以下のように出た場合の対処方法。
HostOS:Windows10
GuestOS:CentOS7
VirtualBox:5.1.4
Vagrant:1.8.5

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 attemped was:

set -e
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

The error output from the command was:

/sbin/mount.vboxsf: mounting failed with the error: No such device

guestにsshでログインして、

# yum install kernel-devel kernel-headers gcc make
# yum install dkms
# export MAKE='/usr/bin/gmake -i'
# /etc/init.d/vboxadd setup
Removing existing VirtualBox DKMS kernel modules           [  OK  ]
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  ]

この状態になったら、hostで

vagrant halt
vagrant up

エラーが消えているはず。

コメントを残す

メールアドレスが公開されることはありません。