GNOME Bugzilla – Bug 767039
Bridged networking doesn't work unless "allow virbr0" is exactly the first line in /etc/qemu/bridge.conf
Last modified: 2016-06-01 14:08:00 UTC
Steps to reproduce (verified on Arch Linux x86_64 multilib, gnome-boxes 3.20.2-1): - On a system with at least two bridges, say br0 (manually configured, with a physical NIC attached) and virbr0 (provided by system libvirt default configuration) available, run the below commands and setup a new VM. - Test case #1: - with /etc/qemu/bridge.conf having contents: enable br0 enable virbr0 - run: $ G_MESSAGES_PREFIXED= G_MESSAGES_DEBUG=Boxes gnome-boxes |& tee gnome-boxes-1.log - Test case #2: - with /etc/qemu/bridge.conf having contents: enable virbr0 enable br0 - run: $ G_MESSAGES_PREFIXED= G_MESSAGES_DEBUG=Boxes gnome-boxes |& gnome-boxes-2.log (note: order of lines reversed from above) - Compare output of gnome-boxes-{1,2}.log - run: $ diff -u gnome-boxes-{1,2}.log My results: $ ip link show dev br0 3: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000 link/ether c6:a7:1d:5d:b6:fa brd ff:ff:ff:ff:ff:ff $ ip link show dev virbr0 4: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN mode DEFAULT group default qlen 1000 link/ether 52:54:00:df:33:2c brd ff:ff:ff:ff:ff:ff Test case #1: Created a new VM booting from archlinux-2016.05.01-dual.iso, poweroff the guest from the boot menu. Test case #2: Idem. $ diff -u gnome-boxes-{1,2}.log --- gnome-boxes-1.log 2016-05-30 22:25:50.074314359 +0200 +++ gnome-boxes-2.log 2016-05-30 22:26:52.077242390 +0200 @@ -15,11 +15,11 @@ Boxes-DEBUG: vm-creator.vala:290: Creating volume 'boxes-unknown'.. Boxes-DEBUG: vm-creator.vala:292: Created volume 'boxes-unknown'. Boxes-DEBUG: vm-configurator.vala:290: Using IDE controller for the main disk -Boxes-DEBUG: vm-configurator.vala:482: Adding user network to (null) +Boxes-DEBUG: vm-configurator.vala:477: Adding bridge network to (null) Boxes-DEBUG: libvirt-machine.vala:165: new libvirt machine: boxes-unknown Boxes-DEBUG: machine.vala:114: State of 'archlinux-2016' changed to BOXES_MACHINE_MACHINE_STATE_STOPPED Boxes-DEBUG: libvirt-broker.vala:130: New domain 'boxes-unknown' -Boxes-DEBUG: vm-configurator.vala:482: Adding user network to boxes-unknown +Boxes-DEBUG: vm-configurator.vala:477: Adding bridge network to boxes-unknown Boxes-DEBUG: machine.vala:114: State of 'archlinux-2016' changed to BOXES_MACHINE_MACHINE_STATE_RUNNING Boxes-DEBUG: libvirt-machine.vala:357: enable statistics for archlinux-2016 Boxes-DEBUG: machine.vala:114: State of 'archlinux-2016' changed to BOXES_MACHINE_MACHINE_STATE_RUNNING @@ -31,7 +31,7 @@ Boxes-DEBUG: libvirt-machine.vala:462: delete libvirt machine: archlinux-2016 Boxes-DEBUG: machine.vala:557: Could not delete screenshot: no uuid, cannot build screenshot filename Boxes-DEBUG: libvirt-machine.vala:376: disable statistics for archlinux-2016 -Boxes-DEBUG: libvirt-machine.vala:489: Unable to stop domain: Domain not found: no domain with matching uuid 'a4f050d1-5712-42d7-8425-7c1d32804a73' (boxes-unknown) +Boxes-DEBUG: libvirt-machine.vala:489: Unable to stop domain: Domain not found: no domain with matching uuid '3bd90265-6d35-47a8-a181-113bbe1a69ad' (boxes-unknown) Boxes-DEBUG: libvirt-machine.vala:462: delete libvirt machine: archlinux-2016 Boxes-DEBUG: machine.vala:557: Could not delete screenshot: no uuid, cannot build screenshot filename Boxes-DEBUG: libvirt-machine.vala:376: disable statistics for archlinux-2016 Probable root cause: https://github.com/GNOME/gnome-boxes/blob/1f615bb0bcfa7b66820ac63465cb80eadf086d28/src/util-app.vala#L177 The pattern "^allow.*virbr0" doesn't match across multiple lines. Suggested resolution: See [2] (look for G_REGEX_MULTILINE): prepend "(?m)" to the pattern. [1]: http://xkahn.zoned.net/blog/2013/11/26/networking-and-gnome-boxes/ [2]: https://developer.gnome.org/glib/stable/glib-Perl-compatible-regular-expressions.html#GRegexCompileFlags
d'oh. in the test cases, s/enable/allow/, sorry.
Created attachment 328827 [details] [review] util-app: Match regex across multiple lines
I've tested the patch and found it working as intended using the same setup and procedure as in my report.
Wow! I love it when reporters provide patches, especially if they can be applied as is. :) I also tested the logic with this test code: ----- var str = "Hello\nworld"; if (Regex.match_simple ("^world", str)) print ("match"); else print ("no match"); ----- Attachment 328827 [details] pushed as 5d234ef - util-app: Match regex across multiple lines
(In reply to Zeeshan Ali (Khattak) from comment #4) > Wow! I love it when reporters provide patches, especially if they can be > applied as is. :) You're very welcome :)