关于vagrant安装过程的坑

闲来无聊 试试vagrant虚拟化技术 安装过程中坑太多了 所以记录下方便以后 注意:

执行 vagrant up 命令报错 如下

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

Command: ["import", "\\\\?\\D:\\HashiCorp\\Vagrant\\boxes\\centos-VAGRANTSLASH-7\\0\\virtualbox\\box.ovf", "--vsys", "0", "--vmname", "centos-7-1-1.x86_64_1583492895965_65141", "--vsys", "0", "--unit", "10", "--disk", "C:/Users/\u65E0\u5173\u98CE\u6708/VirtualBox VMs/centos-7-1-1.x86_64_1583492895965_65141/centos-7-1-1.x86_64.vmdk"]

Stderr: 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Interpreting \\?\D:\HashiCorp\Vagrant\boxes\centos-VAGRANTSLASH-7\0\virtualbox\box.ovf...
OK.
0%...
Progress state: VBOX_E_INVALID_OBJECT_STATE
VBoxManage.exe: error: Appliance import failed
VBoxManage.exe: error: Storage for the medium 'C:\Users\鏃犲叧椋庢湀\VirtualBox VMs\centos-7-1-1.x86_64_1583492895965_65141\centos-7-1-1.x86_64.vmdk' is not created
VBoxManage.exe: error: Details: code VBOX_E_INVALID_OBJECT_STATE (0x80bb0007), component ApplianceWrap, interface IAppliance
VBoxManage.exe: error: Context: "enum RTEXITCODE __cdecl handleImportAppliance(struct HandlerArg *)" at line 957 of file VBoxManageAppliance.cpp

错误是 box的存储硬盘空间不够 修改box的默认存储地址 解决

关于vagrant安装过程的坑
还有就是在执行 vagrant up命令的时候报 字符编码有问题不能解析 解决方案如下:
找到 Vagrant 安装路径 博主是在 C:\HashiCorp\Vagrant\embedded\gems\2.2.6\gems\vagrant-2.2.6\lib\vagrant\util\io.rb
找到io.rb文件 32行替换成:
data << io.readpartial(READ_CHUNK_SIZE).encode(“UTF-8”, invalid: :replace,undef: :replace, replace: ‘?’)
问题解决。 大家可以试试

上一篇:VirtualBox虚拟机压缩磁盘以回收未使用的空间


下一篇:VBoxManage.exe: error: Failed to create the host-only adapter