Vagrant Error 'Failed to mount folders in Linux guest.'
環境
- Mac OS X 10.10.5
- Vagrant 1.7.2
- VirtualBox 4.3.28
- ゲストOS -> CentOS Linux release 7.2.1511
エラーの内容
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`,dmode=777,fmode=777 vagrant /vagrant mount -t vboxsf -o uid=`id -u vagrant`,gid=`id -g vagrant`,dmode=777,fmode=777 vagrant /vagrant The error output from the last command was: mount: unknown filesystem type 'vboxsf'
ゲストOSにGuest Additions をインストールする必要があるようです。
ゲストOS(CentOS)にmake,gcc,kernel-devel,wgetをインストール
$ sudo yum install -y make
$ sudo yum install -y gcc
$ sudo yum install -y kernel-devel
sudo yum install -y wget
ゲストOS(CentOS)で、Guest Additions をインストール
リムーバブル媒体(media)のマウントポイント(/media)にGuest Additions 用のディレクトリを作成
$ sudo mkdir -p /media/VirtualBoxGuestAdditions
GuestAdditionsのisoをダウンロード(ローカルのVirtualBox 4.3.28 合わせる)
$ cd /media $ sudo wget http://download.virtualbox.org/virtualbox/4.3.28/VBoxGuestAdditions_4.3.28.iso
isoをマウントする
$ ll total 56880 -rw-r--r--. 1 root root 58241024 May 13 2015 VBoxGuestAdditions_4.3.28.iso drwxr-xr-x. 2 root root 4096 Jun 23 12:20 VirtualBoxGuestAdditions
$ sudo mount -t iso9660 -o loop VBoxGuestAdditions_4.3.28.iso VirtualBoxGuestAdditions/ mount: /dev/loop0 is write-protected, mounting read-only
マウントされているか確認
$ df Filesystem 1K-blocks Used Available Use% Mounted on /dev/mapper/VolGroup00-LogVol00 38765936 1234024 35539620 4% / devtmpfs 239636 0 239636 0% /dev tmpfs 250548 0 250548 0% /dev/shm tmpfs 250548 8508 242040 4% /run tmpfs 250548 0 250548 0% /sys/fs/cgroup /dev/sda2 487634 121116 336822 27% /boot tmpfs 50112 0 50112 0% /run/user/0 tmpfs 50112 0 50112 0% /run/user/1000 /dev/loop0 56876 56876 0 100% /media/VirtualBoxGuestAdditions
Guest Additions をインストール
$ sudo /media/VirtualBoxGuestAdditions/VBoxLinuxAdditions.run Verifying archive integrity... All good. Uncompressing VirtualBox 4.3.28 Guest Additions for Linux............ VirtualBox Guest Additions installer Copying additional installer modules ... Installing additional modules ... 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 [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.
OpenGL でエラーが出ていますが、とりあえず無視…
Guest Additions が有効か確認する
$sudo mount -t -o uid=`id -u vagrant`,gid=`getent group vagrant | cut -d: -f3`,dmode=777,fmode=777 vagrant /vagrant $sudo mount -t vboxsf -o uid=`id -u vagrant`,gid=`id -g vagrant`,dmode=777,fmode=777 vagrant /vagrant
どうやら大丈夫そうです。
再度vagrant up したら今度はエラー出ませんでした。
かなり怪しい解決方法ですが、以上です。