Vagrant在等待机器启动时超时

问题描述 投票:0回答:1

我是新游民。我当前的环境是Ubuntu->在Virtual Box上运行->在Mac电脑上。

我已经在Ubuntu安装上成功安装了Virtualbox和Vagrant软件包。我设置了存储库并开始构建(无用)。成功复制映像后,我进入了vagrantfile,通过SSH连接到VM。它只是挂起,最终超时。

请参见下面的错误

==> default: Box 'ubuntu/trusty64' could not be found. Attempting to find and install...
    default: Box Provider: virtualbox
    default: Box Version: >= 0
==> default: Loading metadata for box 'ubuntu/trusty64'
    default: URL: https://vagrantcloud.com/ubuntu/trusty64
==> default: Adding box 'ubuntu/trusty64' (v20190514.0.0) for provider: virtualbox
    default: Downloading: https://vagrantcloud.com/ubuntu/boxes/trusty64/versions/20190514.0.0/providers/virtualbox.box
==> default: Successfully added box 'ubuntu/trusty64' (v20190514.0.0) for 'virtualbox'!
==> default: Importing base box 'ubuntu/trusty64'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'ubuntu/trusty64' is up to date...
==> default: Setting the name of the VM: postgres_default_1588691813886_34109
==> default: Clearing any previously set forwarded ports...

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=1

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 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

#<Thread:0x00005618d3a47468@/usr/share/rubygems-integration/all/gems/vagrant-2.0.2/lib/vagrant/batch_action.rb:71 run> terminated with exception (report_on_exception is true):

....
....
....

Timed out while waiting for the machine to boot. This means that (Vagrant::Errors::VMBootTimeout)

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.
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.

Vagrantfile

# -*- mode: ruby -*-
# # vi: set ft=ruby :

IMAGE_NAME = "bento/ubuntu-18.04"
N = 1

Vagrant.configure("2") do |config|

  config.vm.box = IMAGE_NAME
  config.vm.provision "shell", path: "provision/vagrant_provision.sh", privileged: true

  config.vm.provider "virtualbox" do |v|
    v.memory = 2048 
    v.cpus = 1
  end

  # Nodes
  (1..N).each do |number|
      config.vm.define "node-#{number}" do |node|
          node.vm.network "private_network", ip: "192.168.50.21#{number}"
          node.vm.hostname = "node-#{number}"
          node.vm.synced_folder "scripts/", "/scripts"
      end  
  end


end
ssh timeout vagrant vagrantfile
1个回答
0
投票

该问题与在Mac上已经在运行VirtualBox的Ubuntu VM下使用Vagrant / VirtualBox有关。当我在Mac上本地安装Vagrant / VirtualBox时,我没有任何问题。

© www.soinside.com 2019 - 2024. All rights reserved.