LoginSignup
4
6

More than 5 years have passed since last update.

Vagrantのフォルダ同期のエラーの対処

Posted at

VirtualBoxのバージョンを最新にした時に、フォルダ同期が失敗。
いろいろ調べて治ったのでメモ。

環境

VirtualBox: 4.3.26
Vagrant: 1.7.2
ゲストOS: CentOS release 6.4 (Final) / CentOS 7
ホストOS: Windows7

エラー解決方法

vagrant-vbguestをインストール

$ vagrant plugin install vagrant-vbguest

kernel、kernel-develのインストール・アップグレード

  • アップグレードの前に、設定を変更 /etc/yum.conf にカーネルの類を除外している設定があるので、コメントアウトする。
- exclude=kernel*
+ # exclude=kernel*
  • インストール・アップグレード
yum -y install kernel kernel-devel

Vagrantを上げ直す

vagrant halt
vagrant up

以上をやったら僕の環境では治りました。

経緯

VirtualBoxとりあえず最新にしたかったので、アップデートをしたら、
フォルダ同期出来ず。
GuestAdditionのビルドがFailedしている。

Installing Virtualbox Guest Additions 4.3.26 - guest version is 4.3.4
Verifying archive integrity... All good.
Uncompressing VirtualBox 4.3.26 Guest Additions for Linux............
VirtualBox Guest Additions installer
Removing installed version 4.3.4 of VirtualBox Guest Additions...
Copying additional installer modules ...
Installing additional modules ...
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[FAILED]
(Look at /var/log/vboxadd-install.log to find out what went wrong)
Doing non-kernel setup of the Guest Additions[  OK  ]
Installing the Window System drivers
Could not find the X.Org or XFree86 Window System, skipping.
An error occurred during installation of VirtualBox Guest Additions 4.3.26. Some functionality may not work as intended.


Failed to mount folders in Linux guest. This is usually because
the "vboxsf" file system is not available. 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` var_www /var/www
mount -t vboxsf -o uid=`id -u vagrant`,gid=`id -g vagrant` var_www /var/www

The error output from the last command was:

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

マウントが出来ないらしい。
kernel-develのインストールもできていないらしい。
なので、手動でインストールしてみる。

[root@vagrant-centos65 ~]# yum install kernel-devel
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: www.ftp.ne.jp
 * epel: ftp.tsukuba.wide.ad.jp
 * extras: www.ftp.ne.jp
 * rpmforge: ftp.riken.jp
 * updates: www.ftp.ne.jp
Setting up Install Process
No package kernel-devel available.
Error: Nothing to do
[root@vagrant-centos65 ~]#

インストール出来ない。

調べたら、yumのデフォルトの設定でkernel*のパッケージは除外している模様なので、設定を変更。

[root@vagrant-centos65 ~]# vi /etc/yum.conf
# exclude=kernel*

で、もう一度kernel-develをインストール。

yum -y install kernel-devel
...
Installed:
  kernel-devel.x86_64 0:2.6.32-504.12.2.el6

Complete!

でもだめ。
/var/log/vboxadd-install.logを見ろって出てるので見てみたら、
kernelのソースがないよとエラーが出ていたので、kernelもインストール(アップグレード?)

yum -y install kernel

で、Vagrantを一旦haltしてupしなおしたら、ちゃんと動きました。

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