LoginSignup
0

More than 5 years have passed since last update.

CentOS 6系のVagrantが初回起動でエラーを吐く場合

Last updated at Posted at 2018-09-28

はじめに

bentoから落としたばかりのCentOS 6系の仮想マシンが、初回起動から失敗するため、ひとまず動かすための手順を記載します。
(´-`).。oO(もっといい方法があれば教えてください……)

再現環境

環境 バージョン
イメージ bento/centos-6.7(2.2.7)
bento/centos-6.8(2.3.4)
Vagrant 2.1
VirtualBox 5.2.12

ホストマシンは、MBP Pro (Late 13), macOS Sierra/ High Sierraで確認しています。

初回起動から失敗する

bentoにあるCentOS6系の仮想マシンが、初回起動で失敗します。

[xxx] GuestAdditions versions on your host (5.2.12) and guest (5.1.18) do not match.

...

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 uid=500,gid=500 vagrant /vagrant

The error output from the command was:

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

はじめから入っているvirtualboxのGuestAdditionのバージョンが合わないのが、根本原因っぽいです。
いろいろ調べてみましたが、GuestAdditionを合わせるためにビルドが必要のようです。

仮想マシンはエラーは出ても一応起動しています。vagrant ssh後、以下のコマンドを実行してビルド準備を整えます。

update.sh
sudo yum -y install update kernel
sudo yum -y install kernel-devel kernel-headers gcc gcc-c++

このあと、仮想マシンを再起動させると、中断していたセットアップが再開し、問題解決です。

参考

https://qiita.com/shifumin/items/a3f72225bcb947fcab21
https://qiita.com/YusakuS16/items/94c430a7ef735ed08a16
https://qiita.com/a-suenami/items/3b04151ce6e7d5b72a3e

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
0