Error failed to start network default

This tutorial will ensure you have a running default network on your KVM server.

Run the steps below if you ever get this message:

ERROR    Requested operation is not valid: network 'default' is not active

Steps

Stage 1

First check if you have the network defined by running:

sudo virsh net-list --all

If you got the following output then proceed to «Stage 1 — Create the Default Network». If you don’t and the network exists, proceed to «Stage 2 — Start and autostart the network».

 Name                 State      Autostart     Persistent
----------------------------------------------------------

Stage 1 — Create the Default Network

Create the default network by copy-pasting the following lines into a file called default.xml.

<network>
  <name>default</name>
  <uuid>9a05da11-e96b-47f3-8253-a3a482e445f5</uuid>
  <forward mode='nat'/>
  <bridge name='virbr0' stp='on' delay='0'/>
  <mac address='52:54:00:0a:cd:21'/>
  <ip address='192.168.122.1' netmask='255.255.255.0'>
    <dhcp>
      <range start='192.168.122.2' end='192.168.122.254'/>
    </dhcp>
  </ip>
</network>

Now to add that network permanently to our KVM host, run the following:

sudo virsh net-define --file default.xml

Stage 2 — Start and autostart the network

To manually start the network run:

sudo virsh net-start default

To have the network automatically start up in future run:

sudo virsh net-autostart --network default

Debugging

Failed To Initializae Firewall Backend

Kris Maussen has kindly pointed out in the comments that if you get the following error messages:

error: Failed to start network default
error: internal error: Failed to initialize a valid firewall backend

You will need to install firewalld.

sudo apt update && sudo apt install firewalld -y

Now run the following commands in order to enable the service and make networking work again:

sudo systemctl enable --now firewalld
sudo systemctl restart libvirtd

DnsMasq Issue

If you get the following error:

error: Failed to start network default
error: Cannot check dnsmasq binary /usr/sbin/dnsmasq: No such file or directory

Just install dnsmasq.

sudo apt-get install dnsmasq -y

Last updated: 16th September 2021
First published: 16th August 2018

Is this a BUG REPORT or FEATURE REQUEST? (choose one): BUG REPORT

Minikube version (use minikube version): v0.12.2

Environment:

  • OS (e.g. from /etc/os-release): Debian GNU/Linux stretch/sid
  • VM Driver (e.g. cat ~/.minikube/machines/minikube/config.json | grep DriverName): kvm
  • Docker version (e.g. docker -v): 1.12.3
  • Install tools: ???
  • Others:

What happened:

# minikube start 
                 --vm-driver=kvm 
                 --container-runtime=rkt
[... failed ...]
# sudo apt install libvirt-clients
[...]
# minikube start 
                 --vm-driver=kvm 
                 --container-runtime=rkt
[... failed ...]
# sudo apt install libvirt-daemon libvirt-daemon-system
[...]
[libvirtd could not access KVM, due to permission issues, thus:]
# reboot
[...]
# minikube start 
                 --vm-driver=kvm 
                 --network-plugin=cni 
                 --container-runtime=rkt 
                 --iso-url=http://storage.googleapis.com/minikube/iso/buildroot/minikube-v0.0.6.iso
Starting local Kubernetes cluster...
Downloading Minikube ISO
 68.79 MB / 68.79 MB [==============================================] 100.00% 0s
E1118 13:37:13.086967    7590 start.go:92] Error starting host: Error creating host: Error creating machine: Error in driver during machine creation: [Code-55] [Domain-19] Requested operation is not valid: network 'default' is not active. Retrying.
E1118 13:37:13.087235    7590 start.go:98] Error starting host:  Error creating host: Error creating machine: Error in driver during machine creation: [Code-55] [Domain-19] Requested operation is not valid: network 'default' is not active
================================================================================
An error has occurred. Would you like to opt in to sending anonymized crash
information to minikube to help prevent future errors?
To opt out of these messages, run the command:
        minikube config set WantReportErrorPrompt false
================================================================================
Please enter your response [Y/n]:

Please note that I never get a chance to actually respond to the «report error» question. The console prompt was already flashing on the next line, which leads me to believe that the report was sent without my consent.

What you expected to happen:

Minikube should have started Kubernetes using KVM and created any missing networks.

How to reproduce it (as minimally and precisely as possible):

Hopefully the information given above is enough to reproduce it on a Debian 9.0 «Stretch» installation.

Anything else do we need to know:

There appear to be no networks configured in libvirt right now:

# virsh net-list
 Name                 State      Autostart     Persistent
----------------------------------------------------------

  • Index
  • » Applications & Desktop Environments
  • » libvirt via virt-manager virtual network start failed

Pages: 1

#1 2015-06-17 03:53:41

shenhd
Member
Registered: 2015-06-17
Posts: 4

