Virbr0 device is always down

Bug #1997125 reported by A
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
gnome-boxes (Ubuntu)
New
Undecided
Unassigned
libvirt (Ubuntu)
Incomplete
Undecided
Unassigned

Bug Description

Ubuntu 22.04.1
libvirtd create device without interfaces, so I couldn't bring it up and it does not work
bridge name bridge id STP enabled interfaces
virbr0 8000.525400784f63 no

On fedora:fedora/37/x86_64/silverblue it works
                  Version: 37.20221118.0 (2022-11-18T00:40:31Z)
bridge name bridge id STP enabled interfaces
virbr0 8000.525400053a90 yes tap0

Also if I run
virt-install --connect=qemu:///session --name CentOS --memory 4096 --vcpus 8 --disk sf/centos7.0-mi --import --network=bridge:virbr0 --os-variant centos7

ERROR internal error: /usr/lib/qemu/qemu-bridge-helper --use-vnet --br=virbr0 --fd=32: failed to communicate with bridge helper: Transport endpoint is not connected
stderr=failed to create tun device: Operation not permitted

Also affects Gnome-boxes, it cannot work with bridge mode

Why Ubuntu doesn't have virtnetworkd?
https://bugzilla.redhat.com/show_bug.cgi?id=2025202

ProblemType: Bug
DistroRelease: Ubuntu 22.04
Package: libvirt-daemon 8.0.0-1ubuntu7.3
ProcVersionSignature: Ubuntu 5.15.0-53.59-generic 5.15.64
Uname: Linux 5.15.0-53-generic x86_64
NonfreeKernelModules: zfs zunicode zavl icp zcommon znvpair
ApportVersion: 2.20.11-0ubuntu82.1
Architecture: amd64
CasperMD5CheckResult: pass
CurrentDesktop: ubuntu:GNOME
Date: Sat Nov 19 02:02:32 2022
InstallationDate: Installed on 2022-11-18 (0 days ago)
InstallationMedia: Ubuntu 22.04.1 LTS "Jammy Jellyfish" - Release amd64 (20220809.1)
ProcEnviron:
 TERM=xterm-256color
 PATH=(custom, no user)
 XDG_RUNTIME_DIR=<set>
 LANG=ru_RU.UTF-8
 SHELL=/bin/bash
SourcePackage: libvirt
UpgradeStatus: No upgrade log present (probably fresh install)
modified.conffile..etc.libvirt.libvirtd.conf: [modified]
modified.conffile..etc.libvirt.qemu.conf: [inaccessible: [Errno 13] Отказано в доступе: '/etc/libvirt/qemu.conf']
mtime.conffile..etc.libvirt.libvirtd.conf: 2022-11-19T00:15:53.201289

Revision history for this message
A (ant111111111111) wrote :
A (ant111111111111)
description: updated
A (ant111111111111)
description: updated
Revision history for this message
Christian Ehrhardt  (paelzer) wrote (last edit ):

Hi Ant

Q: Why Ubuntu doesn't have virtnetworkd?

A: Going modular is an optional configuration step and rather disruptive to the integration of libvirt into the system. There is continuous work to make this smoother, but it wasn't sufficient yet - therefore it isn't configured and build that way yet. It will be some day, but for now virtnetworkd and any virt*d are not missing, they are just part of the old style monolithic libvirtd.

Q: libvirtd create device without interfaces, so I couldn't bring it up and it does not work

A: On my 22.04.1 things work just fine, but maybe it is just a lack of detail in your request.
Your output likes like that of "brctl show" and an empty bridge (actually a bridge in nat mode to be more specific). Looks like this:

$ brctl show
bridge name bridge id STP enabled interfaces
virbr0 8000.525400d7d5df yes

