Vagrant搭建虚拟机

概述

我参考此文在个人电脑成功用Vagrant搭建虚拟机,本文记录在搭建过程中遇到的问题和解决方法。

遇到的问题

vagrant up启动报错

$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'centos-7'...
==> default: Matching MAC address for NAT networking...
==> default: Setting the name of the VM: demo_default_1588406874156_65036
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
==> default: Forwarding ports...
    default: 22 (guest) => 2222 (host) (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
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.

如何解决

网上搜索出来最多的解决方法是设置BIOS的虚拟化,而我的BIOS已经开启了虚拟化但仍然出现这种错误。后来我通过查看virtualbox的日志定位到问题,具体方法如下

1. 打开virtualbox

2. 右击启动报错的虚拟机,点击日志

 3. 查看日志发现关键信息

kernel panic - not syncing fatal exception

4. 参考此文通过升级vagrant和virtualbox解决了问题

原来的版本

vagrant: 2.2.9

virtualbox: 6.0.24

升级到当前最新版本

vagrant: 2.2.18

virtualbox: 6.1.28

所以, 我的经验是这种错误日志是通用日志,需要查看virtualbox的日志具体问题具体分析。

最后,感谢下面所有参考文献。

参考

超详细 Vagrant 入门指南,建议收藏_DavyCloud-CSDN博客_vagrant

vagrant 启动 报错:Timed out while waiting for the machine to boot_lw545034502的博客-CSDN博客

虚拟机安装报错kernel panic - not syncing fatal exception_u013761049的专栏-CSDN博客

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值