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公钥加密体系的邮件加密软件,它提供了非对称加密和数字签名,是目前非常流 ...
随机推荐
- DTC测试
DTC配置好后要在2台server之间测试下是否能使用. 1.在A台上建立ODBC的连接B. 控制面板→管理工具→ODBC Datat Source(32bit) 点击添加 选择SQL SERVER ...
- [Startup].Linux启动时间优化
转自:https://www.cnblogs.com/agui125/p/10070559.html 正文 回到顶部 1. 实践过程 我是对海思3559进行启动时间优化的.具体的操作可以参考<H ...
- centos下导入mysql数据库
先进入mysql1.mysql -u root -p2.输入密码3.use 要导入的数据库名(没有就新建一个,使用create database test;命令新建,再use test;,再set n ...
- zabbix--钉钉告警
zabbix 钉钉告警机制 群机器人是钉钉群的高级扩展功能,群机器人可以将第三方服务的信息聚合到群聊中,实现自动化的信息同步.例如:通过聚合GitHub,GitLab等源码管理服务,实现源码更新同步: ...
- Ansible 常用模块(一)
一.Ansible简介 Ansible是新出现的自动化运维工具,基于python开发,集合了众多运维工具(puppet(ruby).cfengine.chef.func.fabric.)的优点,实现了 ...
- Oracle rman备份还原
备份脚本: oracle备份fullbak.sh 脚本 . /u01/prod/db/12.1.0/PROD_erpdbp.env LOGDATE="`date '+%Y%m%d'`&quo ...
- 类型转换的时候,.valueOf()和.parseX(),.Xvalue()的区别
.valueOf()返回的是包装类(Wrapper Class)中的一些类型:而.parseX()返回的是基本数据类型,如int,char,double等.其参数应该是String类型. .Xvalu ...
- jmeter4+win10+jdk1.8环境下,jmeter输入中文就卡死的问题
问题描述:jmeter4+win10+jdk1.8环境下,输入中文jmeter卡死: 解决思路: 起初以为是win10系统不兼容的问题,装了个虚拟机,在虚拟机里面装了win7,然后再装了jmeter, ...
- bind的模拟实现
bind 一句话介绍 bind: bind() 方法会创建一个新函数.当这个新函数被调用时,bind() 的第一个参数将作为它运行时的 this,之后的一序列参数将会在传递的实参前传入作为它的参数.( ...
- python-hashlib加密
用于加密相关的操作,代替了md5模块和sha模块,主要提供SHA1,SHA224,SHA256,SHA512,MD5算法. 以下是算法示例: #!/usr/bin/env python # -*- c ...