2016-11-02 116 views
2

創建非常簡單Vagrantfile:無法SSH到流浪的Ubuntu 16.04?

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

Vagrant.configure(2) do |config| 
    config.vm.box = "boxcutter/ubuntu1604" 
    config.vm.hostname = "r1" 
    config.vm.network "forwarded_port", guest: 3000, host: 3000 

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

    config.vm.provider "virtualbox" do |vb| 
    vb.memory = "1024" 
    end 

end 

的通用到了Ubuntu的16.04服務器。除了使用SSH連接的問題之外,一切都很好。

我的日誌:

vagrant up

Bringing machine 'default' up with 'virtualbox' provider... 
==> default: Checking if box 'boxcutter/ubuntu1604' is up to date... 
==> default: Fixed port collision for 22 => 2222. Now on port 2200. 
==> 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: 3000 (guest) => 3000 (host) (adapter 1) 
    default: 22 (guest) => 2200 (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:2200 
    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 the box appears to be booting properly, you may want to increase 
the timeout ("config.vm.boot_timeout") value. 

我更換config.vm.box = 「博克卡特/ ubuntu1604」 與框名稱「的Ubuntu/trusty64」,它的運作良好,但如何解決16.04?

+1

請確保你有最新的vagrant/virtualbox在舊版本和Ubuntu上有很多問題16.04 –

+0

所以看起來像我在https://atlas.hashicorp.com/boxes/search上找到的'ubuntu/trusty64'是OS的桌面版本,而不是服務器版本。在安裝過程中,我得到*'升級BIOS或使用force_addr = 0xaddr'*錯誤問題,但Vagrant不顯示錯誤。我導入並使用 - * vagrant box添加https://atlas.hashicorp.com/gbarbieru/boxes/xenial*,它運行良好。希望這有助於某人。 – sharp

+0

所以,我解決這個案例添加到vagrantfile這個代碼:vb.customize [「modifyvm」,:id,「--cableconnected1」,「上」] – sharp

回答

0

你有沒有試過在錯誤提到的解決方案? boot_timeout默認爲300秒[1] - 您是否給Boxcutter盒多一點時間,例如: 600秒,看看會不會迴應?

但是在ubuntu/trusty64旁邊還有ubuntu/xenial64[2]這就是16.04 - 也許你會試試它。

+0

我嘗試增加超時,我嘗試ubuntu/xenial64正如你注意到的。但是同樣的結果.. – sharp

0
Vagrant.configure(2) do |config| 
    config.vm.box = "ubuntu/xenial64" 
    config.vm.provider :virtualbox do |vb| 
    vb.customize ["modifyvm", :id, "--memory", "2048"] 
end  

試試這可能對你有幫助。

1

我有同樣的問題,它解決了更新到最後一個VirtualBox和流浪版本。試試「bento/ubuntu-16.04」流浪盒。 「ubuntu/xenial64」不適合我。