Public bug reported:
Hello, I'm using the NoCloud data source to spawn a ubuntu cloud image
locally with KVM. Unfortunattely the network configuration fails because
cloud-init pre-networking tasks try to find and match some netdevs but
fails because the netdevs aren't yet available in udev/kernel. So Here
is my configurations
# cat nocloud/meta-data
dsmode: local
instance-id: 2
local-hostname: vm1
public-keys:
- ssh-rsa B3NzaC1yc2EA
# cat nocloud/user-data
#cloud-config
password: pass
chpasswd: { expire: False }
ssh_pwauth: True
cat nocloud/network-config
---
version: 2
ethernets:
ens2:
match:
macaddress: 52:54:00:10:00:02
set-name: ens2
dhcp4: false
addresses:
- 172.16.0.2/24
gateway4: 172.16.0.1
nameservers:
addresses: [1.1.1.1]
routes:
- to: 0.0.0.0/0
via: 172.16.0.1
Then I generate a seed iso file with:
# cloud-localds -N nocloud/network-config
/var/lib/libvirt/qemu/images/${NAME}_seed.iso nocloud/user-data
nocloud/meta-data
After then I boot my cloud IMG with the following cmd:
# virt-install -n vm1 \
-r 2048 \
--disk /var/lib/libvirt/qemu/images/vm1.img,format=qcow2,bus=virtio \
--disk
path=/var/lib/libvirt/qemu/images/vm1_seed.iso,device=cdrom,format=raw \
--vcpus 2 \
--network network=mgmt,model=virtio,mac=52:54:00:10:00:02 \
--console pty,target_type=serial \
--graphics none \
--os-type Linux \
--virt-type kvm
The boot process starts and fails in at:
Starting Initial cloud-init job (pre-networking)...
[ 10.576931] cloud-init[505]: Cloud-init v.
19.4-33-gbb4131a2-0ubuntu1~19.10.1 running 'init-local' at Sun, 19 Apr 2020
14:58:04 +. Up 10.25 seconds.
[ 10.596843] cloud-init[505]: 2020-04-19 14:58:04,934 - __init__.py[WARNING]:
Not all expected physical devices present: {41135076002}
[ 10.610726] cloud-init[505]: 2020-04-19 14:58:04,934 - util.py[WARNING]:
failed stage init-local
[ 10.621881] cloud-init[505]: failed run of stage init-local
[ 10.628546] cloud-init[505]:
[ 10.637686] cloud-init[505]: Traceback (most recent call last):
[ 10.645067] cloud-init[505]: File
"/usr/lib/python3/dist-packages/cloudinit/cmd/main.py", line 653, in
status_wrapper
[ 10.656896] cloud-init[FAILED] Failed to start Initial cloud-init job
(pre-networking).
See 'systemctl status cloud-init-local.service' for details.
[ OK ] Reached target Network (Pre).
Starting Network Service...
[505]: ret = functor(name, args)
[ 10.685958] cloud-init[505]: File
"/usr/lib/python3/dist-packages/cloudinit/cmd/main.py", line 362, in main_init
[ 10.696814] cloud-init[505]:
init.apply_network_config(bring_up=bool(mode != sources.DSMODE_LOCAL))
[ 10.707178] cloud-init[505]: File
"/usr/lib/python3/dist-packages/cloudinit/stages.py", line 701, in
apply_network_config
[ 10.720032] cloud-init[505]: net.wait_for_physdevs(netcfg)
[ 10.727486] cloud-init[505]: File
"/usr/lib/python3/dist-packages/cloudinit/net/__init__.py", line 545, in
wait_for_physdevs
[ 10.739150] cloud-init[505]: raise RuntimeError(msg)
[ 10.745586] cloud-init[505]: RuntimeError: Not all expected physical devices
present: {41135076002}
[ 10.753007] cloud-init[505]:
[ OK ] Started Network Service.
Starting Wait for Network to be Configured...
Starting Network Name Resolution...
[ OK ] Started Wait for Network to be Configured.
Starting Initial cloud-iniā¦ (metadata service crawler)...
[ OK ] Started Network Name Resolution.
[ OK ] Reached target Network.
[ OK ] Reached target Host and Network Name Lookups.
Then cloud-init detects the available interfaces:
[ 11.723035] cloud-init[532]: Cloud-init v.
19.4-33-gbb4131a2-0ubuntu1~19.10.1 running 'init' at Sun, 19 Apr 2020 14:58:05
+. Up 11.62 seconds.
[ 11.740394] cloud-init[532]: ci-info: +++Net device
info
[ 11.749182] cloud-init[532]: ci-info:
++---+---+---+---+---+
[ 11.757170] cloud-init[532]: ci-info: | Device | Up | Address |Mask
| Scope | Hw-Address|
[ 11.765835] cloud-init[532]: ci-info:
++---+---+---+---+---+
[ 11.775842] cloud-init[532]: ci-info: | ens2 | False | . | .
| . | 52:54:00:10:00:02 |
[ 11.785441] cloud-init[532]: ci-info: | lo | True | 127.0.0.1 |
255.0.0.0 | host | . |
[ 11.794634] cloud-init[532]: ci-info: | lo | True | ::1/128 | .
| host | . |
[ 11.805821] cloud-init[532]: ci-info:
++---+---+---+---+---+
[ 11.815098] cloud-init[532]: ci-info: +++Route IPv6
info+++
[ 11.823037] cloud-init[532]: ci-info: