2019-01-22_Vagrantで起動時にエラーが出る(UID編)

このページで分かること

  • vagrant up時にUIDエラーが出るときの対処の仕方と原因

環境

  • Windows 10 v1803
  • Vagrant 2.2.3
  • VirtualBox 6.0.2

概要

vagrant up 時に下記のようなエラーが表示されboxが起動できない場合がありました。初回にvmが作成された際のUUIDと今作成しようとしているUUIDに齟齬が出てしまっている状態です。

1
2
3
4
5
6
7
8
$c vagrant.exe up
The VirtualBox VM was created with a user that doesn't match the
current user running Vagrant. VirtualBox requires that the same user
be used to manage the VM that was created. Please re-run Vagrant with
that user. This is not a Vagrant issue.

The UID used to create the VM was: 1000
Your UID is: 0

対処法

  • .vagrantフォルダを削除

vagrant up時にVagrantfileが置かれているディレクトリに.vagrantフォルダが作成されます。そのフォルダ内にuuidを記憶しているファイルが存在するので一旦削除すればuuidの齟齬はなくなります。 削除後に再度vagrant upし直すことで正常に起動できます。