描述

  这几天在windows环境上,部署了vagrant,在启动虚拟机的时候报错:

[c:\~]$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'centos'...
==> default: Matching MAC address for NAT networking...
==> default: Setting the name of the VM: Sessions_default_1566958579504_77159
==> default: Destroying VM and associated drives...
D:/tools/HashiCorp/Vagrant/embedded/gems/2.2.5/gems/vagrant-2.2.5/lib/vagrant/util/io.rb:32:in `encode': incomplete "\xC8" on GBK (Encoding::InvalidByteSequenceError)
    from D:/tools/HashiCorp/Vagrant/embedded/gems/2.2.5/gems/vagrant-2.2.5/lib/vagrant/util/io.rb:32:in `read_until_block'
    from D:/tools/HashiCorp/Vagrant/embedded/gems/2.2.5/gems/vagrant-2.2.5/lib/vagrant/util/subprocess.rb:194:in `block in execute'
    from D:/tools/HashiCorp/Vagrant/embedded/gems/2.2.5/gems/vagrant-2.2.5/lib/vagrant/util/subprocess.rb:192:in `each'
    from D:/tools/HashiCorp/Vagrant/embedded/gems/2.2.5/gems/vagrant-2.2.5/lib/vagrant/util/subprocess.rb:192:in `execute'
    from D:/tools/HashiCorp/Vagrant/embedded/gems/2.2.5/gems/vagrant-2.2.5/lib/vagrant/util/subprocess.rb:22:in `execute'

解决过程

  找了好久,都没有说明白,后来在国外的github上看到了解决的方案。

参考地址:https://github.com/hashicorp/vagrant/issues/9368

参考内容:

My Solution

With the help of a non vagrant-related StackOverflow solution, I solved the issue by changing the line  in "Vagrant\embedded\gems\gems\vagrant-2.0.1\lib\vagrant\util" as:

data << io.readpartial(READ_CHUNK_SIZE).encode('UTF-8', invalid: :replace, undef: :replace, replace: '?')

即修改源代码,说改就改:

1.找到D:/tools/HashiCorp/Vagrant/embedded/gems/2.2.5/gems/vagrant-2.2.5/lib/vagrant/util/io.rb文件,找到32行

data << io.readpartial(READ_CHUNK_SIZE).encode("UTF-8", Encoding.default_external)

2.将这行注释掉,下面加入参考github上的代码

              #data << io.readpartial(READ_CHUNK_SIZE).encode("UTF-8", Encoding.default_external)
data << io.readpartial(READ_CHUNK_SIZE).encode('UTF-8', invalid: :replace, undef: :replace, replace: '?')

3.修改之后,重新执行命令vagrant up

[c:\~]$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'centos'...
==> default: Matching MAC address for NAT networking...
==> default: Setting the name of the VM: Sessions_default_1566958795239_49467
Vagrant is currently configured to create VirtualBox synced folders with
the `SharedFoldersEnableSymlinksCreate` option enabled. If the Vagrant
guest is not trusted, you may want to disable this option. For more
information on this option, please refer to the VirtualBox manual: https://www.virtualbox.org/manual/ch04.html#sharedfolders This option can be disabled globally with an environment variable: VAGRANT_DISABLE_VBOXSYMLINKCREATE= or on a per folder basis within the Vagrantfile: config.vm.synced_folder '/host/path', '/guest/path', SharedFoldersEnableSymlinksCreate: false
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter : nat
==> default: Forwarding ports...
default: (guest) => (host) (adapter )
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:
default: SSH username: vagrant
default: SSH auth method: private key
default: Warning: Connection reset. Retrying...
default: Warning: Connection aborted. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default:
default: Vagrant insecure key detected. Vagrant will automatically replace
default: this with a newly generated keypair for better security.
default:
default: Inserting generated public key within guest...
default: Removing insecure key from the guest if it's present...
default: Key inserted! Disconnecting and reconnecting using new SSH key...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
default: The guest additions on this VM do not match the installed version of
default: VirtualBox! In most cases this is fine, but in rare cases it can
default: prevent things such as shared folders from working properly. If you see
default: shared folder errors, please make sure the guest additions within the
default: virtual machine match the version of VirtualBox you have installed on
default: your host and reload your VM.
default:
default: Guest Additions Version: 4.3.
default: VirtualBox Version: 6.0
==> default: Mounting shared folders...
default: /vagrant => C:/Users/Administrator/Documents/NetSarang/Xshell/Sessions

顺利通过!

文档创建时间:2019年8月28日10:44:13

