LoginSignup
59
30

More than 5 years have passed since last update.

Vagrant upでエラーが出て躓いた時の解決方法

Last updated at Posted at 2019-02-03

背景

VagrantとVirtualBoxを使って仮想環境を構築しようとしていたところ、Vagrant upで躓きました。
試行錯誤するうちに原因が分かり、解決できたのでその時の手順を残しておきます。(殴り書きですがお許し下さい)

問題

Vagrant upが実行できず、仮想マシンの立ち上げが出来ない。

エラーの内容

There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.

Command: ["startvm", "06d68c13-7910-4f8f-a263-e9424395d7cf", "--type", "headless"]

Stderr: VBoxManage: error: The virtual machine 'username_default_1549175601821_34118' has terminated unexpectedly during startup with exit code 1 (0x1)
VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component MachineWrap, interface IMachine

エラーの内容としては、「Vagrantが、VirtualBoxをVBoxManageを使って実行する際にエラーが発生しました。そのコマンドとstderr(標準エラー出力)は、以下の通りです」といった内容です。

Command: ["startvm", "06d68c13-7910-4f8f-a263-e9424395d7cf", "--type", "headless"]

要は、startvm(=Start Virtual Machine)コマンドを実行したところ、エラーが発生したとのこと。
06d68c13-7910-4f8f-a263-e9424395d7cfは仮想マシンの名前です。

原因

結論としては、VirtualBoxが正しくインストールされていなかったようです。(何という致命的なミス...)

VirtualBoxをアンインストール→再インストールすれば解決するという記事がいくつかあったので、その通りに実行するも解決せず。何度か上記を繰り返しているうちにこの原因に気づきました。

対処法

System software from〜のところをAllowにすることで正しくインストールができます。

結果

Booting VM....で上記エラーが表示されてしまい躓いてしまいましたが、無事に仮想マシンを立ち上げることができました。

==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
==> default: Forwarding ports...
    default: 22 (guest) => 2222 (host) (adapter 1)
==> 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
59
30
1

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
59
30