(Last Updated On: May 4, 2019)

I got an error message “Failed to initialize a valid firewall backend” on my Arch Linux machine while trying to create Virtual Machines on KVM using Libvirt. You’ll often get this error as a result of missed dependency during KVM installation on Arch Linux / Manjaro or similar line of distributions.

I edited our guide for installation of KVM on Arch Linux/Manjaro to include all required dependencies. The solution to this error is installing iptables, dnsmasq and ebtables packages.

sudo pacman -S ebtables iptables dnsmasq

You can check package details using the command:

$ sudo pacman -Qi ebtables iptables dnsmasq
Name            : ebtables
Version         : 2.0.10_4-7
Description     : Ethernet bridge filtering utilities
Architecture    : x86_64
URL             : http://ebtables.sourceforge.net/
Licenses        : GPL2
Groups          : None
Provides        : None
Depends On      : perl  bash  iptables
Optional Deps   : None
Required By     : None
Optional For    : libvirt
Conflicts With  : None
Replaces        : None
Installed Size  : 415.00 KiB
Packager        : Evangelos Foutras <[email protected]>
Build Date      : Sat 10 Nov 2018 02:34:17 AM EAT
Install Date    : Fri 19 Apr 2019 08:39:37 AM EAT
Install Reason  : Explicitly installed
Install Script  : Yes
Validated By    : Signature

Name            : iptables
Version         : 1:1.8.2-1
Description     : Linux kernel packet control tool (using legacy interface)
Architecture    : x86_64
URL             : https://www.netfilter.org/projects/iptables/index.html
Licenses        : GPL2
Groups          : None
Provides        : None
Depends On      : libnftnl  libpcap  libnfnetlink  libnetfilter_conntrack  bash
Optional Deps   : None
Required By     : ebtables  iproute2  libvirt  systemd
Optional For    : None
Conflicts With  : None
Replaces        : None
Installed Size  : 2.44 MiB
Packager        : Jan Alexander Steffens (heftig) <[email protected]>
Build Date      : Tue 13 Nov 2018 06:11:57 PM EAT
Install Date    : Fri 19 Apr 2019 08:39:37 AM EAT
Install Reason  : Installed as a dependency for another package
Install Script  : No
Validated By    : Signature

Name            : dnsmasq
Version         : 2.80-3
Description     : Lightweight, easy to configure DNS forwarder and DHCP server
Architecture    : x86_64
URL             : http://www.thekelleys.org.uk/dnsmasq/doc.html
Licenses        : GPL
Groups          : None
Provides        : None
Depends On      : glibc  gmp  libidn2  libdbus  libnetfilter_conntrack  nettle
Optional Deps   : None
Required By     : None
Optional For    : libvirt  networkmanager
Conflicts With  : None
Replaces        : None
Installed Size  : 739.00 KiB
Packager        : Felix Yan <[email protected]>
Build Date      : Sun 10 Feb 2019 05:58:50 AM EAT
Install Date    : Fri 19 Apr 2019 08:34:11 AM EAT
Install Reason  : Explicitly installed
Install Script  : No
Validated By    : Signature

Once the installation is done, you need to restart libvirtd service.

sudo sudo systemctl restart libvirtd

If you have Virtual Machine Manager running, close it then re-open.

Test by checking your active Qemu networks.

$ virsh net-list --all    
 Name              State      Autostart   Persistent
------------------------------------------------------
 br10              active     yes         yes
 default           active     yes         yes
 docker-machines   active     yes         yes
 fed290            inactive   no          yes
 vagrant-libvirt   inactive   no          yes

Start a network and it should be successful.

$ virsh net-start vagrant-libvirt       
Network vagrant-libvirt started

There you go!. Here are similar KVM articles:

Using Vagrant with Libvirt on Linux.

How to Create CentOS / Fedora / RHEL VM Templates on KVM

How to Provision VMs on KVM with Terraform

How to Create and Configure Bridge Networking For KVM in Linux