Configured (the default) via:
$ virsh net-dumpxml default
<network>
  <name>default</name>
  <uuid>ebd0dd56-10b5-45e9-abfe-bd5dc15b20e9</uuid>
  <forward mode='nat'>
    <nat>
      <port start='1024' end='65535'/>
    </nat>
  </forward>
  <bridge name='virbr0' stp='on' delay='0'/>
  <mac address='52:54:00:d7:d5:df'/>
  <ip address='192.168.123.1' netmask='255.255.255.0'>
    <dhcp>
      <range start='192.168.123.2' end='192.168.123.254'/>
    </dhcp>
  </ip>
</network>

So the bridge has a host network interface (virbr0 itself) but no associated interfaces right now. If I attach guests then it gets interfaces attached like veth03fabd4e.

All seems to work fine, but I'm sure you have a more specific need and configuration, yet missed to outline what and how you do. That is the default of "install libvirt, and it works", anything you configure/change in your setup would be great to be explained here.
-> Setting to incomplete until we understand the issue.

Note:
You didn't explain how you instruct libvirt to create your bridges, which is important to try to recreate your problem and to try to help further.
General instructions how to do bridges via netplan and use them in libvirt are at [1], have you done it like that?

[1]: https://netplan.io/examples#configuring-network-bridges

Changed in libvirt (Ubuntu):
status: New → Incomplete
Revision history for this message
A (ant111111111111) wrote (last edit ):

Hello! About my use case. I try to run VM with Gnome Boxes but it does not automatically switch to bridge networking on Ubuntu like it does on Fedora with virtnetworkd service running. It uses user mode SLIRP, instead
Also, it does not show an IP in VM preferences (gnome boxes) on Ubuntu

is_libvirt_bridge_net_available
https://gitlab.gnome.org/GNOME/gnome-boxes/-/blob/main/src/util-app.vala#L315

Revision history for this message
A (ant111111111111) wrote :
Revision history for this message
A (ant111111111111) wrote :
Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Thank Ant for explaining your case with a bit more detail.

I'm not an expert in gnome-boxes (only used it a few times, but have no depth in it yet), but AFAIK it uses user permissions and due to that also libvirt user-session (qemu:///session vs the usual Ubuntu admin virtualization usage of system wide qemu:///system).

Libvirt does - on install - set up a reasonable (nat) default network for qemu:///system and has done so for all the time. But we do not do so for each qemu:///session (we can't as there might even be later users added, users that do not want this, ...).
Ubuntu users even of Desktop/UI tools traditionally use qemu:///system as well, like virt-manager.

But gnome-boxes follows the qemu:///session approach where daemons and virtual machines are not system, but user owned. That is a different concept and perfectly fine to use, but not the default we set up libvirt for.

I'd expect any less system and more user centric solution to set up these on install/creation.
That would make it a gnome-boxes problem in the first place. I'm adding a bug tasks for gnome-boxes people to chime in and coordinate what/if we'd need.
When doing so, maybe we even need a libvirt-* package to augment that, but even in that case we'd still need to learn from gnome-boxes what exactly is needed.

One reason users do not easily create bridged networking is that it is a security sensitive task and needs privileges. A lot of this is around qemu-birdge-helper which for security reasons does not come with setuid out of the box. To open it up intentionally an admin has to do a few changes which are outlined in many places, but since it is making things less secure not in an official place. This covers it rather well:
https://askubuntu.com/questions/1234102/trouble-getting-a-bridge-working-with-gnome-boxes

@people looking for the gnome-boxes bug task, is there something we can do to make this smoother for you other than making the classic system hypervisor setup less secure by default? Could you throw a popup to ask for admin power to do those changes? A special package you depend on that sets it up that way (libvirt-unsecure-user-network :-/ ). Or might it be even time to revisit with security the very old decisions to make it not default setuid?
Waiting for your input on how we could continue, until then the libvirt task is incomplete.

P.S. AFAICS right now this issue does not seem purely Ubuntu specific, but should affect all Debian derived distributions. So whatever we end up doing let us do it in all of them. And while it isn't related to the split daemons (virtnetworkd vs libvirtd) we could try to get it implemented smoother either way.

Revision history for this message
A (ant111111111111) wrote :

@paelzer
Thank you very much!

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.