【问题标题】:Vagrant Up (private_network) Error : default: Warning: Connection aborted. RetryingVagrant Up (private_network) 错误:默认值:警告:连接中止。重试
【发布时间】:2018-04-28 22:16:54
【问题描述】:

我有以下 Vagranfile。当我vagrant up 时,我收到以下错误。 但是,如果我改用 config.vm.network "public_network",一切正常。

但我还是想使用config.vm.network "private_network",这样我就可以分配固定的IP地址进行开发。

[错误]

    default: Adapter 2: hostonly
==> default: Forwarding ports...
    default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> 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 aborted. Retrying...
    default: Warning: Connection aborted. Retrying...

[流浪文件]

Vagrant.configure("2") do |config|
  config.vm.box = "pef"

  config.vm.network "private_network", ip: "192.168.33.12"
  #config.vm.network "public_network"

  config.vm.synced_folder "C:/Users/user1/myprj", "/home/vagrant"

  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"

     # For host-only adapter
     vb.customize ["modifyvm", :id, "--uartmode1", "disconnected" ]
     vb.customize ["modifyvm", :id, "--nictype1", "Am79C973"]
     vb.customize ["modifyvm", :id, "--nictype2", "Am79C973"]
  end
end

【问题讨论】:

    标签: vagrant virtualbox


    【解决方案1】:

    我遇到了这个令人困惑的问题。您需要知道的第一件事是导致超时的问题。

    如果您使用的是 VirtualBox,您可以将其添加到您的 VagrantFile 中:

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

    这将启动 VirtualBox 窗口并帮助您了解在虚拟机启动过程中可能出现的错误。

    就我而言,我尝试了几件事,最终将 Vagrant 的超时时间提高到 600:

      config.vm.boot_timeout = 600 
    

    您还可以在 StackOverflow 上阅读此提要,它描述了相同的问题: Vagrant up timeout

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-10-08
      • 2014-08-26
      • 2016-03-24
      • 1970-01-01
      • 2020-11-12
      • 2015-03-28
      • 1970-01-01
      • 2018-10-24
      相关资源
      最近更新 更多