`vagrant up` 在 "Waiting for domain to get an IP address..." 时超时
`vagrant up` times out at "Waiting for domain to get an IP address..."
这似乎只有在我使用 generic/arch
框时才会发生。我已经尝试了几个 ubuntu 盒子,一切正常。
主持人 OS 是 Manjaro。
输出冻结:
INFO interface: info: ==> default: Waiting for domain to get an IP address...
==> default: Waiting for domain to get an IP address...
INFO retryable: Retryable exception raised: #<Fog::Errors::TimeoutError: The specified wait_for timeout (2 seconds) was exceeded>
libvirt/virsh 版本 3.10.0
流浪者版本 2.0.1
OS 4.9.76-1-MANJARO
流浪文件:
Vagrant.configure("2") do |config|
config.vm.box = "generic/arch"
end
以下是我认为相关输出来自 VAGRANT_LOG=debug vagrant up
==> default: Creating shared folders metadata...
INFO warden: Calling IN action: #<VagrantPlugins::ProviderLibvirt::Action::CreateNetworks:0x0000560dfaea3450>
INFO create_networks: Using vagrant-libvirt at 192.168.121.0/24 as the management network nat is the mode
DEBUG create_networks: In config found network type forwarded_port options {:guest=>22, :host=>2222, :host_ip=>"127.0.0.1", :id=>"ssh", :auto_correct=>true, :p
rotocol=>"tcp"}
DEBUG create_networks: Searching for network with options {:iface_type=>:private_network, :network_name=>"vagrant-libvirt", :ip=>"192.168.121.0", :netmask=>"25
5.255.255.0", :dhcp_enabled=>true, :forward_mode=>"nat", :guest_ipv6=>"yes", :autostart=>false}
/home/eihli/.vagrant.d/gems/2.4.3/gems/nokogiri-1.6.8.1/lib/nokogiri/xml/document.rb:44: warning: constant ::Fixnum is deprecated
DEBUG create_networks: looking up network with ip == 192.168.121.0
DEBUG create_networks: Checking that network name does not clash with ip
DEBUG create_networks: looking up network named vagrant-libvirt
DEBUG create_networks: generating name for bridge
DEBUG create_networks: looking up bridge named virbr0
DEBUG create_networks: looking up bridge named virbr1
DEBUG create_networks: found available bridge name virbr1
DEBUG create_networks: created network
INFO create_networks: Saving information about created network vagrant-libvirt, UUID=71c9f6dd-4b2d-48f2-a787-5a0439d2e587 to file /home/eihli/code/vagrant_te$
t/.vagrant/machines/default/libvirt/created_networks.
INFO warden: Calling IN action: #<VagrantPlugins::ProviderLibvirt::Action::CreateNetworkInterfaces:0x0000560dfb42cae8>
INFO create_network_interfaces: Using vagrant-libvirt at 192.168.121.0/24 as the management network nat is the mode
DEBUG create_network_interfaces: In config found network type forwarded_port options {:guest=>22, :host=>2222, :host_ip=>"127.0.0.1", :id=>"ssh", :auto_correc$
=>true, :protocol=>"tcp"}
DEBUG create_network_interfaces: Adapter not specified so found slot 0
DEBUG create_network_interfaces: Found network by name
INFO create_network_interfaces: Creating network interface eth0 connected to network vagrant-libvirt.
INFO warden: Calling IN action: #<VagrantPlugins::ProviderLibvirt::Action::SetBootOrder:0x0000560dfb30af70>
INFO warden: Calling IN action: #<VagrantPlugins::ProviderLibvirt::Action::StartDomain:0x0000560dfafc46e0>
INFO interface: info: Starting domain.
INFO interface: info: ==> default: Starting domain.
==> default: Starting domain.
INFO warden: Calling IN action: #<VagrantPlugins::ProviderLibvirt::Action::WaitTillUp:0x0000560dfab82de8>
DEBUG wait_till_up: Searching for IP for MAC address: 52:54:00:62:61:1d
INFO interface: info: Waiting for domain to get an IP address...
INFO interface: info: ==> default: Waiting for domain to get an IP address...
==> default: Waiting for domain to get an IP address...
我使用 tshark -i virbr1
检查了 wireshark,但没有得到任何输出。我不确定我应该听哪个设备,所以我也检查了 tshark -i vnet0
,我确实得到了一些输出,但没有任何看起来与 DHCP 相关的东西。
下面是tshark -i vnet0
的输出
Capturing on 'vnet0'
1 0.000000000 fe80::fc54:ff:fe45:368d → ff02::fb MDNS 201 Standard query response 0x0000 PTR, cache flush Ophelia.local AAAA, cache flush fe80::fc54:ff:fe45:368d
2 0.745989853 fe:54:00:45:36:8d → Spanning-tree-(for-bridges)_00 STP 52 Conf. TC + Root = 32768/0/52:54:00:78:b4:d1 Cost = 0 Port = 0x8002
3 1.599338528 fe80::fc54:ff:fe45:368d → ff02::2 ICMPv6 70 Router Solicitation from fe:54:00:45:36:8d
4 2.190388300 fe80::fc54:ff:fe45:368d → ff02::fb MDNS 201 Standard query response 0x0000 PTR, cache flush Ophelia.local AAAA, cache flush fe80::fc54:ff:fe45:368d
5 2.666024617 fe:54:00:45:36:8d → Spanning-tree-(for-bridges)_00 STP 52 Conf. TC + Root = 32768/0/52:54:00:78:b4:d1 Cost = 0 Port = 0x8002
6 4.799357852 fe:54:00:45:36:8d → Spanning-tree-(for-bridges)_00 STP 52 Conf. TC + Root = 32768/0/52:54:00:78:b4:d1 Cost = 0 Port = 0x8002
下面是dmesg -w
从我vagrant up
到我ctrl-c
的结果
[ 2048.355424] virbr1: port 2(vnet0) entered disabled state
[ 2048.358280] device vnet0 left promiscuous mode
[ 2048.358287] virbr1: port 2(vnet0) entered disabled state
[ 2048.578278] device virbr1-nic left promiscuous mode
[ 2048.578287] virbr1: port 1(virbr1-nic) entered disabled state
[ 2059.394512] virbr1: port 1(virbr1-nic) entered blocking state
[ 2059.394516] virbr1: port 1(virbr1-nic) entered disabled state
[ 2059.394598] device virbr1-nic entered promiscuous mode
[ 2059.532014] virbr1: port 1(virbr1-nic) entered blocking state
[ 2059.532017] virbr1: port 1(virbr1-nic) entered listening state
[ 2059.567010] virbr1: port 1(virbr1-nic) entered disabled state
[ 2059.694140] virbr1: port 2(vnet0) entered blocking state
[ 2059.694156] virbr1: port 2(vnet0) entered disabled state
[ 2059.694377] device vnet0 entered promiscuous mode
[ 2059.695080] virbr1: port 2(vnet0) entered blocking state
[ 2059.695083] virbr1: port 2(vnet0) entered listening state
[ 2061.871278] virbr1: port 2(vnet0) entered learning state
[ 2064.004553] virbr1: port 2(vnet0) entered forwarding state
[ 2064.004555] virbr1: topology change detected, propagating
[ 2065.750798] kvm [5143]: vcpu0, guest rIP: 0xffffffff86061ce6 unhandled rdmsr: 0x140
[ 2065.821598] kvm [5143]: vcpu1, guest rIP: 0xffffffff86061ce6 unhandled rdmsr: 0x140
[ 2065.861278] kvm: zapping shadow pages for mmio generation wraparound
[ 2065.863039] kvm: zapping shadow pages for mmio generation wraparound
[ 2066.017675] kvm [5143]: vcpu0, guest rIP: 0xffffffff86061ce6 unhandled rdmsr: 0x34
[ 2068.941350] virbr1: port 2(vnet0) entered disabled state
[ 2068.943507] device vnet0 left promiscuous mode
[ 2068.943511] virbr1: port 2(vnet0) entered disabled state
[ 2069.163524] device virbr1-nic left promiscuous mode
[ 2069.163532] virbr1: port 1(virbr1-nic) entered disabled state
下面是 ip addr show
的输出(除了这是我第无数次 运行 vagrant up 每次虚拟网络接口的数量增加。
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: wlp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 3c:a9:f4:4c:7b:3c brd ff:ff:ff:ff:ff:ff
inet 10.7.74.120/18 brd 10.7.127.255 scope global dynamic noprefixroute wlp3s0
valid_lft 599674sec preferred_lft 599674sec
inet6 fe80::3d00:e921:d2e6:d9d5/64 scope link noprefixroute
valid_lft forever preferred_lft forever
3: enp0s25: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel state DOWN group default qlen 1000
link/ether 28:d2:44:17:62:46 brd ff:ff:ff:ff:ff:ff
34: virbr1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 52:54:00:ff:e1:a6 brd ff:ff:ff:ff:ff:ff
inet 192.168.121.1/24 brd 192.168.121.255 scope global virbr1
valid_lft forever preferred_lft forever
35: virbr1-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc fq_codel master virbr1 state DOWN group default qlen 1000
link/ether 52:54:00:ff:e1:a6 brd ff:ff:ff:ff:ff:ff
36: vnet0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel master virbr1 state UNKNOWN group default qlen 1000
link/ether fe:54:00:81:4a:63 brd ff:ff:ff:ff:ff:ff
inet6 fe80::fc54:ff:fe81:4a63/64 scope link
valid_lft forever preferred_lft forever
由于您使用的是 libvirt 提供程序,因此您应该能够使用 virt-manager
查看虚拟机的状态。
答案的其余部分是在以下两个假设下编写的:我的系统与您的系统没有太大不同,并且我 运行 使用 vagrant-libvirt 和 generic/arch (v1 .3.40)
在virt-manager中打开虚拟机,我发现系统无法检测到根文件系统,而且还紧急启动shell。这是因为 generic/arch 框提供的 initramfs-linux.img
不包含具有 QEMU/kvm 的 libvirt-provider 使用的默认设置所需的内核模块.
如果启动此框在某种程度上很重要,您应该能够使用后备映像启动此框,因为它可以ps 更多模块。要使其无需干预即可重新启动,您可以 运行 sudo mkinitcpio -p linux
在来宾中添加缺少的模块。或者,您也可以在主机上将 SCSI 控制器从 Hypervisor Defaults 更改为 VirtIO SCSI(例如,使用 virt-manager)。
对于更永久的解决方案(上述任何一项都不会在 vagrant destroy
之后继续存在),没有什么可做的 - 除了可能等待 "fixed" 释放盒子或 patching 插件。
ps。最简单的解决方案可能是选择另一个盒子(例如 archlinux/archlinux)。
就我而言,我有过于严格的 iptables
规则阻止了 Vagrant 通过 libvirt 为虚拟网桥 virbr*
设置的 NAT。
作为实验,我在启动 Vagrant 机器之前禁用了所有防火墙规则,它能够获取 IP 地址。
这似乎只有在我使用 generic/arch
框时才会发生。我已经尝试了几个 ubuntu 盒子,一切正常。
主持人 OS 是 Manjaro。
输出冻结:
INFO interface: info: ==> default: Waiting for domain to get an IP address...
==> default: Waiting for domain to get an IP address...
INFO retryable: Retryable exception raised: #<Fog::Errors::TimeoutError: The specified wait_for timeout (2 seconds) was exceeded>
libvirt/virsh 版本 3.10.0 流浪者版本 2.0.1
OS 4.9.76-1-MANJARO
流浪文件:
Vagrant.configure("2") do |config|
config.vm.box = "generic/arch"
end
以下是我认为相关输出来自 VAGRANT_LOG=debug vagrant up
==> default: Creating shared folders metadata...
INFO warden: Calling IN action: #<VagrantPlugins::ProviderLibvirt::Action::CreateNetworks:0x0000560dfaea3450>
INFO create_networks: Using vagrant-libvirt at 192.168.121.0/24 as the management network nat is the mode
DEBUG create_networks: In config found network type forwarded_port options {:guest=>22, :host=>2222, :host_ip=>"127.0.0.1", :id=>"ssh", :auto_correct=>true, :p
rotocol=>"tcp"}
DEBUG create_networks: Searching for network with options {:iface_type=>:private_network, :network_name=>"vagrant-libvirt", :ip=>"192.168.121.0", :netmask=>"25
5.255.255.0", :dhcp_enabled=>true, :forward_mode=>"nat", :guest_ipv6=>"yes", :autostart=>false}
/home/eihli/.vagrant.d/gems/2.4.3/gems/nokogiri-1.6.8.1/lib/nokogiri/xml/document.rb:44: warning: constant ::Fixnum is deprecated
DEBUG create_networks: looking up network with ip == 192.168.121.0
DEBUG create_networks: Checking that network name does not clash with ip
DEBUG create_networks: looking up network named vagrant-libvirt
DEBUG create_networks: generating name for bridge
DEBUG create_networks: looking up bridge named virbr0
DEBUG create_networks: looking up bridge named virbr1
DEBUG create_networks: found available bridge name virbr1
DEBUG create_networks: created network
INFO create_networks: Saving information about created network vagrant-libvirt, UUID=71c9f6dd-4b2d-48f2-a787-5a0439d2e587 to file /home/eihli/code/vagrant_te$
t/.vagrant/machines/default/libvirt/created_networks.
INFO warden: Calling IN action: #<VagrantPlugins::ProviderLibvirt::Action::CreateNetworkInterfaces:0x0000560dfb42cae8>
INFO create_network_interfaces: Using vagrant-libvirt at 192.168.121.0/24 as the management network nat is the mode
DEBUG create_network_interfaces: In config found network type forwarded_port options {:guest=>22, :host=>2222, :host_ip=>"127.0.0.1", :id=>"ssh", :auto_correc$
=>true, :protocol=>"tcp"}
DEBUG create_network_interfaces: Adapter not specified so found slot 0
DEBUG create_network_interfaces: Found network by name
INFO create_network_interfaces: Creating network interface eth0 connected to network vagrant-libvirt.
INFO warden: Calling IN action: #<VagrantPlugins::ProviderLibvirt::Action::SetBootOrder:0x0000560dfb30af70>
INFO warden: Calling IN action: #<VagrantPlugins::ProviderLibvirt::Action::StartDomain:0x0000560dfafc46e0>
INFO interface: info: Starting domain.
INFO interface: info: ==> default: Starting domain.
==> default: Starting domain.
INFO warden: Calling IN action: #<VagrantPlugins::ProviderLibvirt::Action::WaitTillUp:0x0000560dfab82de8>
DEBUG wait_till_up: Searching for IP for MAC address: 52:54:00:62:61:1d
INFO interface: info: Waiting for domain to get an IP address...
INFO interface: info: ==> default: Waiting for domain to get an IP address...
==> default: Waiting for domain to get an IP address...
我使用 tshark -i virbr1
检查了 wireshark,但没有得到任何输出。我不确定我应该听哪个设备,所以我也检查了 tshark -i vnet0
,我确实得到了一些输出,但没有任何看起来与 DHCP 相关的东西。
下面是tshark -i vnet0
Capturing on 'vnet0'
1 0.000000000 fe80::fc54:ff:fe45:368d → ff02::fb MDNS 201 Standard query response 0x0000 PTR, cache flush Ophelia.local AAAA, cache flush fe80::fc54:ff:fe45:368d
2 0.745989853 fe:54:00:45:36:8d → Spanning-tree-(for-bridges)_00 STP 52 Conf. TC + Root = 32768/0/52:54:00:78:b4:d1 Cost = 0 Port = 0x8002
3 1.599338528 fe80::fc54:ff:fe45:368d → ff02::2 ICMPv6 70 Router Solicitation from fe:54:00:45:36:8d
4 2.190388300 fe80::fc54:ff:fe45:368d → ff02::fb MDNS 201 Standard query response 0x0000 PTR, cache flush Ophelia.local AAAA, cache flush fe80::fc54:ff:fe45:368d
5 2.666024617 fe:54:00:45:36:8d → Spanning-tree-(for-bridges)_00 STP 52 Conf. TC + Root = 32768/0/52:54:00:78:b4:d1 Cost = 0 Port = 0x8002
6 4.799357852 fe:54:00:45:36:8d → Spanning-tree-(for-bridges)_00 STP 52 Conf. TC + Root = 32768/0/52:54:00:78:b4:d1 Cost = 0 Port = 0x8002
下面是dmesg -w
从我vagrant up
到我ctrl-c
[ 2048.355424] virbr1: port 2(vnet0) entered disabled state
[ 2048.358280] device vnet0 left promiscuous mode
[ 2048.358287] virbr1: port 2(vnet0) entered disabled state
[ 2048.578278] device virbr1-nic left promiscuous mode
[ 2048.578287] virbr1: port 1(virbr1-nic) entered disabled state
[ 2059.394512] virbr1: port 1(virbr1-nic) entered blocking state
[ 2059.394516] virbr1: port 1(virbr1-nic) entered disabled state
[ 2059.394598] device virbr1-nic entered promiscuous mode
[ 2059.532014] virbr1: port 1(virbr1-nic) entered blocking state
[ 2059.532017] virbr1: port 1(virbr1-nic) entered listening state
[ 2059.567010] virbr1: port 1(virbr1-nic) entered disabled state
[ 2059.694140] virbr1: port 2(vnet0) entered blocking state
[ 2059.694156] virbr1: port 2(vnet0) entered disabled state
[ 2059.694377] device vnet0 entered promiscuous mode
[ 2059.695080] virbr1: port 2(vnet0) entered blocking state
[ 2059.695083] virbr1: port 2(vnet0) entered listening state
[ 2061.871278] virbr1: port 2(vnet0) entered learning state
[ 2064.004553] virbr1: port 2(vnet0) entered forwarding state
[ 2064.004555] virbr1: topology change detected, propagating
[ 2065.750798] kvm [5143]: vcpu0, guest rIP: 0xffffffff86061ce6 unhandled rdmsr: 0x140
[ 2065.821598] kvm [5143]: vcpu1, guest rIP: 0xffffffff86061ce6 unhandled rdmsr: 0x140
[ 2065.861278] kvm: zapping shadow pages for mmio generation wraparound
[ 2065.863039] kvm: zapping shadow pages for mmio generation wraparound
[ 2066.017675] kvm [5143]: vcpu0, guest rIP: 0xffffffff86061ce6 unhandled rdmsr: 0x34
[ 2068.941350] virbr1: port 2(vnet0) entered disabled state
[ 2068.943507] device vnet0 left promiscuous mode
[ 2068.943511] virbr1: port 2(vnet0) entered disabled state
[ 2069.163524] device virbr1-nic left promiscuous mode
[ 2069.163532] virbr1: port 1(virbr1-nic) entered disabled state
下面是 ip addr show
的输出(除了这是我第无数次 运行 vagrant up 每次虚拟网络接口的数量增加。
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: wlp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 3c:a9:f4:4c:7b:3c brd ff:ff:ff:ff:ff:ff
inet 10.7.74.120/18 brd 10.7.127.255 scope global dynamic noprefixroute wlp3s0
valid_lft 599674sec preferred_lft 599674sec
inet6 fe80::3d00:e921:d2e6:d9d5/64 scope link noprefixroute
valid_lft forever preferred_lft forever
3: enp0s25: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel state DOWN group default qlen 1000
link/ether 28:d2:44:17:62:46 brd ff:ff:ff:ff:ff:ff
34: virbr1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 52:54:00:ff:e1:a6 brd ff:ff:ff:ff:ff:ff
inet 192.168.121.1/24 brd 192.168.121.255 scope global virbr1
valid_lft forever preferred_lft forever
35: virbr1-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc fq_codel master virbr1 state DOWN group default qlen 1000
link/ether 52:54:00:ff:e1:a6 brd ff:ff:ff:ff:ff:ff
36: vnet0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel master virbr1 state UNKNOWN group default qlen 1000
link/ether fe:54:00:81:4a:63 brd ff:ff:ff:ff:ff:ff
inet6 fe80::fc54:ff:fe81:4a63/64 scope link
valid_lft forever preferred_lft forever
由于您使用的是 libvirt 提供程序,因此您应该能够使用 virt-manager
查看虚拟机的状态。
答案的其余部分是在以下两个假设下编写的:我的系统与您的系统没有太大不同,并且我 运行 使用 vagrant-libvirt 和 generic/arch (v1 .3.40)
在virt-manager中打开虚拟机,我发现系统无法检测到根文件系统,而且还紧急启动shell。这是因为 generic/arch 框提供的 initramfs-linux.img
不包含具有 QEMU/kvm 的 libvirt-provider 使用的默认设置所需的内核模块.
如果启动此框在某种程度上很重要,您应该能够使用后备映像启动此框,因为它可以ps 更多模块。要使其无需干预即可重新启动,您可以 运行 sudo mkinitcpio -p linux
在来宾中添加缺少的模块。或者,您也可以在主机上将 SCSI 控制器从 Hypervisor Defaults 更改为 VirtIO SCSI(例如,使用 virt-manager)。
对于更永久的解决方案(上述任何一项都不会在 vagrant destroy
之后继续存在),没有什么可做的 - 除了可能等待 "fixed" 释放盒子或 patching 插件。
ps。最简单的解决方案可能是选择另一个盒子(例如 archlinux/archlinux)。
就我而言,我有过于严格的 iptables
规则阻止了 Vagrant 通过 libvirt 为虚拟网桥 virbr*
设置的 NAT。
作为实验,我在启动 Vagrant 机器之前禁用了所有防火墙规则,它能够获取 IP 地址。