Note: This article applies to GNOME 3.10 in Fedora 20. You no longer need these steps in GNOME 3.14 in Fedora 21.
I’m setting up an Alfresco server and I need to test some of the tweaks and configuration I’m working with. Alfresco is big; lots of components including Java, an application server, usually a front end server, a database, etc., etc. In addition, it is certified to work with a narrow set of other software. For example, Alfresco certifies against Red Hat Enterprise Linux 6, but my development machine is Fedora 19. Red Hat Enterprise Linux 6 comes with MySQL, but Alfresco certifies against a much more recent version.
This is the perfect use-case for an Virtual Machine.
So I started virt-manager to get started. I configured a VM, but … failed. It seems that virt-manager wants to place the image for the virtual machine under /var/lib/libvirt/images. However the /var tree on my laptop is fairly small. I don’t have the space to install a whole other OS there. My home directory, on the other hand, has plenty of space.
This is a perfect use-case for GNOME Boxes.
And, in fact, GNOME Boxes is awesome. Setting up the VM and making it run was easy, quick, and pleasent. Until it wasn’t.
You see, GNOME Boxes uses isolated networking. The Virtual Machine can connect to external hosts, but nothing can connect into it. After 2 days of struggling, here is how to fix it on Fedora 19:
- Shut down the virtual machine.
- Get the name or id of your virtual machine. Run, from the command to get the name:
$ virsh -c qemu:///session list --all
- Edit your VM’s configuration file using virsh as below: (My VM is named rhel6.4, so that’s what I used. You may need to use the ID of the VM, if available.)
$ virsh edit rhel6.4
- Find the lines that look like this:
<interface type='user'> <mac address='52:54:00:bf:c5:97'/> <model type='rtl8139'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </interface>
- Remove those lines and replace them with: (If you are not using Fedora, it’s possible that your network device is not named “virbr0“. You can get a list of all the interface names using ifconfig.)
<interface type='bridge'> <mac address='00:16:3e:1a:b3:4a'/> <source bridge='virbr0'/> <model type='virtio'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </interface>
- Start the VM, and you should be all set!
Well, maybe you’re still having problems? Some troubleshooting tips:
- You may not have bridging set up. Check /etc/qemu/bridge.conf to see that it contains the line:
- If you want to run or configure your Boxes VM in virt-manager, you need to connect to the user session, which isn’t possible via the user interface yet. Run:
$ virt-manager -c qemu+unix:///session
Will this get easier in the future? Absolutely. You can read the discussion and follow the progress on GNOME Bugzilla.
Edits on Nov 27, 2013: Virt Manager and Boxes do NOT need to be shut down while editing the VM details. There is a virsh command to get a list of VM names. Your network interface may not match mine if you are not running Fedora. Add link to the #boxes channel on IRC. Add in troubleshooting section for users without bridged networking configured. You do NOT need to run the VM using virt-manager after this configuration change, Boxes will handle it fine. Add in the Bugzilla link. Thanks to teuf, zeenix, and elad on IRC for the corrections.
Edit on Jan 22, 2015: Fixes and improvements to Boxes for GNOME 3.14 make this article out of date — the changes mentioned here are now the default Boxes configuration.