18.04: VM fails to start due to management_network assuming non-existent interface eth0
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
vagrant-libvirt |
New
|
Unknown
|
|||
vagrant-libvirt (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
In trying to launch a standard ubuntu/bionic64 Vagrant box on 18.04 LTS I found it fails with the report:
Call to virDomainCreate
which is directly from libvirt (same error in syslog).
For many hours I thought it was due to my not getting a config.vm.network :public_network, ... statement correct in Vagrantfile. Finally I commented it out and the error still occurred!
At that point I realised the culprit is the 'hidden' management_network configuration. I dived into the source-code and see that there is no attribute exposed to set the @device value and therefore it uses the default of "eth0":
lib/vagrant-
This is becoming even more of an issue now that most distributions are using systemd/udevd > v197 "Predictable Network Interface Names" ( https:/
It is definitely something to be solved in this module rather than requiring what could be disruptive changes to the host configuration via kernel command-line net.ifnames=0 biosdevname=0.
This needs documenting as a gotcha up-front for newcomers especially (in docs and in the generated Vagrantfile) and an attribute provided to over-ride the interface device name at a minimum.
It would be preferable to detect the host's interface. Manually that is achieved with:
brctl show $(virsh net-info vagrant-libvirt | awk '/^Bridge:/{print $2}' ) | awk 'NR != 1{print $4}'
I did try working around it using an alias, but that isn't exposed in any useful way as an alternate name, as in:
sudo ip link set virbr1-nic alias eth0
Upstream have added an attribute to control @device since:
commit 7f50ca2
Author: qazokm <email address hidden>
Date: Fri Feb 23 12:09:49 2018 +0800
Add basic networking support for qemu session
which has added this among many other additions:
@management_
@system_uri = 'qemu:///system' if @system_uri == UNSET_VALUE
Changed in vagrant-libvirt: | |
status: | Unknown → New |
tags: | added: bionic |
I'm currently working around it by bind-mounting the upstream source over the Ubuntu package thus:
mkdir -p /home/all/ SourceCode/ vagrant Sourcecode/ vagrant /github. com/vagrant- libvirt/ vagrant- libvirt. git SourceCode/ vagrant/ vagrant- libvirt /usr/share/ rubygems- integration/ all/gems/ vagrant- libvirt- 0.0.43
cd /home/all/
git clone https:/
sudo mount --bind /home/all/
After this I can use management_ network_ device in the Vagrantfile. E.g.:
Vagrant. configure( "2") do |config|
# tactyle. vm.synced_ folder "../data", "/vagrant_data"
tactyle. ssh.insert_ key = false
end
Alas, although the VM now starts, it fails in the initramfs and drops to the shell due to the root fs block device missing!