win7环境下,vagrant,在启动虚拟机的时候报错io.rb:32:in `encode': incomplete "\xC8" on GBK (Encoding::InvalidByteSequenceError)
描述:
这几天在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)的更多相关文章
- 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: ...
- linux centos环境下,perl使用DBD::Oracle遇到报错Can't locate DBD/Oracle.pm in @INC 的解决办法
前言 接手前辈的项目,没有接触.安装.使用过perl和DBD::Oracle,也没有相关的文档记录,茫茫然不知所措~~.一开始发现这个问题,就想着迅速解决,就直接在google上搜报错信息,搜索的过程 ...
- SpringBoot环境下使用测试类注入Mapper接口报错解决
当我们在进行开发中难免会要用到测试类,而且测试类要注入Mapper接口,如果测试运行的时候包空指针异常,看看测试类上面的注解是否用对! 正常测试我们需要用到的注解有这些: @SpringBootTes ...
- win10环境下pycharm成功安装torch,解决报错:from torch._C import * ImportError: DLL load failed: 找不到指定的模块
https://blog.csdn.net/watermelon12138/article/details/97624733
- 在Win7环境下安装启动Linux
在Win7环境下安装启动Linux 在Win7系统下,安装启动Linux特别的不方便,由于XP下的boot.ini配置文件不在了,要加入�一下启动选项的话, 仅仅能使用专门的工具,这或多或少给人带来不 ...
- win7环境下配置JDK&&安装Weblogic12.2.1.4.0
win7环境下安装Weblogic12.2.1.4.0 写在前面 最近因为想复现一下weblogic的CVE-2020-2555和CVE-2020-2883漏洞,需要weblogic环境,但是vulh ...
- 实验三:xen环境下的第一个虚拟机的安装
实验名称: xen环境下的第一个虚拟机的安装 实验环境: 我们这里继续上面实验二来完成这个实验: 环境则是xen的安装环境,如下图: 开启虚拟机的的硬件辅助虚拟化功能: 实验要求: 这里我们通过安装b ...
- WIN7 环境下搭建 PHP7(64 位)操作步骤
WIN7 环境下搭建 PHP7(64 位)操作步骤 一.安装与配置 Apache 1.下载 Apache下载地址:https://www.apachelounge.com/download/ 2.安装 ...
- PGPDesktop在win7环境下的安装和使用
PGPDesktop在win7环境下的安装和使用 PGP的简介 PGP(Pretty Good Privacy),是一个基于RSA公钥加密体系的邮件加密软件,它提供了非对称加密和数字签名,是目前非常流 ...
随机推荐
- 记使用pyspider时,任务不执行的问题原因:save太大。
pyspider使用save传递大量文本时,如果是mysql数据库,有可能出现问题,因为任务表默认用的blob字段.字符数是有限制的. 解决办法就是手动把字段类型改成longblob. 希望作者能直接 ...
- 【Nginx】将http升级到https并且同时支持http和https两种请求
一.如何将http升级到https 需要满足下面三个: 1.域名 2.nginx 3.SSL证书 一般第三方证书颁发机构下发的证书是收费的,一年好几千. 1) 从腾讯云申请免费的SSL证 ...
- linux虚拟机网络配置
环境:虚拟机-最小化安装 centos7 主机:win10 参考配置文件: TYPE=EthernetPROXY_METHOD=noneBROWSER_ONLY=noBOOTPROTO=stat ...
- JavaSE理论篇
将已学过的知识记录在此,既能便于以后温习又能方便知识共享,做到共同成长. 计算机语言发展简史 主要分为三个阶段 机器语言:打点机,有点表示1,没有表示0,打点计时器 低级语言:汇编语言 高级语言:Ja ...
- 快速的在linux服务器上安装jdk8
1.执行命令 yum -y list java* 查看可安装java版本.执行成功后可以看见如下的结果 选择一个java版本进行安装,这里我们希望安装java1.8,因为我们的机器是64位的,所以选择 ...
- C语言scanf函数转换说明表及其修饰符表
1. 对于上一篇文章,总结printf()输出,C库也包含了多个输入函数, scanf()是最常用的一个,也是经常与printf()经常一起搭配使用的函数之一. scanf()和printf()类似, ...
- python 实现 DES CBC模式加解密
# -*- coding=utf-8-*- from Crypto.Cipher import DES import base64 """ des cbc加密算法 pad ...
- ArcSDE SQL Server 创建地图数据库
1.安装并破解: ArcGIS 10.2 ArcSDE 10.2 Sql Server 2008 R2 本文重点关注Sql Server和ArcSDE配置问题,安装破解过程略. 2.配置Sql Ser ...
- Gym - 247731E :room(最小费用流裸题)
题意:有N个宿舍(N<200),给出第一年每个宿舍有哪4个同学.现在给出N个4元组y[][4],表示这4个人想住一起,问最少多少人需要换宿舍. 思路:费用流,每个4元组y[]到每个宿舍连边,流量 ...
- Dockerfile 常见指令的意义/常见的使用方式/使用示例/
一.什么是 Dockerfile ? Dockerfile 就是生成docker镜像的指令集, 通过使用docker工具执行这些指令集可以方便快捷地生成镜像, 并且能不断复用 Dockerfile 指 ...