mk-toolブログ

エンジニアと家のことをごちゃごちゃと書いてます

【vagrant】vagrant upで仮想マシンが立ち上がらなかったのでメモ

windows10環境で

vagrant up

が立ち上がらなかった。

その際に出てきたメッセージは以下。

The guest machine entered an invalid state while waiting for it
to boot. Valid states are 'starting, running'. The machine is in the
'poweroff' state. Please verify everything is configured
properly and try again.

If the provider you're using has a GUI that comes with it,
it is often helpful to open that and watch the machine, since the
GUI often has more helpful error messages than Vagrant can retrieve.
For example, if you're using VirtualBox, run `vagrant up` while the
VirtualBox GUI is open.

The primary issue for this error is that the provider you're using
is not properly configured. This is very rarely a Vagrant issue.

エラーはGUIから詳細を確認してね、とのことですが、確認せずに解決策だけ書きます。

VirtualBoxを入れなおします。と言っても、既にVirtualBoxを入れている方でも既存のVirtualBoxをアンインストールせずに入れても問題ありません(少なくとも私は問題ありませんでした)。この際、入れるものに注意が必要で、VM VirtualBox Extension Packを入れる必要がありました。私もそうでしたが、VirtualBoxどれを入れればいいのかな、ダウンロードページの一番上にあるのが無難かな、と思ってダウンロードした方はおそらくExtension Packではないです。ダウンロード用のサイトは以下です。
Downloads – Oracle VM VirtualBox

後は、下記のように起動するだけです。
(私の場合、なぜか一度目の「vagrant up」はタイムアウトになってしまいます。しかし、もう一度「vagrant up」を実行するとタイムアウトは起きずに「running」状態になります。まぁ動いたからいいか…。「vagrant status」で状況を逐一確認してください。)

del VagrantFile
vagrant box list
vagrant init box名
vagrant up
vagrant status

あまり関係ないけど、以下のサイトは読んでみると楽しそうなのでメモ。
www.kaasan.info