记一次 vagrant up 报错解决

$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Clearing any previously set forwarded ports...
==> default: Fixed port collision for 22 => 2222. Now on port 2200.
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
    default: Adapter 2: hostonly
==> default: Forwarding ports...
    default: 22 (guest) => 2200 (host) (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
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.

vargant up启动的时候遇到上述报错,无法启动虚拟机。

报错了咋办呢,按照提示去解决呗……

Valid states are 'starting, running'. The machine is in the 'poweroff' state.

If the provider you're using has a GUI that comes with it, it is often helpful to open that and watch the machine。

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

VirtualBox是Vagrant默认的Provider,提示信息是让打开Vagrant的GUI排查看看,为啥虚拟机一直处于‘关机状态’。原因八九成就是VirtualBox设置不正确。

那就打开VirtualBox呗,找到对应的虚拟机,在GUI界面上点启动看看。

记一次 vagrant up 报错解决_第1张图片
image.png

点启动,看到上述警告,出了个警告,说没有找到USB 2.0控制器,以及2个解决问题的方法(据说USB 2.0组件不开源,所以必须从完全开源的VirtualBox主体中分离):

  1. 安装‘Oracle VM VirtualBox Extension Pack’
  2. 在虚拟机设置中禁用USB 2.0 (只能用USB 1.1)

这就好办了,这里我使用的是第二种方法。找到

记一次 vagrant up 报错解决_第2张图片
image.png

再回到终端,执行 vagrant up,发现ok了。

总结:很多时候,遇到问题不必马上借助搜索引擎,照着报错信息提示试试,说不定很简单就解决了。

你可能感兴趣的:(记一次 vagrant up 报错解决)