I use Vagrant with the vagrant-libvirt plugin on my Arch Linux host quite extensively to quickly spin up dev and lab environments. The plugin’s development is mature and generally feature-complete, but the latest release was June 24, 2023. In the meantime, multiple commits were added to the main branch.

I use the following process rather than the standard installation sourced from RubyGems .

Prerequisites

Verify these Arch packages are installed:

pacman -Q git vagrant dnsmasq iptables-nft libvirt qemu-base bridge-utils ruby pkgconf gcc make

Steps

  1. Open your favorite terminal emulator.

  2. Uninstall the existing vagrant-libvirt plugin (if required).

vagrant plugin uninstall vagrant-libvirt
  1. Clone the vagrant-libvirt repo from GitHub.
git clone https://github.com/vagrant-libvirt/vagrant-libvirt.git
  1. Change to the vagrant-libvirt directory.
cd vagrant-libvirt
  1. Edit the driver.rb file.
vim lib/vagrant-libvirt/driver.rb
  1. Remove the ip_command variable and the libvirt_ip_command key that references it.
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
        # Get config options for Libvirt provider.
        config = @machine.provider_config
        uri = config.uri

-       # Setup command for retrieving IP address for newly created machine
-       # with some MAC address. Get it from dnsmasq leases table
-       ip_command = %q( awk "/$mac/ {print \$1}" /proc/net/arp )
-
        conn_attr = {
          provider: 'libvirt',
          libvirt_uri: uri,
-         libvirt_ip_command: ip_command,
        }
        conn_attr[:libvirt_username] = config.username if config.username
        conn_attr[:libvirt_password] = config.password if config.password
  1. Build the vagrant-libvirt plugin.
gem build
  1. Install the vagrant-libvirt plugin.
VAGRANT_DISABLE_STRICT_DEPENDENCY_ENFORCEMENT=1 vagrant plugin install ./vagrant-libvirt-*.gem