Edited at

Vagrantでフォルダがmountできないエラーが出たときの対応

More than 3 years have passed since last update.


Vagrant failed to mount folders in Linux guest


  • Mac 10.9.5,

  • Virtualbox4.3.18

  • Vagrant 1.6.5

  • vagrant-vbguest (0.10.0) installed

上記の条件で以下のようにエラーになった

Failed to mount folders in Linux guest. 

. Please verify that
the guest additions are properly installed in the guest and
can work properly. The command attempted was:

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 last command was:

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

どうやらvagrant-vbguestのissueにあるFailed to mount folders in Linux guestのようだ。

vagrant ssh

Last login: Fri Mar 7 16:57:20 2014 from 10.0.2.2
[vagrant@localhost ~]$ sudo /etc/init.d/vboxadd setup
Removing existing VirtualBox non-DKMS kernel modules [ OK ]
Building the VirtualBox Guest Additions kernel modules
The headers for the current running kernel were not found. If the following
module compilation fails then this could be the reason.
The missing package can be probably installed with
yum install kernel-devel-2.6.32-431.el6.x86_64

Building the main Guest Additions module [失敗]
(Look at /var/log/vboxadd-install.log to find out what went wrong)
Doing non-kernel setup of the Guest Additions [ OK ]```

yum install kernel-devel-2.6.32-431.el6.x86_64でエラーっぽい

インストールする。

 sudo yum install kernel-devel-2.6.32-431.el6.x86_64

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: ftp.nara.wide.ad.jp
* extras: ftp.nara.wide.ad.jp
* updates: ftp.nara.wide.ad.jp
Setting up Install Process
No package kernel-devel-2.6.32-431.el6.x86_64 available.
Error: Nothing to do

存在しないみたいなこといわれてる。

stackoverflowのLinux - Yum Install GCC - Missing Kernel-headers を参考にしてetc/yum.confを修正。

とおもったが、そもそもそのような設定がない。

ということで直接インストールすることにしてみた。

vagrant ssh

sudo yum install http://vault.centos.org/6.4/cr/x86_64/Packages/kernel-2.6.32-431.el6.x86_64.rpm

sudo yum install http://vault.centos.org/6.4/cr/x86_64/Packages/kernel-2.6.32-431.el6.x86_64.rpm
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: ftp.nara.wide.ad.jp
* extras: ftp.nara.wide.ad.jp
* updates: ftp.nara.wide.ad.jp
base | 3.7 kB 00:00
extras | 3.3 kB 00:00
updates | 3.4 kB 00:00
Setting up Install Process
kernel-2.6.32-431.el6.x86_64.rpm | 28 MB 00:28
Examining /var/tmp/yum-root-zWdZb6/kernel-2.6.32-431.el6.x86_64.rpm: kernel-2.6.32-431.el6.x86_64
Marking /var/tmp/yum-root-zWdZb6/kernel-2.6.32-431.el6.x86_64.rpm to be installed
Package kernel-2.6.32-431.el6.x86_64 already installed and latest version
/var/tmp/yum-root-zWdZb6/kernel-2.6.32-431.el6.x86_64.rpm: does not update installed package.
Error: Nothing to do
[vagrant@localhost ~]$ Loaded plugins: fastestmirror
ras: ftp.nara.wide.ad.jp
* updates: ftp.nara.wide.ad.jp
base | 3.7 kB 00:00
extras | 3.3 kB 00:00
updates | 3.4 kB 00:00
Setting up Install Process
kernel-2.6.32-431.el6.x86_64.rpm | 28 MB 00:28
Examining /var/tmp/yum-root-zWdZb6/kernel-2.6.32-431.el6.x86_64.rpm: kernel-2.6.32-431.el6.x86_64
Marking /var/tmp/yum-root-zWdZb6/kerne-bash: Loaded: コマンドが見つかりません
[vagrant@localhost ~]$ Loading mirror speeds from cached hostfile
-bash: Loading: コマンドが見つかりません

だめでした。

kernelをとりあえずupdateする。

yum update kernel*

でいけたっぽい。

手元の環境なのでとりあえず、動けばいいのでとりあえずこれで解決。



追記

2014.12.26 update

sudo yum install http://vault.centos.org/6.4/cr/x86_64/Packages/kernel-2.6.32-431.el6.x86_64.rpm は

sudo yum install http://vault.centos.org/6.4/cr/x86_64/Packages/kernel-devel-2.6.32-431.el6.x86_64.rpm

で良いらしいです。