はじめに
プロジェクトで使う仮想環境(Vagrant)の構築をしていたときに、いくつかエラーが出てたので調べながら環境構築をした。
参考先が多岐にわたったので、備忘録的な感じでやったことをMEMOしておく。
構成
- Mac:10.11.5
- Vagrant:1.8.5
- ikari7789/centos-6.6
default: Warning: Authentication failure. Retrying...
$ cd {target_project}
$ vagrant up
実行すると下記の箇所で詰まる。
default: Key inserted! Disconnecting and reconnecting using new SSH key...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
ググってみると、以下ブログ様に解決方法があったのでその通りにする。(公式ちゃんと読めってことですね)
Vagrantfile
config.ssh.insert_key = false
上記のVagrantfileを変更したら、現在Vagrant起動状態になっているはずなので、
$ vagrant reload
で再起動をする。
と、
Vagrant was unable to mount VirtualBox shared folders. This is usually because the filesystem "vboxsf" is not available.
マウント時に何やらエラーが出る。
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
vboxsfがどうにかなっている?
下記を参考に解決。
コマンド
$ vagrant ssh
$ sudo su -
# /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-642.11.1.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 ]
カーネルをインストールしろって言われるのでその通りにしてみる。
# yum install kernel-devel-2.6.32-642.11.1.el6.x86_64
補足
# rpm -qa | grep kernel-devel
kernel-devel-2.6.32-642.11.1.el6.x86_64
再度以下コマンドを叩く
# /etc/init.d/vboxadd setup
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. The module is not built but the others are.)
Doing non-kernel setup of the Guest Additions [ OK ]
Starting the VirtualBox Guest Additions [ OK ]
……あれ?OpenGLでなんかエラーが出ている……。
無視しても大丈夫そう?だけど一応解決しておく。
# export MAKE='/usr/bin/gmake -i'
# /etc/init.d/vboxadd setup
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 ]
ゲストOSからログアウトして再度
$ vagrant reload
で無事起動。