libvirt via virt-manager virtual network start failed

virt-manager v1.2.1
libvirtd v1.2.16

I tested firewall: iptables && ip6tables work well while.

when I start a virtual network named ‘default’ (created by libvirt), it occur that:
«Error starting network ‘default’: internal error: Failed to initialize a valid firewall backend».

thanks for any reply

Last edited by shenhd (2015-06-17 03:56:45)

#2 2015-06-17 14:37:03

Bestiapeluda
Member
From: Buenos Aires, Argentina
Registered: 2007-10-16
Posts: 181

Re: libvirt via virt-manager virtual network start failed

I’m having exactly the same problem.

#3 2015-06-18 14:34:11

rob356
Member
Registered: 2010-12-31
Posts: 8

Re: libvirt via virt-manager virtual network start failed

I had the same problem, but with vagrant and the libvirt provider. I fixed it temporarily by re-building libvirt with a patch that removes the code that throws that error. It looks like in an attempt to fix this bug they went overboard checking if a valid firewall backend was loaded. I commented out that section and everything seems to work fine. Obviously this is not a permanent fix, but I don’t know enough about libvirt’s codebase to fix it properly. Anyways here is the patch:

--- libvirt-1.2.16.orig/src/util/virfirewall.c  2015-05-23 08:56:12.000000000 -0400
+++ libvirt-1.2.16.new/src/util/virfirewall.c   2015-06-18 10:01:51.954157612 -0400
@@ -932,14 +932,14 @@
 
     virMutexLock(&ruleLock);
 
-    if (currentBackend == VIR_FIREWALL_BACKEND_AUTOMATIC) {
+//    if (currentBackend == VIR_FIREWALL_BACKEND_AUTOMATIC) {
         /* a specific backend should have been set when the firewall
          * object was created. If not, it means none was found.
          */
-        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                       _("Failed to initialize a valid firewall backend"));
-        goto cleanup;
-    }
+//        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+//                       _("Failed to initialize a valid firewall backend"));
+//        goto cleanup;
+//    }
     if (!firewall || firewall->err == ENOMEM) {
         virReportOOMError();
         goto cleanup;

#4 2015-06-18 15:39:52

Basic-Master
Member
Registered: 2007-10-30
Posts: 21

Re: libvirt via virt-manager virtual network start failed

Had the same problem, but I was able to fix it. Just install the dependencies required by firewalld and that error message is hopefully gone wink IIRC you need iptables and ebtables, and perhaps a few more…

#5 2015-06-23 10:00:47

shenhd
Member
Registered: 2015-06-17
Posts: 4

Re: libvirt via virt-manager virtual network start failed

Basic-Master wrote:

Had the same problem, but I was able to fix it. Just install the dependencies required by firewalld and that error message is hopefully gone wink IIRC you need iptables and ebtables, and perhaps a few more…

thx!!! The problem is solved.

#6 2015-06-23 10:01:55

shenhd
Member
Registered: 2015-06-17
Posts: 4

Re: libvirt via virt-manager virtual network start failed

rob356 wrote:

I had the same problem, but with vagrant and the libvirt provider. I fixed it temporarily by re-building libvirt with a patch that removes the code that throws that error. It looks like in an attempt to fix this bug they went overboard checking if a valid firewall backend was loaded. I commented out that section and everything seems to work fine. Obviously this is not a permanent fix, but I don’t know enough about libvirt’s codebase to fix it properly. Anyways here is the patch:

--- libvirt-1.2.16.orig/src/util/virfirewall.c  2015-05-23 08:56:12.000000000 -0400
+++ libvirt-1.2.16.new/src/util/virfirewall.c   2015-06-18 10:01:51.954157612 -0400
@@ -932,14 +932,14 @@
 
     virMutexLock(&ruleLock);
 
-    if (currentBackend == VIR_FIREWALL_BACKEND_AUTOMATIC) {
+//    if (currentBackend == VIR_FIREWALL_BACKEND_AUTOMATIC) {
         /* a specific backend should have been set when the firewall
          * object was created. If not, it means none was found.
          */
-        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                       _("Failed to initialize a valid firewall backend"));
-        goto cleanup;
-    }
+//        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+//                       _("Failed to initialize a valid firewall backend"));
+//        goto cleanup;
+//    }
     if (!firewall || firewall->err == ENOMEM) {
         virReportOOMError();
         goto cleanup;

thx! however, @Basic-Master ‘s solution is better.

#7 2015-07-21 16:19:40

mostafaa91
Member
Registered: 2015-07-21
Posts: 3

Re: libvirt via virt-manager virtual network start failed

Can you please tell me which dependencies were that ?
cause i have these installed and i am still facing the same problem

Thank you

#8 2015-07-21 16:23:47

shenhd
Member
Registered: 2015-06-17
Posts: 4

Re: libvirt via virt-manager virtual network start failed

mostafaa91 wrote:

Can you please tell me which dependencies were that ?
cause i have these installed and i am still facing the same problem

Thank you

you should install firewalld, and start it. It will work!!! :-)

