Skip to content

Conversation

NicGrimpe
Copy link

Description

Without this change I could not launch a vm with a network configured. network="br0"

failed to create tun device: Operation not permitted
qemu-system-x86_64: -nic bridge,br=br0,model=virtio-net-pci: bridge helper failed

Tested on nixos. Maybe there is a better way to get it to work, feel free to let me know and close this PR in that case :)

Type of change

Bug fix (non-breaking change which fixes an issue)

Checklist:

  • I have performed a self-review of my code
  • I have tested my code in common scenarios and confirmed there are no regressions
  • I have added comments to my code, particularly in hard-to-understand sections

@2b
Copy link

2b commented Oct 6, 2024

Hi! Thank you for the fix!

Maybe this should be fixed at the package.nix level, if it's NixOS-specific. What do you think?
In the meantime, here is a Nix overlay for anyone who stumbled upon this, like me:

final: prev: {
  quickemu = prev.quickemu.overrideAttrs (oldAttrs: {
    postPatch = (oldAttrs.postPatch or "") + ''
      substituteInPlace quickemu \
        --replace-fail 'args+=(-nic bridge,br=''${network},model=virtio-net-pci''${MAC})' \
                       'args+=(-nic bridge,br=''${network},helper=$(type -p qemu-bridge-helper),model=virtio-net-pci''${MAC})'
    '';
  });
}

@TheMuso
Copy link
Contributor

TheMuso commented Feb 11, 2025

I use something similar in my nix config as well, but I have been wondering whether a programs.quickemu module needs to be created, since /etc/qemu/bridge.conf needs to contain the name of the bridge interface. Setting up a wrapper for qemu-bridge-helper could also be done there. Yes the libvirt module also sets this stuff up, but adding assertions to make sure there are no conflicts is doable.

The quickemu packaging could then be adjusted similar to the above overlay to point to the security wrapper bridge helper binary.

@nthnd
Copy link

nthnd commented Mar 6, 2025

Hi! Thank you for the fix!

Maybe this should be fixed at the package.nix level, if it's NixOS-specific. What do you think? In the meantime, here is a Nix overlay for anyone who stumbled upon this, like me:

final: prev: {
  quickemu = prev.quickemu.overrideAttrs (oldAttrs: {
    postPatch = (oldAttrs.postPatch or "") + ''
      substituteInPlace quickemu \
        --replace-fail 'args+=(-nic bridge,br=''${network},model=virtio-net-pci''${MAC})' \
                       'args+=(-nic bridge,br=''${network},helper=$(type -p qemu-bridge-helper),model=virtio-net-pci''${MAC})'
    '';
  });
}

still failing on my system with this line in the log

qemu-system-x86_64: -nic bridge,br=win-br0,helper=,model=virtio-net-pci: bridge helper failed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants