Packerを使ってVagrant用の仮想マシンを作成する

2013年10月20日 19時11分

201310201911VPAW00.png

はじめに

本ブログでは、VirtualBoxやVagrantを使った仮想マシンの作成方法について多く取り上げていますが、仮想マシンの作成方法については、これまで、VMware PlayerとVirtualBoxのみ解説しただけです。 そこで今回は、Packerを使用した仮想マシンの作成方法と、作成した仮想マシンをVagrant用仮想マシンに変換する方法について解説します。

Packerとは

Packerは、Vagrantの開発者でもあるMitchell Hashimotoさんが開発する仮想マシン作成の自動化ツールです。
Packerを使用すると、仮想マシンの作成からVagrant用仮想マシンの作成までを自動化すすることができます。

前提条件

作業の前提条件は、下記のとおりです。

ソフトウエアバージョン
OSWindows 7 Ultimate 32bit
CygwinSetup Version 2.831
VirtualBox4.2.18 r88780
Vagrant1.2.7
Packer0.3.9

仮想マシンの作成

Packerをインストール後、仮想マシンを作成します。

  1. Packerのインストール

    公式サイトから、0.3.9_windows_386.zipをダウンロードします。ダウンロードしたZIPファイルを任意のフォルダ下に解凍し、解凍したフォルダにPATHを通します。

    $ mkdir -p ~/sbin && cd ~/sbin
    $ wget -q https://dl.bintray.com/mitchellh/packer/0.3.9_windows_386.zip
    $ unzip -q 0.3.9_windows_386.zip
    $ rm -f 0.3.9_windows_386.zip
    
    201310201911VPAW01.png
    $ vi ~/.bashrc
    
    export PATH=/cygdrive/c/Windows/system32                       # for Windows
    export PATH=~/bin:/bin:/usr/bin:/usr/sbin:/usr/local/bin:$PATH # for Cygwin
    export PATH=~/sbin:$PATH                                       # for Packer
    export PATH=/cygdrive/c/HashiCorp/Vagrant/bin:$PATH            # for Vagrant
    export PATH=/cygdrive/c/Program\ Files/Oracle/VirtualBox:$PATH # for VirtualBox
    
    $ source ~/.bashrc
    $ packer -v
    
    201310201911VPAW02.png
  2. 設定ファイルの作成

    Packerのインストールが終了しましたので、Packerで作成する仮想マシンの設定ファイルを作成します。
    今回は、ubuntu-12.10-server-i386の仮想マシンを作成します。

    $ mkdir -p ~/mybox/packer/ubuntu-12.10-server-i386 && cd ~/mybox/packer/ubuntu-12.10-server-i386
    $ vi ubuntu-12.10-server-i386.json
    
    {
      "builders": [{
        "type": "virtualbox",
        "guest_os_type": "Ubuntu",
        "vm_name": "ubuntu-12.10-server-i386",
        "vboxmanage": [
        ["modifyvm", "{{.Name}}", "--memory", "512"],
        ["modifyvm", "{{.Name}}", "--cpus", "2"],
        ["modifyvm", "{{.Name}}", "--ioapic", "on"]
      ],
      "iso_checksum_type": "md5",
      "iso_checksum": "b3d4d4edfc8f291af0b83f8a2ba19a2f",
      "iso_url": "http://ftp.iij.ad.jp/pub/linux/ubuntu/releases/quantal/ubuntu-12.10-server-i386.iso",
      "ssh_username": "vagrant",
      "ssh_password": "vagrant",
      "ssh_wait_timeout": "100000s",
      "http_directory": "./",
      "boot_command": [
        "<esc><wait>",
        "<esc><wait>",
        "<enter><wait>",
        "/install/vmlinuz noapic ","<wait>",
        "preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg ","<wait>",
        "debian-installer=en_US auto ","<wait>",
        "locale=en_US ","<wait>",
        "kbd-chooser/method=us ","<wait>",
        "hostname={{ .Name }} ","<wait>",
        "fb=false ","<wait>",
        "debconf/frontend=noninteractive ","<wait>",
        "keyboard-configuration/modelcode=SKIP ","<wait>",
        "keyboard-configuration/layout=USA ","<wait>",
        "keyboard-configuration/variant=USA ","<wait>",
        "console-setup/ask_detect=false ","<wait>",
        "initrd=/install/initrd.gz -- <enter>"
        ],
        "virtualbox_version_file": ".vbox_version",
        "guest_additions_path": "VBoxGuestAdditions_{{.Version}}.iso",
        "shutdown_command": "sudo shutdown -h now"
      }],
      "provisioners": [{
        "type": "shell",
        "scripts": [
          "base.sh",
          "vagrant.sh",
          "vbguest.sh"
        ],
        "override": {
          "virtualbox": {
            "execute_command": "echo 'vagrant'|sudo -S sh '{{.Path}}'"
          }
        }
      }],
      "post-processors": [{
        "type": "vagrant",
        "output": "/export/vagrant/ubuntu-12.10-server-i386.box"
      }]
    }
    
    d-i debian-installer/locale string en_US.UTF-8
    d-i console-keymaps-at/keymap select us
    d-i netcfg/choose_interface select auto
    d-i netcfg/get_domain string vagrantup.com
    d-i netcfg/wireless_wep string
    d-i mirror/country string manual
    d-i mirror/http/hostname string jp.archive.ubuntu.com
    d-i mirror/http/directory string /ubuntu
    d-i mirror/http/proxy string
    d-i clock-setup/utc boolean false
    d-i time/zone string Japan
    d-i clock-setup/ntp boolean true
    d-i partman-auto/method string lvm
    d-i partman-lvm/device_remove_lvm boolean true
    d-i partman-md/device_remove_md boolean true
    d-i partman-lvm/confirm boolean true
    d-i partman-lvm/confirm_nooverwrite boolean true
    d-i partman/choose_partition select finish
    d-i partman-auto-lvm/guided_size string max
    d-i partman-auto/choose_recipe select atomic
    d-i partman/default_filesystem string ext3
    d-i partman/confirm_write_new_label boolean true
    d-i partman/confirm boolean true
    d-i partman/confirm_nooverwrite boolean true
    d-i passwd/root-login boolean false
    d-i passwd/root-password password vagrant
    d-i passwd/root-password-again password vagrant
    d-i passwd/user-fullname string Vagrant User
    d-i passwd/username string vagrant
    d-i passwd/user-password password vagrant
    d-i passwd/user-password-again password vagrant
    d-i user-setup/encrypt-home boolean false
    d-i user-setup/allow-password-weak boolean true
    d-i passwd/user-default-groups string audio cdrom video admin
    tasksel tasksel/first multiselect
    d-i pkgsel/include string openssh-server ntp acpid sudo bzip2 rsync curl
    d-i pkgsel/install-language-support boolean false
    d-i pkgsel/update-policy select none
    d-i pkgsel/upgrade select none
    popularity-contest popularity-contest/participate boolean false
    d-i grub-installer/only_debian boolean true
    d-i grub-installer/with_other_os boolean true
    d-i finish-install/reboot_in_progress note
    d-i preseed/early_command string sed -i '/in-target/idiscover(){/sbin/discover|grep -v VirtualBox;}' /usr/lib/pre-pkgsel.d/20install-hwpackages
    
    CONF=/etc/sudoers.d/vagrant
    if [ ! -f $CONF ]; then
      echo 'vagrant ALL=NOPASSWD:ALL' > $CONF
      chmod 0440 $CONF
      chown root:root $CONF
    fi
    
    DEST=/home/vagrant/.ssh
    AUTH=$DEST/authorized_keys
    
    if [ ! -f $AUTH ]; then
      mkdir -pm 0700 $DEST
      curl -ksLo $AUTH https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub
      chmod 0600 $AUTH
      chown -R vagrant:vagrant $DEST
    fi
    
    apt-get -y update
    apt-get -y install linux-headers-$(uname -r) build-essential
    apt-get -y install zlib1g-dev libssl-dev libreadline-gplv2-dev
    apt-get -y install curl unzip
    apt-get install -y dkms
    
    VBOX_VERSION=$(cat /home/vagrant/.vbox_version)
    cd /tmp
    mount -o loop /home/vagrant/VBoxGuestAdditions_$VBOX_VERSION.iso /mnt
    sh /mnt/VBoxLinuxAdditions.run
    umount /mnt
    rm -rf /home/vagrant/VBoxGuestAdditions_*.iso
    
  3. 仮想マシンのビルド

    設定ファイルの構文チェックが成功したら、仮想マシンをビルドします。

    $ packer validate ubuntu-12.10-server-i386.json
    
    201310201911VPAW03.png
    $ packer build ubuntu-12.10-server-i386.json
    
    201310201911VPAW04.png

    ビルドを開始すると、しばらくしてVirtualBoxコンソールが起動し、OSの自動インストールが行われ、ンストールが終了すると、仮想マシンが再起動します。

    201310201911VPAW05.png
    201310201911VPAW06.png
    201310201911VPAW07.png
    201310201911VPAW08.png
    201310201911VPAW09.png
    201310201911VPAW10.png

    仮想マシンが再起動すると、PackerからSSHで接続し、プロビジョニングを行います。

    201310201911VPAW11.png
    201310201911VPAW12.png
    $ packer build ubuntu-12.10-server-i386.json
    virtualbox output will be in this color.
    
    ==> virtualbox: Downloading or copying Guest additions checksums
        virtualbox: Downloading or copying: http://download.virtualbox.org/virtualbox/4.2.18/SHA256SUMS
    ==> virtualbox: Downloading or copying Guest additions
        virtualbox: Downloading or copying: http://download.virtualbox.org/virtualbox/4.2.18/VBoxGuestAdditions_4.2.18.iso
        virtualbox: Download progress: 72%
    ==> virtualbox: Downloading or copying ISO
        virtualbox: Downloading or copying: http://ftp.iij.ad.jp/pub/linux/ubuntu/releases/quantal/ubuntu-12.10-server-i386.iso
        virtualbox: Download progress: 6%
        virtualbox: Download progress: 13%
        virtualbox: Download progress: 19%
        virtualbox: Download progress: 26%
        virtualbox: Download progress: 33%
        virtualbox: Download progress: 40%
        virtualbox: Download progress: 46%
        virtualbox: Download progress: 53%
        virtualbox: Download progress: 60%
        virtualbox: Download progress: 67%
        virtualbox: Download progress: 73%
        virtualbox: Download progress: 80%
        virtualbox: Download progress: 87%
        virtualbox: Download progress: 94%
        virtualbox: Download progress: 100%
    ==> virtualbox: Starting HTTP server on port 8847
    ==> virtualbox: Creating virtual machine...
    ==> virtualbox: Creating hard drive...
    ==> virtualbox: Creating forwarded port mapping for SSH (host port 2511)
    ==> virtualbox: Executing custom VBoxManage commands...
        virtualbox: Executing: modifyvm ubuntu-12.10-server-i386 --memory 512
        virtualbox: Executing: modifyvm ubuntu-12.10-server-i386 --cpus 2
        virtualbox: Executing: modifyvm ubuntu-12.10-server-i386 --ioapic on
    ==> virtualbox: Starting the virtual machine...
    ==> virtualbox: Waiting 10s for boot...
    ==> virtualbox: Typing the boot command...
    ==> virtualbox: Waiting for SSH to become available...
    ==> virtualbox: Connected to SSH!
    ==> virtualbox: Uploading VirtualBox version info (4.2.18)
    ==> virtualbox: Uploading VirtualBox guest additions ISO...
    ==> virtualbox: Provisioning with shell script: base.sh
        virtualbox: [sudo] password for vagrant:
    ==> virtualbox: Provisioning with shell script: vagrant.sh
    ==> virtualbox: Provisioning with shell script: vbguest.sh
        virtualbox: Ign http://jp.archive.ubuntu.com quantal InRelease
        virtualbox: Ign http://jp.archive.ubuntu.com quantal-updates InRelease
        virtualbox: Ign http://jp.archive.ubuntu.com quantal-backports InRelease
        virtualbox: Hit http://jp.archive.ubuntu.com quantal Release.gpg
        virtualbox: Hit http://jp.archive.ubuntu.com quantal-updates Release.gpg
        virtualbox: Hit http://jp.archive.ubuntu.com quantal-backports Release.gpg
        virtualbox: Hit http://jp.archive.ubuntu.com quantal Release
        virtualbox: Hit http://jp.archive.ubuntu.com quantal-updates Release
        virtualbox: Hit http://jp.archive.ubuntu.com quantal-backports Release
        virtualbox: Hit http://jp.archive.ubuntu.com quantal/main Sources
        virtualbox: Ign http://security.ubuntu.com quantal-security InRelease
        virtualbox: Hit http://jp.archive.ubuntu.com quantal/restricted Sources
        virtualbox: Hit http://jp.archive.ubuntu.com quantal/universe Sources
        virtualbox: Hit http://jp.archive.ubuntu.com quantal/multiverse Sources
        virtualbox: Hit http://jp.archive.ubuntu.com quantal/main i386 Packages
        virtualbox: Hit http://jp.archive.ubuntu.com quantal/restricted i386 Packages
        virtualbox: Hit http://jp.archive.ubuntu.com quantal/universe i386 Packages
        virtualbox: Hit http://security.ubuntu.com quantal-security Release.gpg
        virtualbox: Hit http://jp.archive.ubuntu.com quantal/multiverse i386 Packages
        virtualbox: Hit http://jp.archive.ubuntu.com quantal/main Translation-en
        virtualbox: Hit http://jp.archive.ubuntu.com quantal/multiverse Translation-en
        virtualbox: Hit http://security.ubuntu.com quantal-security Release
        virtualbox: Hit http://jp.archive.ubuntu.com quantal/restricted Translation-en
        virtualbox: Hit http://jp.archive.ubuntu.com quantal/universe Translation-en
        virtualbox: Hit http://jp.archive.ubuntu.com quantal-updates/main Sources
        virtualbox: Hit http://jp.archive.ubuntu.com quantal-updates/restricted Sources
        virtualbox: Hit http://jp.archive.ubuntu.com quantal-updates/universe Sources
        virtualbox: Hit http://jp.archive.ubuntu.com quantal-updates/multiverse Sources
        virtualbox: Hit http://security.ubuntu.com quantal-security/main Sources
        virtualbox: Hit http://jp.archive.ubuntu.com quantal-updates/main i386 Packages
        virtualbox: Hit http://jp.archive.ubuntu.com quantal-updates/restricted i386 Packages
        virtualbox: Hit http://jp.archive.ubuntu.com quantal-updates/universe i386 Packages
        virtualbox: Hit http://jp.archive.ubuntu.com quantal-updates/multiverse i386 Packages
        virtualbox: Hit http://jp.archive.ubuntu.com quantal-updates/main Translation-en
        virtualbox: Hit http://security.ubuntu.com quantal-security/restricted Sources
        virtualbox: Hit http://jp.archive.ubuntu.com quantal-updates/multiverse Translation-en
        virtualbox: Hit http://jp.archive.ubuntu.com quantal-updates/restricted Translation-en
        virtualbox: Hit http://jp.archive.ubuntu.com quantal-updates/universe Translation-en
        virtualbox: Hit http://security.ubuntu.com quantal-security/universe Sources
        virtualbox: Hit http://jp.archive.ubuntu.com quantal-backports/main Sources
        virtualbox: Hit http://jp.archive.ubuntu.com quantal-backports/restricted Sources
        virtualbox: Hit http://jp.archive.ubuntu.com quantal-backports/universe Sources
        virtualbox: Hit http://jp.archive.ubuntu.com quantal-backports/multiverse Sources
        virtualbox: Hit http://jp.archive.ubuntu.com quantal-backports/main i386 Packages
        virtualbox: Hit http://jp.archive.ubuntu.com quantal-backports/restricted i386 Packages
        virtualbox: Hit http://security.ubuntu.com quantal-security/multiverse Sources
        virtualbox: Hit http://jp.archive.ubuntu.com quantal-backports/universe i386 Packages
        virtualbox: Hit http://jp.archive.ubuntu.com quantal-backports/multiverse i386 Packages
        virtualbox: Hit http://jp.archive.ubuntu.com quantal-backports/main Translation-en
        virtualbox: Hit http://jp.archive.ubuntu.com quantal-backports/multiverse Translation-en
        virtualbox: Hit http://security.ubuntu.com quantal-security/main i386 Packages
        virtualbox: Hit http://jp.archive.ubuntu.com quantal-backports/restricted Translation-en
        virtualbox: Hit http://jp.archive.ubuntu.com quantal-backports/universe Translation-en
        virtualbox: Hit http://security.ubuntu.com quantal-security/restricted i386 Packages
        virtualbox: Hit http://security.ubuntu.com quantal-security/universe i386 Packages
        virtualbox: Hit http://security.ubuntu.com quantal-security/multiverse i386 Packages
        virtualbox: Hit http://security.ubuntu.com quantal-security/main Translation-en
        virtualbox: Ign http://jp.archive.ubuntu.com quantal/main Translation-en_US
        virtualbox: Hit http://security.ubuntu.com quantal-security/multiverse Translation-en
        virtualbox: Ign http://jp.archive.ubuntu.com quantal/multiverse Translation-en_US
        virtualbox: Ign http://jp.archive.ubuntu.com quantal/restricted Translation-en_US
        virtualbox: Ign http://jp.archive.ubuntu.com quantal/universe Translation-en_US
        virtualbox: Ign http://jp.archive.ubuntu.com quantal-updates/main Translation-en_US
        virtualbox: Ign http://jp.archive.ubuntu.com quantal-updates/multiverse Translation-en_US
        virtualbox: Ign http://jp.archive.ubuntu.com quantal-updates/restricted Translation-en_US
        virtualbox: Ign http://jp.archive.ubuntu.com quantal-updates/universe Translation-en_US
        virtualbox: Ign http://jp.archive.ubuntu.com quantal-backports/main Translation-en_US
        virtualbox: Ign http://jp.archive.ubuntu.com quantal-backports/multiverse Translation-en_US
        virtualbox: Ign http://jp.archive.ubuntu.com quantal-backports/restricted Translation-en_US
        virtualbox: Ign http://jp.archive.ubuntu.com quantal-backports/universe Translation-en_US
        virtualbox: Hit http://security.ubuntu.com quantal-security/restricted Translation-en
        virtualbox: Hit http://security.ubuntu.com quantal-security/universe Translation-en
        virtualbox: Ign http://security.ubuntu.com quantal-security/main Translation-en_US
        virtualbox: Ign http://security.ubuntu.com quantal-security/multiverse Translation-en_US
        virtualbox: Ign http://security.ubuntu.com quantal-security/restricted Translation-en_US
        virtualbox: Ign http://security.ubuntu.com quantal-security/universe Translation-en_US
        virtualbox: Reading package lists... Done
        virtualbox: Reading package lists... Done
        virtualbox: Building dependency tree
        virtualbox: Reading state information... Done
        virtualbox: linux-headers-3.5.0-17-generic is already the newest version.
        virtualbox: linux-headers-3.5.0-17-generic set to manually installed.
        virtualbox: The following extra packages will be installed:
        virtualbox: binutils cpp cpp-4.7 dpkg-dev
        virtualbox: fakeroot g++ g++-4.7 gcc gcc-4.7
        virtualbox: libalgorithm-diff-perl
        virtualbox: libalgorithm-diff-xs-perl
        virtualbox: libalgorithm-merge-perl libc-bin
        virtualbox: libc-dev-bin libc6 libc6-dev
        virtualbox: libdpkg-perl libfile-fcntllock-perl
        virtualbox: libgmp10 libgomp1 libitm1 libmpc2
        virtualbox: libmpfr4 libquadmath0
        virtualbox: libstdc++6-4.7-dev linux-libc-dev
        virtualbox: make manpages-dev patch
        virtualbox: Suggested packages:
        virtualbox: binutils-doc cpp-doc gcc-4.7-locales
        virtualbox: debian-keyring g++-multilib
        virtualbox: g++-4.7-multilib gcc-4.7-doc
        virtualbox: libstdc++6-4.7-dbg gcc-multilib
        virtualbox: autoconf automake1.9 libtool flex
        virtualbox: bison gdb gcc-doc gcc-4.7-multilib
        virtualbox: libmudflap0-4.7-dev libgcc1-dbg
        virtualbox: libgomp1-dbg libitm1-dbg
        virtualbox: libquadmath0-dbg libmudflap0-dbg
        virtualbox: binutils-gold glibc-doc
        virtualbox: libstdc++6-4.7-doc make-doc
        virtualbox: diffutils-doc
        virtualbox: The following NEW packages will be installed:
        virtualbox: binutils build-essential cpp cpp-4.7
        virtualbox: dpkg-dev fakeroot g++ g++-4.7 gcc
        virtualbox: gcc-4.7 libalgorithm-diff-perl
        virtualbox: libalgorithm-diff-xs-perl
        virtualbox: libalgorithm-merge-perl libc-dev-bin
        virtualbox: libc6-dev libdpkg-perl
        virtualbox: libfile-fcntllock-perl libgmp10
        virtualbox: libgomp1 libitm1 libmpc2 libmpfr4
        virtualbox: libquadmath0 libstdc++6-4.7-dev
        virtualbox: linux-libc-dev make manpages-dev
        virtualbox: patch
        virtualbox: The following packages will be upgraded:
        virtualbox: libc-bin libc6
        virtualbox: 2 upgraded, 28 newly installed, 0 to remove and 107 not upgraded.
        virtualbox: Need to get 40.5 MB of archives.
        virtualbox: After this operation, 96.4 MB of additional disk space will be used.
        virtualbox: Get:1 http://jp.archive.ubuntu.com/ubuntu/ quantal-updates/main libc-bin i386 2.15-0ubuntu20.2 [1,133 kB]
        virtualbox: Get:2 http://jp.archive.ubuntu.com/ubuntu/ quantal-updates/main libc6 i386 2.15-0ubuntu20.2 [3,941 kB]
        virtualbox: Get:3 http://jp.archive.ubuntu.com/ubuntu/ quantal/main libgmp10 i386 2:5.0.2+dfsg-2ubuntu2 [262 kB]
        virtualbox: Get:4 http://jp.archive.ubuntu.com/ubuntu/ quantal/main libgomp1 i386 4.7.2-2ubuntu1 [29.7 kB]
        virtualbox: Get:5 http://jp.archive.ubuntu.com/ubuntu/ quantal/main libitm1 i386 4.7.2-2ubuntu1 [35.5 kB]
        virtualbox: Get:6 http://jp.archive.ubuntu.com/ubuntu/ quantal/main libmpfr4 i386 3.1.0-3ubuntu3 [200 kB]
        virtualbox: Get:7 http://jp.archive.ubuntu.com/ubuntu/ quantal/main libquadmath0 i386 4.7.2-2ubuntu1 [198 kB]
        virtualbox: Get:8 http://jp.archive.ubuntu.com/ubuntu/ quantal/main libmpc2 i386 0.9-4build1 [40.7 kB]
        virtualbox: Get:9 http://jp.archive.ubuntu.com/ubuntu/ quantal/main binutils i386 2.22.90.20120924-0ubuntu2 [2,437 kB]
        virtualbox: Get:10 http://jp.archive.ubuntu.com/ubuntu/ quantal-updates/main libc-dev-bin i386 2.15-0ubuntu20.2 [76.8 kB]
        virtualbox: Get:11 http://jp.archive.ubuntu.com/ubuntu/ quantal-updates/main linux-libc-dev i386 3.5.0-49.73 [901 kB]
        virtualbox: Get:12 http://jp.archive.ubuntu.com/ubuntu/ quantal-updates/main libc6-dev i386 2.15-0ubuntu20.2 [5,108 kB]
        virtualbox: Get:13 http://jp.archive.ubuntu.com/ubuntu/ quantal/main cpp-4.7 i386 4.7.2-2ubuntu1 [5,207 kB]
        virtualbox: Get:14 http://jp.archive.ubuntu.com/ubuntu/ quantal/main cpp i386 4:4.7.2-1ubuntu2 [27.8 kB]
        virtualbox: Get:15 http://jp.archive.ubuntu.com/ubuntu/ quantal/main gcc-4.7 i386 4.7.2-2ubuntu1 [8,506 kB]
        virtualbox: Get:16 http://jp.archive.ubuntu.com/ubuntu/ quantal/main gcc i386 4:4.7.2-1ubuntu2 [5,134 B]
        virtualbox: Get:17 http://jp.archive.ubuntu.com/ubuntu/ quantal/main libstdc++6-4.7-dev i386 4.7.2-2ubuntu1 [1,726 kB]
        virtualbox: Get:18 http://jp.archive.ubuntu.com/ubuntu/ quantal/main g++-4.7 i386 4.7.2-2ubuntu1 [7,756 kB]
        virtualbox: Get:19 http://jp.archive.ubuntu.com/ubuntu/ quantal/main g++ i386 4:4.7.2-1ubuntu2 [1,440 B]
        virtualbox: Get:20 http://jp.archive.ubuntu.com/ubuntu/ quantal/main make i386 3.81-8.2ubuntu2 [116 kB]
        virtualbox: Get:21 http://jp.archive.ubuntu.com/ubuntu/ quantal-updates/main libdpkg-perl all 1.16.7ubuntu6.1 [189 kB]
        virtualbox: Get:22 http://jp.archive.ubuntu.com/ubuntu/ quantal/main patch i386 2.6.1-3ubuntu1 [85.1 kB]
        virtualbox: Get:23 http://jp.archive.ubuntu.com/ubuntu/ quantal-updates/main dpkg-dev all 1.16.7ubuntu6.1 [595 kB]
        virtualbox: Get:24 http://jp.archive.ubuntu.com/ubuntu/ quantal/main build-essential i386 11.5ubuntu3 [5,804 B]
        virtualbox: Get:25 http://jp.archive.ubuntu.com/ubuntu/ quantal/main fakeroot i386 1.18.4-2 [88.0 kB]
        virtualbox: Get:26 http://jp.archive.ubuntu.com/ubuntu/ quantal/main libalgorithm-diff-perl all 1.19.02-2 [50.7 kB]
        virtualbox: Get:27 http://jp.archive.ubuntu.com/ubuntu/ quantal/main libalgorithm-diff-xs-perl i386 0.04-2build3 [13.1 kB]
        virtualbox: Get:28 http://jp.archive.ubuntu.com/ubuntu/ quantal/main libalgorithm-merge-perl all 0.08-2 [12.7 kB]
        virtualbox: Get:29 http://jp.archive.ubuntu.com/ubuntu/ quantal/main libfile-fcntllock-perl i386 0.14-2 [15.8 kB]
        virtualbox: Get:30 http://jp.archive.ubuntu.com/ubuntu/ quantal/main manpages-dev all 3.40-0.1ubuntu3 [1,710 kB]
        virtualbox: Fetched 40.5 MB in 19s (2,050 kB/s)
        virtualbox: Preconfiguring packages ...
        virtualbox: (Reading database ... 51372 files and directories currently installed.)
        virtualbox: Preparing to replace libc-bin 2.15-0ubuntu20 (using .../libc-bin_2.15-0ubuntu20.2_i386.deb) ...
        virtualbox: Unpacking replacement libc-bin ...
        virtualbox: Processing triggers for man-db ...
        virtualbox: Setting up libc-bin (2.15-0ubuntu20.2) ...
        virtualbox: (Reading database ... 51372 files and directories currently installed.)
        virtualbox: Preparing to replace libc6:i386 2.15-0ubuntu20 (using .../libc6_2.15-0ubuntu20.2_i386.deb) ...
        virtualbox: Unpacking replacement libc6:i386 ...
        virtualbox: Setting up libc6:i386 (2.15-0ubuntu20.2) ...
        virtualbox: Processing triggers for libc-bin ...
        virtualbox: ldconfig deferred processing now taking place
        virtualbox: Selecting previously unselected package libgmp10:i386.
        virtualbox: (Reading database ... 51372 files and directories currently installed.)
        virtualbox: Unpacking libgmp10:i386 (from .../libgmp10_2%3a5.0.2+dfsg-2ubuntu2_i386.deb) ...
        virtualbox: Selecting previously unselected package libgomp1:i386.
        virtualbox: Unpacking libgomp1:i386 (from .../libgomp1_4.7.2-2ubuntu1_i386.deb) ...
        virtualbox: Selecting previously unselected package libitm1:i386.
        virtualbox: Unpacking libitm1:i386 (from .../libitm1_4.7.2-2ubuntu1_i386.deb) ...
        virtualbox: Selecting previously unselected package libmpfr4:i386.
        virtualbox: Unpacking libmpfr4:i386 (from .../libmpfr4_3.1.0-3ubuntu3_i386.deb) ...
        virtualbox: Selecting previously unselected package libquadmath0:i386.
        virtualbox: Unpacking libquadmath0:i386 (from .../libquadmath0_4.7.2-2ubuntu1_i386.deb) ...
        virtualbox: Selecting previously unselected package libmpc2:i386.
        virtualbox: Unpacking libmpc2:i386 (from .../libmpc2_0.9-4build1_i386.deb) ...
        virtualbox: Selecting previously unselected package binutils.
        virtualbox: Unpacking binutils (from .../binutils_2.22.90.20120924-0ubuntu2_i386.deb) ...
        virtualbox: Selecting previously unselected package libc-dev-bin.
        virtualbox: Unpacking libc-dev-bin (from .../libc-dev-bin_2.15-0ubuntu20.2_i386.deb) ...
        virtualbox: Selecting previously unselected package linux-libc-dev:i386.
        virtualbox: Unpacking linux-libc-dev:i386 (from .../linux-libc-dev_3.5.0-49.73_i386.deb) ...
        virtualbox: Selecting previously unselected package libc6-dev:i386.
        virtualbox: Unpacking libc6-dev:i386 (from .../libc6-dev_2.15-0ubuntu20.2_i386.deb) ...
        virtualbox: Selecting previously unselected package cpp-4.7.
        virtualbox: Unpacking cpp-4.7 (from .../cpp-4.7_4.7.2-2ubuntu1_i386.deb) ...
        virtualbox: Selecting previously unselected package cpp.
        virtualbox: Unpacking cpp (from .../cpp_4%3a4.7.2-1ubuntu2_i386.deb) ...
        virtualbox: Selecting previously unselected package gcc-4.7.
        virtualbox: Unpacking gcc-4.7 (from .../gcc-4.7_4.7.2-2ubuntu1_i386.deb) ...
        virtualbox: Selecting previously unselected package gcc.
        virtualbox: Unpacking gcc (from .../gcc_4%3a4.7.2-1ubuntu2_i386.deb) ...
        virtualbox: Selecting previously unselected package libstdc++6-4.7-dev.
        virtualbox: Unpacking libstdc++6-4.7-dev (from .../libstdc++6-4.7-dev_4.7.2-2ubuntu1_i386.deb) ...
        virtualbox: Selecting previously unselected package g++-4.7.
        virtualbox: Unpacking g++-4.7 (from .../g++-4.7_4.7.2-2ubuntu1_i386.deb) ...
        virtualbox: Selecting previously unselected package g++.
        virtualbox: Unpacking g++ (from .../g++_4%3a4.7.2-1ubuntu2_i386.deb) ...
        virtualbox: Selecting previously unselected package make.
        virtualbox: Unpacking make (from .../make_3.81-8.2ubuntu2_i386.deb) ...
        virtualbox: Selecting previously unselected package libdpkg-perl.
        virtualbox: Unpacking libdpkg-perl (from .../libdpkg-perl_1.16.7ubuntu6.1_all.deb) ...
        virtualbox: Selecting previously unselected package patch.
        virtualbox: Unpacking patch (from .../patch_2.6.1-3ubuntu1_i386.deb) ...
        virtualbox: Selecting previously unselected package dpkg-dev.
        virtualbox: Unpacking dpkg-dev (from .../dpkg-dev_1.16.7ubuntu6.1_all.deb) ...
        virtualbox: Selecting previously unselected package build-essential.
        virtualbox: Unpacking build-essential (from .../build-essential_11.5ubuntu3_i386.deb) ...
        virtualbox: Selecting previously unselected package fakeroot.
        virtualbox: Unpacking fakeroot (from .../fakeroot_1.18.4-2_i386.deb) ...
        virtualbox: Selecting previously unselected package libalgorithm-diff-perl.
        virtualbox: Unpacking libalgorithm-diff-perl (from .../libalgorithm-diff-perl_1.19.02-2_all.deb) ...
        virtualbox: Selecting previously unselected package libalgorithm-diff-xs-perl.
        virtualbox: Unpacking libalgorithm-diff-xs-perl (from .../libalgorithm-diff-xs-perl_0.04-2build3_i386.deb) ...
        virtualbox: Selecting previously unselected package libalgorithm-merge-perl.
        virtualbox: Unpacking libalgorithm-merge-perl (from .../libalgorithm-merge-perl_0.08-2_all.deb) ...
        virtualbox: Selecting previously unselected package libfile-fcntllock-perl.
        virtualbox: Unpacking libfile-fcntllock-perl (from .../libfile-fcntllock-perl_0.14-2_i386.deb) ...
        virtualbox: Selecting previously unselected package manpages-dev.
        virtualbox: Unpacking manpages-dev (from .../manpages-dev_3.40-0.1ubuntu3_all.deb) ...
        virtualbox: Processing triggers for man-db ...
        virtualbox: Setting up libgmp10:i386 (2:5.0.2+dfsg-2ubuntu2) ...
        virtualbox: Setting up libgomp1:i386 (4.7.2-2ubuntu1) ...
        virtualbox: Setting up libitm1:i386 (4.7.2-2ubuntu1) ...
        virtualbox: Setting up libmpfr4:i386 (3.1.0-3ubuntu3) ...
        virtualbox: Setting up libquadmath0:i386 (4.7.2-2ubuntu1) ...
        virtualbox: Setting up libmpc2:i386 (0.9-4build1) ...
        virtualbox: Setting up binutils (2.22.90.20120924-0ubuntu2) ...
        virtualbox: Setting up libc-dev-bin (2.15-0ubuntu20.2) ...
        virtualbox: Setting up linux-libc-dev:i386 (3.5.0-49.73) ...
        virtualbox: Setting up libc6-dev:i386 (2.15-0ubuntu20.2) ...
        virtualbox: Setting up cpp-4.7 (4.7.2-2ubuntu1) ...
        virtualbox: Setting up cpp (4:4.7.2-1ubuntu2) ...
        virtualbox: Setting up gcc-4.7 (4.7.2-2ubuntu1) ...
        virtualbox: Setting up gcc (4:4.7.2-1ubuntu2) ...
        virtualbox: Setting up make (3.81-8.2ubuntu2) ...
        virtualbox: Setting up libdpkg-perl (1.16.7ubuntu6.1) ...
        virtualbox: Setting up patch (2.6.1-3ubuntu1) ...
        virtualbox: Setting up dpkg-dev (1.16.7ubuntu6.1) ...
        virtualbox: Setting up fakeroot (1.18.4-2) ...
        virtualbox: update-alternatives: using /usr/bin/fakeroot-sysv to provide /usr/bin/fakeroot (fakeroot) in auto mode
        virtualbox: Setting up libalgorithm-diff-perl (1.19.02-2) ...
        virtualbox: Setting up libalgorithm-diff-xs-perl (0.04-2build3) ...
        virtualbox: Setting up libalgorithm-merge-perl (0.08-2) ...
        virtualbox: Setting up libfile-fcntllock-perl (0.14-2) ...
        virtualbox: Setting up manpages-dev (3.40-0.1ubuntu3) ...
        virtualbox: Setting up libstdc++6-4.7-dev (4.7.2-2ubuntu1) ...
        virtualbox: Setting up g++-4.7 (4.7.2-2ubuntu1) ...
        virtualbox: Setting up g++ (4:4.7.2-1ubuntu2) ...
        virtualbox: update-alternatives: using /usr/bin/g++ to provide /usr/bin/c++ (c++) in auto mode
        virtualbox: Setting up build-essential (11.5ubuntu3) ...
        virtualbox: Processing triggers for libc-bin ...
        virtualbox: ldconfig deferred processing now taking place
        virtualbox: Reading package lists... Done
        virtualbox: Building dependency tree
        virtualbox: Reading state information... Done
        virtualbox: The following extra packages will be installed:
        virtualbox: libssl-doc libssl1.0.0 libtinfo-dev
        virtualbox: The following NEW packages will be installed:
        virtualbox: libreadline-gplv2-dev libssl-dev
        virtualbox: libssl-doc libtinfo-dev zlib1g-dev
        virtualbox: The following packages will be upgraded:
        virtualbox: libssl1.0.0
        virtualbox: 1 upgraded, 5 newly installed, 0 to remove and 106 not upgraded.
        virtualbox: Need to get 3,971 kB of archives.
        virtualbox: After this operation, 7,691 kB of additional disk space will be used.
        virtualbox: Get:1 http://jp.archive.ubuntu.com/ubuntu/ quantal-updates/main libssl1.0.0 i386 1.0.1c-3ubuntu2.7 [1,008 kB]
        virtualbox: Get:2 http://jp.archive.ubuntu.com/ubuntu/ quantal/main zlib1g-dev i386 1:1.2.7.dfsg-13 [177 kB]
        virtualbox: Get:3 http://jp.archive.ubuntu.com/ubuntu/ quantal-updates/main libssl-dev i386 1.0.1c-3ubuntu2.7 [1,420 kB]
        virtualbox: Get:4 http://jp.archive.ubuntu.com/ubuntu/ quantal-updates/main libssl-doc all 1.0.1c-3ubuntu2.7 [1,039 kB]
        virtualbox: Get:5 http://jp.archive.ubuntu.com/ubuntu/ quantal/main libtinfo-dev i386 5.9-10ubuntu1 [93.3 kB]
        virtualbox: Get:6 http://jp.archive.ubuntu.com/ubuntu/ quantal/main libreadline-gplv2-dev i386 5.2-12 [234 kB]
        virtualbox: Fetched 3,971 kB in 5s (763 kB/s)
        virtualbox: Preconfiguring packages ...
        virtualbox: (Reading database ... 55983 files and directories currently installed.)
        virtualbox: Preparing to replace libssl1.0.0:i386 1.0.1c-3ubuntu2 (using .../libssl1.0.0_1.0.1c-3ubuntu2.7_i386.deb) ...
        virtualbox: Unpacking replacement libssl1.0.0:i386 ...
        virtualbox: Selecting previously unselected package zlib1g-dev:i386.
        virtualbox: Unpacking zlib1g-dev:i386 (from .../zlib1g-dev_1%3a1.2.7.dfsg-13_i386.deb) ...
        virtualbox: Selecting previously unselected package libssl-dev.
        virtualbox: Unpacking libssl-dev (from .../libssl-dev_1.0.1c-3ubuntu2.7_i386.deb) ...
        virtualbox: Selecting previously unselected package libssl-doc.
        virtualbox: Unpacking libssl-doc (from .../libssl-doc_1.0.1c-3ubuntu2.7_all.deb) ...
        virtualbox: Selecting previously unselected package libtinfo-dev:i386.
        virtualbox: Unpacking libtinfo-dev:i386 (from .../libtinfo-dev_5.9-10ubuntu1_i386.deb) ...
        virtualbox: Selecting previously unselected package libreadline-gplv2-dev:i386.
        virtualbox: Unpacking libreadline-gplv2-dev:i386 (from .../libreadline-gplv2-dev_5.2-12_i386.deb) ...
        virtualbox: Processing triggers for man-db ...
        virtualbox: Processing triggers for install-info ...
        virtualbox: Setting up libssl1.0.0:i386 (1.0.1c-3ubuntu2.7) ...
        virtualbox: Setting up zlib1g-dev:i386 (1:1.2.7.dfsg-13) ...
        virtualbox: Setting up libssl-dev (1.0.1c-3ubuntu2.7) ...
        virtualbox: Setting up libssl-doc (1.0.1c-3ubuntu2.7) ...
        virtualbox: Setting up libtinfo-dev:i386 (5.9-10ubuntu1) ...
        virtualbox: Setting up libreadline-gplv2-dev:i386 (5.2-12) ...
        virtualbox: Processing triggers for libc-bin ...
        virtualbox: ldconfig deferred processing now taking place
        virtualbox: Reading package lists... Done
        virtualbox: Building dependency tree
        virtualbox: Reading state information... Done
        virtualbox: curl is already the newest version.
        virtualbox: Suggested packages:
        virtualbox: zip
        virtualbox: The following NEW packages will be installed:
        virtualbox: unzip
        virtualbox: 0 upgraded, 1 newly installed, 0 to remove and 106 not upgraded.
        virtualbox: Need to get 184 kB of archives.
        virtualbox: After this operation, 387 kB of additional disk space will be used.
        virtualbox: Get:1 http://jp.archive.ubuntu.com/ubuntu/ quantal-updates/main unzip i386 6.0-7ubuntu1.1 [184 kB]
        virtualbox: Fetched 184 kB in 0s (377 kB/s)
        virtualbox: Selecting previously unselected package unzip.
        virtualbox: (Reading database ... 57457 files and directories currently installed.)
        virtualbox: Unpacking unzip (from .../unzip_6.0-7ubuntu1.1_i386.deb) ...
        virtualbox: Processing triggers for man-db ...
        virtualbox: Processing triggers for mime-support ...
        virtualbox: Setting up unzip (6.0-7ubuntu1.1) ...
        virtualbox: Reading package lists... Done
        virtualbox: Building dependency tree
        virtualbox: Reading state information... Done
        virtualbox: Suggested packages:
        virtualbox: debhelper
        virtualbox: The following NEW packages will be installed:
        virtualbox: dkms
        virtualbox: 0 upgraded, 1 newly installed, 0 to remove and 106 not upgraded.
        virtualbox: Need to get 71.4 kB of archives.
        virtualbox: After this operation, 348 kB of additional disk space will be used.
        virtualbox: Get:1 http://jp.archive.ubuntu.com/ubuntu/ quantal-updates/main dkms all 2.2.0.3-1.1ubuntu1.1 [71.4 kB]
        virtualbox: Fetched 71.4 kB in 0s (161 kB/s)
        virtualbox: Selecting previously unselected package dkms.
        virtualbox: (Reading database ... 57475 files and directories currently installed.)
        virtualbox: Unpacking dkms (from .../dkms_2.2.0.3-1.1ubuntu1.1_all.deb) ...
        virtualbox: Processing triggers for man-db ...
        virtualbox: Setting up dkms (2.2.0.3-1.1ubuntu1.1) ...
        virtualbox: mount: warning: /mnt seems to be mounted read-only.
        virtualbox: Verifying archive integrity... All good.
        virtualbox: Uncompressing VirtualBox 4.2.18 Guest Additions for Linux............
        virtualbox: VirtualBox Guest Additions installer
        virtualbox: Copying additional installer modules ...
        virtualbox: Installing additional modules ...
        virtualbox: Removing existing VirtualBox DKMS kernel modules ...done.
        virtualbox: Removing existing VirtualBox non-DKMS kernel modules ...done.
        virtualbox: Building the VirtualBox Guest Additions kernel modules ...done.
        virtualbox: Doing non-kernel setup of the Guest Additions ...done.
        virtualbox: Starting the VirtualBox Guest Additions ...done.
        virtualbox: Installing the Window System drivers ...fail!
        virtualbox: (Could not find the X.Org or XFree86 Window System.)
    ==> virtualbox: Gracefully halting virtual machine...
        virtualbox:
        virtualbox: Broadcast message from vagrant@ubuntu-12
    ==> virtualbox: Preparing to export machine...
        virtualbox: Deleting forwarded port mapping for SSH (host port 2511)
    ==> virtualbox: Exporting virtual machine...
    ==> virtualbox: Unregistering and deleting virtual machine...
    ==> virtualbox: Running post-processor: vagrant
    ==> virtualbox (vagrant): Creating Vagrant box for 'virtualbox' provider
        virtualbox (vagrant): Copying: output-virtualbox\ubuntu-12.10-server-i386-disk1.vmdk
        virtualbox (vagrant): Copying: output-virtualbox\ubuntu-12.10-server-i386.ovf
        virtualbox (vagrant): Renaming the OVF to box.ovf...
        virtualbox (vagrant): Compressing box...
        virtualbox (vagrant): Compressing: Vagrantfile
        virtualbox (vagrant): Compressing: box.ovf
        virtualbox (vagrant): Compressing: metadata.json
        virtualbox (vagrant): Compressing: ubuntu-12.10-server-i386-disk1.vmdk
    Build 'virtualbox' finished.
    
    ==> Builds finished. The artifacts of successful builds are:
    --> virtualbox: 'virtualbox' provider box: /export/vagrant/ubuntu-12.10-server-i386.box