win7环境下,vagrant,在启动虚拟机的时候报错io.rb:32:in `encode': incomplete "\xC8" on GBK (Encoding::InvalidByteSequenceError)的更多相关文章

  1. vagrant up报错【io.rb:32:in `encode': "\x95" followed by "\"" on GBK (Encoding::InvalidByteSequenceError)】

    vagrant up报错[io.rb:32:in `encode': "\x95" followed by """ on GBK (Encoding: ...

  2. linux centos环境下,perl使用DBD::Oracle遇到报错Can't locate DBD/Oracle.pm in @INC 的解决办法

    前言 接手前辈的项目,没有接触.安装.使用过perl和DBD::Oracle,也没有相关的文档记录,茫茫然不知所措~~.一开始发现这个问题,就想着迅速解决,就直接在google上搜报错信息,搜索的过程 ...

  3. SpringBoot环境下使用测试类注入Mapper接口报错解决

    当我们在进行开发中难免会要用到测试类,而且测试类要注入Mapper接口,如果测试运行的时候包空指针异常,看看测试类上面的注解是否用对! 正常测试我们需要用到的注解有这些: @SpringBootTes ...

  4. win10环境下pycharm成功安装torch,解决报错:from torch._C import * ImportError: DLL load failed: 找不到指定的模块

    https://blog.csdn.net/watermelon12138/article/details/97624733

  5. 在Win7环境下安装启动Linux

    在Win7环境下安装启动Linux 在Win7系统下,安装启动Linux特别的不方便,由于XP下的boot.ini配置文件不在了,要加入�一下启动选项的话, 仅仅能使用专门的工具,这或多或少给人带来不 ...

  6. win7环境下配置JDK&&安装Weblogic12.2.1.4.0

    win7环境下安装Weblogic12.2.1.4.0 写在前面 最近因为想复现一下weblogic的CVE-2020-2555和CVE-2020-2883漏洞,需要weblogic环境,但是vulh ...

  7. 实验三:xen环境下的第一个虚拟机的安装

    实验名称: xen环境下的第一个虚拟机的安装 实验环境: 我们这里继续上面实验二来完成这个实验: 环境则是xen的安装环境,如下图: 开启虚拟机的的硬件辅助虚拟化功能: 实验要求: 这里我们通过安装b ...

  8. WIN7 环境下搭建 PHP7(64 位)操作步骤

    WIN7 环境下搭建 PHP7(64 位)操作步骤 一.安装与配置 Apache 1.下载 Apache下载地址:https://www.apachelounge.com/download/ 2.安装 ...

  9. PGPDesktop在win7环境下的安装和使用

    PGPDesktop在win7环境下的安装和使用 PGP的简介 PGP(Pretty Good Privacy),是一个基于RSA公钥加密体系的邮件加密软件,它提供了非对称加密和数字签名,是目前非常流 ...

随机推荐

  1. 为什么要将action实例设置为多例

    转载自 https://zhidao.baidu.com/question/622162406833405932.html struts2中action是多例的,即一个session产生一个actio ...

  2. Odoo graph视图

    转载请注明原文地址:https://www.cnblogs.com/ygj0930/p/10826175.html 一:图形视图 图形视图用来表示对模型的概述和分析,根元素是<graph> ...

  3. 将源码包制作成rpm包

    Linux系统中一般安装软件有两种方法,源码安装和yum安装或者rpm包安装,由于光盘中的rpm包都是几年前制作成的,所以软件版本都很低,同时yum安装对软件的可定制性很低,所以为了使用最新的软件,一 ...

  4. css overflow失效的原因

    声明 转载自https://my.oschina.net/xuqianwen/blog/540587 项目中常常有同学遇到这样的问题,现象是给元素设置了overflow:hidden,但超出容器的部分 ...

  5. c#每天生成漂亮桌面背景、英文名言、翻译

    阅读目录 一.1. 下载bing.com壁纸查询API 二.2. 解析返回的壁纸JSON信息 三.3. 下载完成的壁纸图片 阅读目录 .NET生成漂亮桌面背景 .NET生成漂亮桌面背景 总结 回到目录 ...

  6. 云打印 对Echo的Beta产品测试报告

    云打印 对Echo的Beta产品测试报告 课程名称:软件工程1916|W(福州大学) 团队名称: 云打印 作业要求: 项目Beta冲刺(团队) 作业目标:作业集合 团队队员 队员学号 队员姓名 个人博 ...

  7. 葫芦娃团队项目Beta冲刺-总结

    课程名称:软件工程1916|W(福州大学) 作业要求:项目Beta冲刺 团队名称:葫芦娃队 作业目标:总结项目冲刺内容 githup地址:https://https://github.com/Baka ...

  8. 项目Beta冲刺总结随笔

    班级:软件工程1916|W 作业:项目Beta冲刺 团队名称:SkyReach 目标:Beta冲刺Day2 项目Github地址 团队博客汇总 队员学号 队员姓名 个人博客地址 备注 22160010 ...

  9. 利用requests库访问360主页20次

    一.安装 1.cmd进入命令行界面 2.直接输入 D:切换至D盘(python所在路径), 然后cd  python下的scripts所在路径,切换至pip所在位置 3.pip install req ...

  10. 自学git

    网址:https://github.com/join/plan 注册:gzhcsu 注册邮箱:QQ邮箱.