#9 2015-07-22 06:09:31

mostafaa91
Member
Registered: 2015-07-21
Posts: 3

Re: libvirt via virt-manager virtual network start failed

shenhd wrote:

mostafaa91 wrote:

Can you please tell me which dependencies were that ?
cause i have these installed and i am still facing the same problem

Thank you

you should install firewalld, and start it. It will work!!! :-)

Thanks for answering smile

But the problem seems to be the same :

╰─$ systemctl status firewalld                                                                                                                                                                                                                                                1 ↵
● firewalld.service — firewalld — dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: disabled)
   Active: active (running) since Wed 2015-07-22 08:00:06 EET; 40s ago
Main PID: 27760 (firewalld)
   CGroup: /system.slice/firewalld.service
           └─27760 /usr/bin/python -Es /usr/bin/firewalld —nofork —nopid

Jul 22 08:00:06 St0rM.local systemd[1]: Starting firewalld — dynamic firewall daemon…
Jul 22 08:00:06 St0rM.local systemd[1]: Started firewalld — dynamic firewall daemon.

╭─root@St0rM  ~ 
╰─$ virsh net-start default                                                                                                                                                                                                                                                   1 ↵
error: Failed to start network default
error: internal error: Failed to initialize a valid firewall backend

#10 2015-07-22 07:48:00

rubenvb
Member
Registered: 2011-01-14
Posts: 98

Re: libvirt via virt-manager virtual network start failed

Have you tried installing the libvirt server dependencies as mentioned on the Wiki?

# pacman -Syu ebtables dnsmasq

This did the trick for me. Make sure to restart the libvirtd service and virt-manager after installing these.

#11 2015-07-22 22:52:06

mostafaa91
Member
Registered: 2015-07-21
Posts: 3

Re: libvirt via virt-manager virtual network start failed

rubenvb wrote:

Have you tried installing the libvirt server dependencies as mentioned on the Wiki?

# pacman -Syu ebtables dnsmasq

This did the trick for me. Make sure to restart the libvirtd service and virt-manager after installing these.

Thank you , that seems to work just fine smile

I had this error when starting a kvm vm : “Virtual network ‘default’ has not been started”. It was related to the docker service.

After trying basic things like restarting the service( service libvirtd restart) and checking errors in dmesg, i tried to start manually the network :

[root@rhel6 ~]# virsh net-start default
error: Failed to start network default
error: Unable to set bridge virbr0 forward_delay: Read-only file system

And getting information on the newtork :

[root@rhel6 ~]# virsh net-info default
Name default
UUID f4f6e3c0-2319-4aef-b030-8eb4007c391d
Active: no
Persistent: yes
Autostart: yes
Bridge: virbr0

All seemed right except this read-only permission error. i tried to disable selinux but no luck. After some googling, i found it was related to docker starting before libvirtd.

First at service level :

[root@rhel6 ~]# chkconfig --list|egrep "docker|libvirt"
docker 0:off 1:off 2:on 3:on 4:on 5:on 6:off
libvirt-guests 0:off 1:off 2:on 3:on 4:on 5:on 6:off
libvirtd 0:off 1:off 2:off 3:on 4:on 5:on 6:off

So by default, dokcer is started at runlevel 2 but it’s also started before libvirtd.

[root@rhel6 ~]# egrep "# chkconfig" /etc/init.d/libvirtd /etc/init.d/docker
/etc/init.d/libvirtd:# chkconfig: 345 97 03
/etc/init.d/docker:# chkconfig: 2345 95 95

The best solution is to override the default chkconfig parameters :

echo "# chkconfig: 345 98 95" > /etc/chkconfig.d/docker

And it’s enough to have libvirt and docker playing nicely together on RHEL 6 :)

Checking it with ifconfig :

[root@rhel6 ~]# ~/Desktop ifconfig virbr0
virbr0 Link encap:Ethernet HWaddr 52:54:00:15:40:34
          inet addr:192.168.122.1 Bcast:192.168.122.255 Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)

[root@rhel6 ~]# ~/Desktop ifconfig docker0
docker0 Link encap:Ethernet HWaddr FA:27:91:8A:CE:8D
          inet addr:172.17.42.1 Bcast:0.0.0.0 Mask:255.255.0.0
          UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
          RX packets:2 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:80 (80.0 b) TX bytes:0 (0.0 b)

Понравилась статья? Поделить с друзьями:
  • Error failed to send host log message linux
  • Error failed to scan file что это
  • Error failed to save to the destination store
  • Error failed to run repack
  • Error failed to run jetifier