vagrant centosでのエラー対応として、自分の備忘録になります。
エラー内容
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-573.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 ]
Restarting VM to apply changes...
==> default: Attempting graceful shutdown of VM...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2222
default: SSH username: vagrant
default: SSH auth method: private key
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
default: No guest additions were detected on the base box for this VM! Guest
default: additions are required for forwarded ports, shared folders, host only
default: networking, and more. If SSH fails on this machine, please install
default: the guest additions and repackage the box to continue.
default:
default: This is not an error message; everything may continue to work properly,
default: in which case you may ignore this message.
==> default: Configuring and enabling network interfaces...
==> default: Mounting shared folders...
default: /vagrant => /Users/isuzuki/dev/vagrant-ansible-back
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 attempted was:
mount -t vboxsf -o dmode=777,fmode=666,uid=500,gid=500 vagrant /vagrant
The error output from the command was:
/sbin/mount.vboxsf: mounting failed with the error: No such device
対処法
The missing package can be probably installed with
yum install kernel-devel-2.6.32-573.el6.x86_64
- エラー内容のkernel-develを手動インストール後に、vagrantを再起動する
- 対処法コマンドは以下
$ vagrant ssh
vagrant内で
$ sudo yum install http://vault.centos.org/6.7/updates/x86_64/Packages/kernel-2.6.32-573.26.1.el6.x86_64.rpm
$ sudo yum install http://vault.centos.org/6.7/updates/x86_64/Packages/kernel-devel-2.6.32-573.26.1.el6.x86_64.rpm
- これで正常にvagrantが起動するようになりました