14
13

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

vagrant statusしたらnot createdになった場合はvagrant upとかしないでこうしよう

Last updated at Posted at 2016-03-01

背景

image

あるとき、Vagrantfileを編集したらこんなエラーになった。言われるがままにvagrant upしたら今まで作った環境を捨ててCreateしちゃうのでせっかく作った開発環境をやりなおしってなことになりかねません。あと、vagrant haltとかvagrant reloadもやめといたほうがいいっぽい。

toki-mac:my_vagrant tokifuji$ vagrant status
Current machine states:

default                   not created (virtualbox)

The environment has not yet been created. Run `vagrant up` to
create the environment. If a machine is not created, only the
default provider will be shown. So if a provider is not listed,
then the machine is not created for that environment.
toki-mac:my_vagrant tokifuji$

.vagrant/machines/default/virtualbox/idがいるか?

いないお(´;ω;`)ブワッ

toki-mac:my_vagrant tokifuji$ ll .vagrant/machines/default/virtualbox   
total 0
drwxr-xr-x  2 tokifuji  staff   68 Mar  1 14:35 .
drwxr-xr-x  3 tokifuji  staff  102 Feb 29 16:36 ..

UUIDを調べる

慌てるなって。

toki-mac:my_vagrant tokifuji$ vboxmanage list vms
"my_vagrant_default_*************_*****" {********-****-****-****-************}

この********-****-****-****-************をコピーしておく。

.vagrant/machines/default/virtualbox/idを作る

toki-mac:my_vagrant tokifuji$ vim .vagrant/machines/default/virtualbox/id

vimで作って先ほどコピったUUIDをペーストして保存。

.vagrant/machines/default/virtualbox/id
********-****-****-****-************

vagrant statusで確認

image

toki-mac:my_vagrant tokifuji$ vagrant status
Current machine states:

default                   running (virtualbox)

The VM is running. To stop this VM, you can run `vagrant halt` to
shut it down forcefully, or you can run `vagrant suspend` to simply
suspend the virtual machine. In either case, to restart it again,
simply run `vagrant up`.
toki-mac:my_vagrant tokifuji$

参考リンク

14
13
2

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
14
13

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?