Getting Started with Gnome Boxes

Gnome Boxes is meant to be an easy and quick-starting software for Qemu virtual machines.

I have already blogged about Qemu with KVM Virtual Machine Manager. These tools are powerful but require time to get familiar with them and tweak them correctly (I tried to provide some hints in my previous posts about these tools).

Today, I’ll write about Gnome Boxes. It is effectively easier than the above tools, and since it’s based on Qemu, the created virtual machines can be used by virt-manager and vice-versa (more on that at the end of the post).

I will use the version of Gnome Boxes that comes installed by default in Fedora 39.

The first time you start it, you’re greeted by a few introductory pictures about its main features:

Concerning “Expression Installation”, I still haven’t tried that, but I’m not interested in that feature either.

This “Easy Downloads” is an excellent feature that I’ll use for the supported OSes. In that respect, Quickemu provides many more supported systems. For example, Gnome Boxes does not provide an easy download for my favorite distro, EndeavourOS.

That is also an excellent feature that worked in all my experiments.

Here’s the main interface, which, like many Gnome software, is minimal: you have the “+” toolbar icon on the left-most corner to create a new virtual machine, either by an existing ISO file (or even existing .qcow2 machine, which I’ve never tested) or by downloading one of the supported ISOs.

Let’s start installing a few virtual machines and see how it goes.

Installing Fedora 39

I’ll use the option to download Fedora Workstation 39 directly from Boxes (you have to wait a few seconds for the list to get populated):

See the download feedback on the other side of the window. You might want to explore those menus, especially when a virtual machine has started.

The ISO will be saved in your “Downloads” folder when finished.

Then, the main dialog for configuring the virtual machines appears; these are the default settings:

I changed the Firmware to UEFI and gave more RAM and disk to the machine (remember that the machine is saved on a qcow file, so its effective disk occupation is not the effective size of the file: only the real occupied space is used on your hard disk):

Let’s press “Create,” and the VM is started.

Take note of the following shortcut:

REMEMBER: you can use left Ctrl + Alt to “ungrab” the keyboard from/to the virtual machine/your host (or click on anything on your host desktop if you don’t have Gnome Boxes full screen).

Now, you can install Fedora as usual (I’m not covering this here).

While waiting for the installation to finish, you might want to take note of the menus in the top-right corner, available when a virtual machine is in execution, to send special key combinations to the virtual machine…

… or for other tasks.

Once the installation has finished, you can restart the virtual machine, e.g., using the Gnome menu.

Note that when a virtual machine is running, you can see its executing thumbnail in the main Gnome Boxes window:

Click on that to see the virtual machine itself.

Note that since “spice agent” is automatically installed when installing Fedora (it detects you’re installing it on a virtual machine), the virtual machine screen is automatically resized and scaled according to the size of the Gnome Boxes window. For example, this is the Gnome Boxes window full screen:

and this when slightly resized as smaller (not how the virtual machine desktop has been automatically resized):

You have bidirectional copy-and-paste from the virtual machine and the host and vice-versa.

You can also drag some files (not directories) from the host to the virtual machine: in the virtual machine, they will appear in the “Downloads” folder.

Let’s shut down the machine, right-click on its icon in the Gnome Boxes window, and explore its “Preferences” (note that you can also create a full clone of the virtual machine):

In the “Resources” tab, I can enable 3D acceleration so the virtual machine will use my computer’s graphical card instead of relying on “Software rendering.” This will allow you to have fluid and smooth 3d effects in the virtual machine desktop environments.

Then, we can share devices and folders with the machine (I’m not covering that; note that you must install additional software in the virtual machine; in the Fedora virtual machine, “spice-webdav” has already been installed):

Then, we have the tab to create snapshots of the machine for “going back in time” in the virtual machine (note that this is different from cloning, which will give a full and independent machine clone). For example, I create a snapshot and give it a meaningful description:

Remember that, later, if you restore a snapshot, you lose everything you’ve done in the virtual machine from when you created the snapshot.

