vagrant 错误记录
使用Vagrant配置本地开发环境
从二零一四年开始使用vagrant+VirtualBox搭建linux开发环境,配置简单灵活,后台运行占用内存少,比vmware好用很多,果断弃用vmware转投vagrant的怀抱;无论是个人搭建开发环境还是团队统一开发环境,vagrant是最方便快捷的方式。
问题一:
但是最近在使用的时候遇到一些坑,记录下来以免下次遇到浪费时间去查找解决;经过是这样的:从家里的agrant打包了一份开发环境到公司的新电脑上,vagrant init {boxname}初始化后使用vagrant up启动虚拟机却一直启动失败,提示如下:
D:\webroot\vagrant>vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
==> default: Forwarding ports...
default: 22 => 2222 (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2222
default: SSH username: vagrant
default: SSH auth method: private key
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
Timed out while waiting for the machine to boot. This means that
Vagrant was unable to communicate with the guest machine within
the configured ("config.vm.boot_timeout" value) time period.
If you look above, you should be able to see the error(s) that Vagrant had when attempting to connect to the machine. These errors are usually good hints as to what may be wrong.
If you're using a custom box, make sure that networking is properly working and you're able to connect to the machine. It is a common problem that networking isn't setup properly in these boxes. Verify that authentication configurations are also setup properly,as well.
If the box appears to be booting properly, you may want to increase the timeout ("config.vm.boot_timeout") value.
通过查找资料,在stackowverflow上有网友也遇到过相同问题并给出解决方案如下:
将Vagrantfile配置文件中vb.gui = true的注释去掉
config.vm.provider "virtualbox" do |vb|
# # Don't boot with headless mode
vb.gui = true
#
# # Use VBoxManage to customize the VM. For example to change memory:
# vb.customize ["modifyvm", :id, "--memory", "1024"]
end
运行vagrant up 启动 virtualbox 后,GUI会给出提示
VT-x/AMD-V硬件加速在您的系统中不可用。您的64-位虚拟机将无法检测到 64-位处理器,从而无法启动。
- 这是由于在BOIS中没有开启cpu虚拟化支持,重启F2或F10等进入BIOS设置Virtualization为Enable(我的Thinkpad是Security=>Virtualizatio设置为Enable);
- 电脑重启后,再次vagrant up启动虚拟机还是有一些问题,当时也没有记录下来错误信息,只记得解决方案是使用vagrant destroy将虚拟机从磁盘中删除,然后使用vagrant up命令重新创建。
问题二 (2015.5.7更新)
vagrant启动报错The following SSH command responded with a non-zero exit status.
D:\vagrant_web>vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
default: Adapter 2: hostonly
==> default: Forwarding ports...
default: 80 => 8080 (adapter 1)
default: 3000 => 3000 (adapter 1)
default: 22 => 2222 (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2222
default: SSH username: vagrant
default: SSH auth method: private key
default: Warning: Connection timeout. Retrying...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
==> default: Configuring and enabling network interfaces...
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!
ARPCHECK=no /sbin/ifup eth1 2> /dev/null
Stdout from the command:
Device eth1 does not seem to be present, delaying initialization.
Stderr from the command:
解决方案
虽然vagrant up启动报错,但是vagrant ssh还是能登陆虚拟机的,进入虚拟机后,执行如下命令
sudo rm -f /etc/udev/rules.d/70-persistent-net.rules
对, 问题就处在在持久网络设备udev规则(persistent network device udev rules)是被原VM设置好的,再用box生成新VM时,这些rules需要被更新。而这和Vagrantfile里对新VM设置private network的指令发生冲突。删除就好了。
vagrant reload 再次启动就OK。
以上问题完美解决,记录下来,避免忘记!
vagrant 错误记录的更多相关文章
- uploadify插件Http Error(302)错误记录(MVC)
由于项目(asp.net MVC)需要做一个附件上传的功能,使用的是jQuery的Uploadify插件的2.1.0版本,上传文件到自己项目指定的文件夹下面.做完之后,在谷歌上测试是正确的,在火狐上报 ...
- 开发错误记录8:Unable to instantiate application com
开发错误记录8:Unable to instantiate application com.android.tools.fd.runtime.BootstrapApplication 这是因为在And ...
- PHP 错误与异常 笔记与总结(5)配置文件中与错误日志相关的选项 && 将错误记录到指定的文件中
[记录错误(生产环境)] php.ini: ① 开启 / 关闭 错误日志功能 log_errors = On ② 设置 log_errors 的最大字节数 log_errors_max_len = 其 ...
- 安装nagios出现的两个错误记录
最近在安装nagios,出现几个错误记录: 一 检查nagios配置的时候出现错误如下: Warning: Duplicate definition found for host 'kelly' (c ...
- [置顶] 利用Global.asax的Application_Error实现错误记录,错误日志
利用Global.asax的Application_Error实现错误记录 错误日志 void Application_Error(object sender, EventArgs e) { // 在 ...
- streamsets 错误记录处理
我们可以在stage 级别,或者piepline 级别进行error 处理配置 pipeline的错误记录处理 discard(丢踢) send response to Origin pipeline ...
- php设置错误,错误记录
//设置错误级别. error_reporting(E_ALL); //显示所有错误 error_reporting(E_ALL&~E_NOTICE); //显示所有错误但不显示提示级别的 ...
- 27:简单错误记录SimpleErrorLog
题目描述 开发一个简单错误记录功能小模块,能够记录出错的代码所在的文件名称和行号. 处理: 1. 记录最多8条错误记录,循环记录,对相同的错误记录(净文件名称和行号完全匹配)只记录一条,错误计数增加: ...
- WebSphere中数据源连接池太小导致的连接超时错误记录
WebSphere中数据源连接池太小导致的连接超时错误记录. 应用连接超时错误信息: [// ::: CST] webapp E com.ibm.ws.webcontainer.webapp.WebA ...
随机推荐
- 解决 php-cgi 启动时提示缺少 msvcr110.dll 的问题
问题描述: 启动 php-cgi 时如果提示缺少 msvcr110.dll 问题原因: 缺少 vc 2012 运行库 问题解决: 需要安装 vcredist_x64.exe 或 vcredist_ ...
- VS2010引用App_Code下的类文件问题解决方法
原文连接:http://blog.csdn.net/zjlovety/article/details/7658528 VS2020中“添加ASP.NET文件夹”里没有App_Code,添加普通文件夹然 ...
- Linux PPTP搭建
PPPTP概述 tcp1723 1,安装 rpm -ivh ppp--14.1.rhel5.x86_64.rpm #安装ppp rpm -ivh pptpd--.rhel5.x86_64.rpm #安 ...
- 淘宝账号基于OAuth2.0的登录验证授权登陆第三方网站
首先得有一个注册的appkey和App Secret 该流程分三个步骤: 第一步:通过用户授权获取授权码Code: 第二步:用上一步获取的Code和应用密钥(AppSecret)通过Https P ...
- CSS 实现加载动画之四-圆点旋转
圆点旋转也是加载动画中经常用到的.其实现方式和菊花旋转一样,只不过一个是线条形式,一个是圆点形式.圆点按照固定的旋转角度排列,加上延时的改变透明度的动画就可以实现.这个实现也比较简单. 1. 动画截图 ...
- WebSocket 服务器3
其实,在服务器的选择上很广,基本上,主流语言都有WebSocket的服务器端实现,而我们作为前端开发工程师,当然要选择现在比较火热的NodeJS作为我们的服务器端环境了.NodeJS本身并没有原生的W ...
- CDC类
CDC :class of device context Windows使用与设备无关的图形设备环境(DC :Device Context) 进行显示 .MFC基础类库定义了设备环境对象类----CD ...
- vs2015发现一个字符串拼接 bug
VS2015支持 字符串拼接 如下: string user="test"; int password=123; string sql=$" user={user};pa ...
- [C#]Attribute特性
简介 特性提供功能强大的方法,用以将元数据或声明信息与代码(程序集.类型.方法.属性等)相关联. 特性与程序实体关联后,即可在运行时使用名为“反射”的技术查询特性. 特性具有以下属性: 特性可向程序中 ...
- c# JD快速搜索工具,2015分析JD搜索报文,模拟请求搜索数据,快速定位宝贝排行位置。
分析JD搜索报文 搜索关键字 女装 第二页,分2次加载. rt=1&stop=1&click=&psort=&page=3http://search.jd.com/Se ...