2013年6月29日土曜日

VirtualBox 4.2.14 with Vagrant 1.2.2

VirtualBox, Vagrantをセットアップしましたが、vagrant upで失敗してしまいました。
使用したRPMは、2013/6/29現在の最新版です。
  • VirtualBox-4.2-4.2.14_86644_el6-1.x86_64.rpm
  • vagrant_1.2.2_x86_64.rpm
vagrant up実行時のメッセージは、次になります。
$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
[default] Importing base box 'precise32'...
There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.

Command: ["import", "/home/hide/.vagrant.d/boxes/precise32/virtualbox/box.ovf"]

Stderr: 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Interpreting /home/hide/.vagrant.d/boxes/precise32/virtualbox/box.ovf...
OK.
0%...
Progress object failure: NS_ERROR_CALL_FAILED
$
原因を調べてみると、VirtualBoxのTicket #11895に該当するようで、すでにリポジトリ上では修正されているようです。
しかし、対応版のRPMはまだリリースされていないようですので、チケットにあるワークアラウンドを試してみることにしました。

コメントによると、manifest fileを作成すればいいようで、Webページが紹介されています。
という事で、precise32 BOXのマニフェストファイルを作成してみます。
$ cd ~/.vagrant.d/boxes/precise32/virtualbox
$ openssl sha1 *.vmdk *.ovf > box.mf
$ ls
Vagrantfile  box-disk1.vmdk  box.mf  box.ovf  metadata.json
$
で、先ほど試していたプロジェクトディレクトリに移動して、vagrant upを再度実行してみます。
$ cd -
$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
[default] Importing base box 'precise32'...
[default] Matching MAC address for NAT networking...
[default] Setting the name of the VM...
[default] Clearing any previously set forwarded ports...
[default] Creating shared folders metadata...
[default] Clearing any previously set network interfaces...
[default] Preparing network interfaces based on configuration...
[default] Forwarding ports...
[default] -- 22 => 2222 (adapter 1)
[default] Booting VM...
[default] Waiting for VM to boot. This can take a few minutes.
[default] VM booted and ready for use!
[default] Configuring and enabling network interfaces...
[default] Mounting shared folders...
[default] -- /vagrant
$
うまく行きました!
早速、ログインしてみます。
$ vagrant ssh
Welcome to Ubuntu 12.04 LTS (GNU/Linux 3.2.0-23-generic-pae i686)

 * Documentation:  https://help.ubuntu.com/
Welcome to your Vagrant-built virtual machine.
Last login: Fri Sep 14 06:22:31 2012 from 10.0.2.2
vagrant@precise32:~$
vagrant@precise32:~$ uname -a
Linux precise32 3.2.0-23-generic-pae #36-Ubuntu SMP Tue Apr 10 22:19:09 UTC 2012 i686 i686 i386 GNU/Linux
vagrant@precise32:~$
vagrant@precise32:~$ df -h
Filesystem                  Size  Used Avail Use% Mounted on
/dev/mapper/precise32-root   79G  2.0G   73G   3% /
udev                        178M  4.0K  178M   1% /dev
tmpfs                        74M  272K   74M   1% /run
none                        5.0M     0  5.0M   0% /run/lock
none                        185M     0  185M   0% /run/shm
/dev/sda1                   228M   24M  192M  12% /boot
/vagrant                    138G   12G  127G   9% /vagrant
vagrant@precise32:~$
おお!なかなか面白い仕組みです。

0 件のコメント:

コメントを投稿