无法启动homestead,出现报错Your VM has become "inaccessible." 该怎么办?

今天早上,进入到Homestead目录,执行vagrant up,结果报错:

Bringing machine 'homestead-7' up with 'virtualbox' provider...
==> homestead-7: Checking if box 'lc/homestead' version '8.2.1' is up to date...
Your VM has become "inaccessible." Unfortunately, this is a critical error
with VirtualBox that Vagrant can not cleanly recover from. Please open VirtualBox
and clear out your inaccessible virtual machines or find a way to fix
them.

好吧,再一次出现了这个问题,我决定好好记录一下这个过程。

缕清思路

我们使用Homestead开发的目的是,使用最高效的方式得到一个快速开发的、可更替的环境。所以解决这个报错的前提条件是,不能浪费太多时间,也不需要保留这个虚拟机的数据。

开始解决

借鉴百度上面的方法

按照刚才的思路,我们百度一下,看看网上其他人怎么做的。

删除.vagrant,重新执行vagrant up

按照这个方法,会报错如下

Bringing machine 'homestead-7' up with 'virtualbox' provider...
==> homestead-7: Importing base box 'lc/homestead'...
There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.

Command: ["import", "\\\\?\\C:\\Users\\admin\\.vagrant.d\\boxes\\lc-VAGRANTSLASH-homestead\\8.2.1\\virtualbox\\box.ovf", "--vsys", "0", "--vmname", "lt-settler_default_1574502090510_42501_1606697104250_24158", "--vsys", "0", "--unit", "11", "--disk", "C:/Users/admin/VirtualBox VMs/lt-settler_default_1574502090510_42501_1606697104250_24158/box-disk001.vmdk"]

Stderr: 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Interpreting \\?\C:\Users\admin\.vagrant.d\boxes\lc-VAGRANTSLASH-homestead\8.2.1\virtualbox\box.ovf...
OK.
0%...
Progress state: E_INVALIDARG
VBoxManage.exe: error: Appliance import failed
VBoxManage.exe: error: Code E_INVALIDARG (0x80070057) - One or more arguments are invalid (extended info not available)
VBoxManage.exe: error: Context: "enum RTEXITCODE __cdecl handleImportAppliance(struct HandlerArg *)" at line 957 of file VBoxManageAppliance.cpp

直接重新安装

到了这一步,我按照自己的习惯,喜欢推倒一切,重新再来,速度更快。所以开始销毁这个虚拟机,重新搭建一套。

  1. 首先卸载vagrant,卸载virtualbox
  2. 删除C:\Users\admin下面的vagrant和virtualbox的配置文件
    到此为止,已经完成“推倒”
    下面来重建,
  3. 安装virtualbox和vagrant
  4. 添加虚拟机
    进入lc-homestead-8.2.1-2019112300目录
    vagrant box add metadata.json
    成功添加,返回如下
    ==> box: Loading metadata for box 'metadata.json'
     box: URL: file://E:/lc-homestead-8.2.1-2019112300/metadata.json
    ==> box: Adding box 'lc/homestead' (v8.2.1) for provider: virtualbox
     box: Downloading: virtualbox.box
     box:
    ==> box: Successfully added box 'lc/homestead' (v8.2.1) for 'virtualbox'!
  5. 重新恢复Homestead
    git checkout .
    ./init.bat
  6. 最后把之前备份的Homestead.yml放到里面,执行`vagrant up’

乱七八糟的程序,想搞清楚里面的东西真的很花时间,不如推倒重来

本作品采用《CC 协议》,转载必须注明作者和本文链接
《L03 构架 API 服务器》
你将学到如 RESTFul 设计风格、PostMan 的使用、OAuth 流程,JWT 概念及使用 和 API 开发相关的进阶知识。
《L02 从零构建论坛系统》
以构建论坛项目 LaraBBS 为线索,展开对 Laravel 框架的全面学习。应用程序架构思路贴近 Laravel 框架的设计哲学。
讨论数量: 1

边学习边记笔记啊 :grin:

3年前 评论

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!