I created a VM using vmbuilder
and it failed to bring up the network interface. I was able to log into the VM using Virtual Machine Manager and saw that the interface in /etc/network/interfaces
was eth0
, but in networkctl
was ens3
(a Predictable Network Interface Name). I looked at /var/log/syslog
and found
Oct 17 19:26:43 servername kernel: [ 1.314794] virtio_net virtio0 ens3: renamed from eth0
Oct 17 19:26:43 servername ifup[394]: Cannot find device "eth0"
Oct 17 19:26:43 servername ifup[394]: Failed to bring up eth0.
Oct 17 19:26:43 servername systemd[1]: networking.service: Main process exited, code=exited, status=1/FAILURE
Oct 17 19:26:43 servername systemd[1]: Failed to start Raise network interfaces.
Oct 17 19:26:43 servername systemd[1]: networking.service: Unit entered failed state.
Oct 17 19:26:43 servername systemd[1]: networking.service: Failed with result 'exit-code'.
among the other log entries.
The following are empty or don't exist:
GRUB_CMDLINE_LINUX=""
in/etc/default/grub
(andGRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
)/etc/udev/rules.d/70-persistent-net.rules
/lib/udev/rules.d/75-persistent-net-generator.rules
Here are the interfaces:
$ ls -l /sys/class/net
total 0
lrwxrwxrwx 1 root root 0 Oct 17 20:36 ens3 -> ../../devices/pci0000:00/0000:00:03.0/virtio0/net/ens3
lrwxrwxrwx 1 root root 0 Oct 17 20:36 lo -> ../../devices/virtual/net/lo
Here is the vmbuilder
command line I used:
sudo vmbuilder kvm ubuntu --suite xenial --templates /homes/administrator/vmfiles \
--hostname servername --dest ./servername --rootsize 200000 --mem 16384 \
--ip 1.1.1.1 --dns 1.1.1.1 --gw 1.1.1.1 --bridge br0 \
--network=bridge:br0 --timezone=America/Chicago --libvirt qemu:///system \
--user USER --name USER --pass PASSWORD \
--ssh-user-key /homes/USER/.ssh/authorized_keys \
--addpkg linux-image-generic --addpkg openssh-server \
--addpkg unattended-upgrades --addpkg python-apt --copy vmfiles/copyspecs
As a test, I changed /etc/network/interfaces
to refer to ens3
and I was able to bring up the interface.
I'm fine with using Predictable Names, but how do I solve this mismatch?