NOTE: if you start the Fedora virtual machine after the first boot on the installed system, chances are that you will have to wait for it to download and install updates on the next boot.

With the 3d acceleration set, if we boot in the virtual machine, the Gnome effects will be enabled and fluid (depending on your host CPU and graphic card, of course). If we inspect the system details of the virtual machine through the Gnome “About,” we can see that the graphic card is Virgl. Without 3d acceleration, you would see “Software rendering”:

WARNING: in my experiments, starting the Fedora virtual machine with 3d acceleration sometimes hangs. I have to quit Gnome Boxes, reopen it, and then the machine correctly starts.

Installing EndeavourOS

As said above, this is not one of the ISO automatically downloadable, so I had first to download the ISO and then choose the other menu to start from an existing ISO:

Note that the “Operating System” must be specified: use the search box below to select the closest one, in this case, “Arch Linux”:

As before, I increased RAM and disk size.

In the first experiment, I selected “UEFI”, but then the virtual machine did not start at all due to a missing UEFI:

I did not investigate further… I deleted the virtual machine and started from scratch with the good old BIOS, and this time, the virtual machine started:

I then installed EndeavourOS GNOME, and after shutting the installed virtual machine, I could select “3D acceleration”.

EndeavourOS GNOME also works fine in the virtual machine: fluid 3d effects, automatic resolution resize, bidirectional shared clipboard, and drag and drop in the machine (the “spice agent” has also been automatically installed).

Unfortunately, the host touchpad scroll is not recognized in the virtual machine. Since it works in the Fedora and Ubuntu VM, I guess it’s just a problem with the new GNOME 46 version already landing in Arch.

Installing Ubuntu 23.10

Ubuntu 23.10 is one of the supported ISOs, so I let Gnome Boxes download the ISO for me, as I’ve done above for Fedora.

The initial configuration of the Virtual Machine is the same as that of Fedora.

I did the installation as usual and ensured the virtual machine boots correctly.

However, 3d acceleration is not available for Ubuntu. You can find many issues in that respect on the Gnome Boxes issue website, in particular, this one: https://gitlab.gnome.org/GNOME/gnome-boxes/-/issues/709; I seem to understand that’s an intentional choice because Ubuntu used to give problems when started with 3d acceleration.

And the system information in the virtual machine stays with “Software rendering”:

This means, of course, no fluid 3d effects 🙁

Accessing Boxes with Virtual Machine Manager

I’ve also installed “virt-manager” in my Fedora host.

You can access Gnome Boxes virtual machines with virt-manager if you want full configuration options. As you’ve seen, Gnome Boxes is all about simplicity and exposes a very limited number of configuration options for the Qemu virtual machines.

First, we must create a new “connection” in virt-manager: by default, virt-manager relies on a system session, while Gnome Boxes uses a user session. So, let’s open Virtual Machine Manager, select File > Add New Connection, and select user session in the “Hypervisor”:

After pressing “Connect,” we should see all the virtual machines we created with Gnome Boxes; in particular, I’m interested in the Ubuntu one:

Now, we can configure the machine using the full configuration options of virt-manager. Of course, I’m interested in enabling 3d, so first I set the “Spice” section as follows:

And then the video section accordingly:

And if I start the virtual machine from virt-manager, 3d acceleration works!

But… if I open the configured machine with Gnome Boxes, 3d acceleration will be automatically removed: Gnome Boxes automatically and silently revert the configuration since it insists on considering Ubuntu not compliant with 3d acceleration. You can verify that by reopening the machine details with virt-manager.

Summary

While it is true that Gnome Boxes is a very easy and quick solution for creating Qemu virtual machines with sensible defaults, it is still too rigid. It even resets your manual configurations if they don’t meet its expectations. If you’re already familiar with virt-manager, using Gnome Boxes might not be worthwhile unless for very quick experiments with the supported operating systems. However, I still prefer Gnome Boxes to Quickemu for the moment since at least a shared clipboard works while keeping good 3d acceleration performances (if supported). Quickemu forces you to choose one of the two.

Happy virtualization! 😉

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.