解决在Arch Linux/Manjaro上libvirt:"无法初始化有效的防火墙后端"

时间:2020-02-23 14:40:30  来源:igfitidea点击:

在KVM上创建虚拟机时 ,报错
“Failed to initialize a valid firewall backend”

此错误的解决方案是要安装iptables,dnsmasq和Ebtables软件包。

sudo pacman -S ebtables iptables dnsmasq

我们可以使用该命令查看包详细信息:

$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 <Hyman@theitroad>
Build Date      : Sat 10 Nov 2016 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) <Hyman@theitroad>
Build Date      : Tue 13 Nov 2016 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 <Hyman@theitroad>
Build Date      : Sun 10 Nov 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

完成安装后,我们需要重新启动LibVirtd服务。

sudo sudo systemctl restart libvirtd

如果我们有虚拟机管理器运行,请关闭它然后重新打开。

通过检查活动QEMU网络进行测试。

$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

启动网络,它应该成功。

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