【问题标题】:Cannot get ubuntu/trusty32 running in Vagrant无法在 Vagrant 中运行 ubuntu/trusty32
【发布时间】:2017-03-16 01:20:34
【问题描述】:

我在 Core i3 上使用 Ubuntu 15.10 64 位。我已经安装了 Vagrant 1.8.1 和 VirtualBox。

我做了以下事情:

$ vagrant box add ubuntu/trusty32 
$ vagrant init ubuntu/trusty32
$ vagrant up

在执行vagrant up 之后,我收到如下所示的错误。如果我打开 VirtualBox,我可以看到系统已经启动并等待用户名和密码。

注意:让hashicorp/precise32 在 Vagrant 中运行没有任何问题。我只有ubuntu/trusty32 有问题。

~/vagrant$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'ubuntu/trusty32'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'ubuntu/trusty32' is up to date...
==> default: Setting the name of the VM: vagrant_default_1459678892518_13508
==> 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 (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.

我又给了$ vagrant up,这就是我得到的

~/vagrant$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'ubuntu/trusty32' is up to date...
==> default: VirtualBox VM is already running.

我也尝试了$ vagrant ssh,得到了以下结果。

~/vagrant$ vagrant ssh
ssh_exchange_identification: read: Connection reset by peer

这是我的Vagrantfile

谁能告诉我这是什么问题?

【问题讨论】:

  • 请发布您的Vagrantfile - 您在$ vagrant init ubuntu/trusty32 之后修改了吗?
  • 没有。我没有改变它的任何东西。 Vagrantfile 是使用 init 命令生成的。

标签: ubuntu ssh vagrant


【解决方案1】:

你可以试试

$ vagrant reload

$ vagrant halt && vagrant up

看看你是否有更好的运气。

我刚刚尝试了您的确切步骤系列,它对我有用。此外,盒子上的默认超时时间是 300 秒(5 分钟),所以发生了一些奇怪的事情。如果上述命令不起作用,您可以尝试通过 VirtualBox 界面启动它,或者通过更改 Vagrantfile 以使 GUI 显示如下...

改变这个:

# config.vm.provider "virtualbox" do |vb|
#   # Display the VirtualBox GUI when booting the machine
#   vb.gui = true
#
#   # Customize the amount of memory on the VM:     
#   vb.memory = "1024"
# end

到这里:

config.vm.provider "virtualbox" do |vb|
  # Display the VirtualBox GUI when booting the machine
  vb.gui = true

#   # Customize the amount of memory on the VM:     
#   vb.memory = "1024"
end

然后再试一次$ vagrant up。显示的新窗口/gui 可能包含其他信息。

如果以上都失败了,你可以试试

$ vagrant up --debug > vagrant_up.log 2>&1 && vagrant halt

这将使用调试标志引导机器并将内容输出到您的vagrant 目录中的文件vagrant_up.log,然后再次关闭机器。然后,您可以在此处发布生成的日志。

编辑

在通过这个答案的 cmets 进行更多故障排除后,发布了这张图片:

这表明 Virtualbox/vagrant 正在等待网络适配器继续启动序列。

您可以通过再次修改 Vagrantfile 以启用网络接口来解决此问题。

Vagrantfileconfig 部分添加如下一行,应该可以让机器启动:

config.vm.network "private_network", ip: 192.168.30.10

【讨论】:

  • 感谢您的回答。但我没有成功。如果oyu可以从日志pastebin.com/KrHbNXg5中找到问题,请告诉我
  • @robomon 当您通过 GUI 启动它时会发生什么?
  • @robomon Ruby 错误是因为您似乎没有正确取消注释 vb.gui = true 部分的行。
  • 是的。你是对的。屏幕出现错误。现在我被要求登录。错误截图imgur.com/ceIDYmf
【解决方案2】:

我也遇到了同样的问题。我尝试更改 bios 以启用虚拟化,它对我有用。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-06-10
    • 1970-01-01
    • 2015-11-22
    • 2015-02-27
    • 2017-05-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多