Still working with gnome boxes

Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

A couple of weeks ago, I’ve wrote an article about how I’m (kinda) in love with gnome boxes. Well, I’m still working with gnome boxes every day. And that simpleness I’m kinda in love to comes with a cost: to do some things are the exact opposite to simple.

Here’s a small list of things that annoyed me and how I’ve solved it.

Guest drivers

Even when the virtualization performance is “good”¹, it will be better¹ if you install those drivers and agent. Not only your VM would run smoother¹, they would enable features like automatic resolution switching, copy&paste between host and guest,…

¹ Disclaimer: I’ve didn’t run any benchmark on any of my VMs, so I can’t tell how “good” this performance is. I’m just gonna say that it feels fast enough.

Linux

Chances are that, if you followed the new VM wizard with the templates provided, you already have drivers and the agent running. But if you’ve installed an not-that-popular linux distribution, boxes will let you know that you need to install things:

still working with gnome boxes. spice not installed
The warning it’s in spanish, but it says that Spice tools aren’t installed and you need them to do stuff

This screenshot was taken to a VM running Devuan, a systemd-free Debian fork I’ve wrote about before. As with any Debian derivative, we install packages with apt-get:

apt-get install spice-vdagent xserver-xorg-video-qxl

Other linux distributions need both packages, the name would probably be the same or at least similar, and you need to use that distro package system (i.e. yum install) to install it.

You can always download the sources and compile by yourself of course. Download the sources from here https://www.spice-space.org/download.html under the Guest section.

Windows

On the same site you can download the guest tools, that include the qxl drivers. Under the windows binaries section just download spice-guest-tools installer and that would be all:

still working with gnome boxes. Weird resolution
Notice that weird 1067×773 resolution on windows7

Bridged networking

By default every VM is created with NAT networking. This means that your VMs will connect to the internet but not backwards (for example, you can’t even ping a vm).

If you want or need networking to the virtual machines you need to enable bridged network and this part is tricky. Also is the most annoying thing I’ve found in boxes. With VirtualBox you can do the same with 2 or 3 mouse clicks. But I’ll be still working with gnome boxes.

First enable libvirtd, on distros with systemd run:

# systemctl enable libvirtd.service; systemctl start libvirtd.service

Next enable default interfaces:

virsh net-autostart --network default
virsh net-start default
ip a show virbr0
still working with gnome boxes. virbr0 status
That error is because I had already running bridged networking.

Now create the file (if don’t exists) /etc/qemu/bridge.conf with the following content:

allow virbr0

Now we need to set correct permissions on the executable qemu-bridge-helper. I’m using gentoo linux in my host, this binary executable lives on /usr/libexec/qemu-bridge-helper , on other distributions lives on /usr/lib/qemu-bridge-helper. Check permissions and owner with:

# ls -lh /usr/libexec/qemu-bridge-helper 
-rwx--x--x 1 root root 234K dic 19 19:38 /usr/libexec/qemu-bridge-helper

That file could belong to other groups like kvm or qemu. Make sure your user is part of that group. In this point a lot of tutorials says that you need add setsuid. I’ve also added setgid:

# chmod ug+s /usr/libexec/qemu-bridge-helper
# ls -lh /usr/libexec/qemu-bridge-helper 
-rws--s--x 1 root root 234K dic 19 19:38 /usr/libexec/qemu-bridge-helper

It could happen, at least happened to me, that after some actualization those permissions revert to the default value and I couldn’t launch any VM anymore. It didn’t happened anymore once I’ve added my user to the root group (I don’t know which one is more dangerous, suid or my regular user member of root group). You’ll notice there is something wrong with permissions if you get an error like this:

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

The last step to get networking is to edit the xml file (right click on the vm → properties → system → edit xml) and change this section:

<interface type='user'>
      <mac address='52:54:00:0b:8f:07'/>
      <model type='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>

To this:

   <interface type="bridge">
      <mac address="52:54:00:b8:0a:93"/>
      <source bridge="virbr0"/>
      <target dev="tap1"/>
      <model type="virtio"/>
      <alias name="net0"/>
      <address type="pci" domain="0x0000" bus="0x01" slot="0x00" function="0x0"/>
    </interface>

For some reason the next VMs you make will be in bridge mode.

Virtual images location

Gnome boxes stores virtual images on the following location: ~/.local/share/gnome-boxes/images/ . ~ means home directory of your user.

This path isn’t supposed to change, but if you are running low on disk space or just want your VMs to live in other path you can always:

  • mount another disk or filesystem on that path
  • create the directory on another disk with enough space and then make that path a symbolic link

Also, if you want to backup your VM just copy the image from there to another place.

Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"
Gonzalo Rivero
Gonzalo Rivero
I am Gonzalo, I live in Salta, a city located in the NW of Argentina. I play the guitar and a little harmonica. I also like to bike.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest articles

Join us on Facebook