Run virtual machines in Gnome Boxes


© Lead Image © yarruta, and gnome photo by David Brooke Martin on Unsplash

© Lead Image © yarruta, and gnome photo by David Brooke Martin on Unsplash

Article from Issue 221/2019

In the past, using virtual machines required expensive programs such as VMware or open source add-ons such as VirtualBox. Gnome Boxes brings a convenient virtualization option to the Linux desktop.

If you want to set up a virtual machine (VM) with a graphical user interface on Linux, you might be inclined to go with VirtualBox or VMware's commercial offerings. These applications, which have been established for years, offer many functions. However, due to their full version's proprietary licenses, they are not found in the package sources of popular Linux distributions.

With VirtualBox, you would have to install the Extension Pack alongside the program to use the application's full functionality. In addition, it is important to pay attention to licences. VirtualBox's source code is released under the GPL v2.0, but you can only use the proprietary add-on free of charge [1] for personal use or testing purposes.

Boxes Out of the Box

Because Gnome Boxes, a front-end tool for Kernel-based Virtual Machine (KVM), is created within the framework of the Gnome Desktop Environment [2], it does not require the installation of any additional software (see the "SPICE Mix" box). With KVM directly integrated into the Linux kernel, Boxes does not have to worry about virtualization. The software simply provides the VM with the environment, using existing libraries and applications such as libvirt and Qemu [3].


Boxes uses the SPICE protocol [4] for communicating between the desktop and the VM. Much like VNC, SPICE transfers the screen content, plus mouse and keyboard input. However, it is not limited to the image; it also transmits audio and couples USB devices with the VM.

Distributions that deliver a complete Gnome desktop include Gnome Boxes. Examples include Arch Linux, which automatically packs the application onto the hard disk along with the gnome metapackage. Other distributions, such as Ubuntu, do not include Boxes during the system's initial installation, but do include the application in the software sources (the gnome-boxes package).

When first launched, Boxes boots up in a very tidy window. Pressing New in the upper left corner launches the setup of an initial VM. A wizard pops up to help you (Figure 1). Thanks to the Source Selection option, you don't even have to load an image of the distribution you want to install. The program directly downloads variants of the most popular distributions. If the desired variant is missing, the search function in the window titlebar quickly finds a matching entry.

Figure 1: The setup wizard lets you download numerous distributions directly from Gnome Boxes.

However, the database is not up to date. As of November 2018, Boxes did not know anything about Ubuntu 18.10, which was released earlier in October. In such a case, you need to manually download the system image as an ISO file off the web and then enter it as a boot image via the Select a file option. Following the selection, Boxes then jumps directly to the next step.

You can customize the VM to your needs by setting the RAM size for the VM and the virtual disk's size. A click on Create then starts the VM installation; the installation wizard in your chosen distribution will guide you. (See the "Tip" box for information on the directory path.)


Gnome Boxes stores the VMs under ~/.local/share/gnome-boxes/. Boxes does not offer an option to change this path. If you prefer a different location, the directory can still be changed. To do this, stop all VMs, and then move the directory. Then create a symbolic link between the old and new storage locations (Listing 1).

Listing 1

Linking Storage Locations

$ mv ~/.local/share/gnome-boxes /<I>Path<I>/<I>Folder<I>/
$ ln -s /<I>Path<I>/<I>Folder<I>/gnome-boxes ~/.local/share/

The process is faster if you install distributions or operating systems supported by libosinfo [5]. In addition to Debian 9, this also includes Windows 7 or Windows 10, but not Ubuntu 18.04 or the recently released Ubuntu 18.10. In this case, Boxes offers an Express installation, which loads the system into the VM in a completely automated process. The only option (at least for Linux guests) is the ability to specify the username and password (Figure 2). Pressing Next then continues the installation without any further intervention.

Figure 2: Thanks to Express installation for distros like Debian 9, Gnome Boxes sets up the guest operating system without any further questions.

During the install, you will already find the new VM in the application's main screen (Figure 3). When the VM is active, the icon shows a colored live image of the system in the thumbnail. An inactive VM appears as a gray thumbnail. Clicking on the icon opens the VM in large format (Figure 4).

Figure 3: On the home page, Gnome Boxes shows the available VMs. The thumbnail reflects the live state of the systems.
Figure 4: If the SPICE Guest Agent is enabled on the virtual system, files can be exchanged between the guest and host. The resolution is adjusted automatically.

To return to the overview, use the left arrow in the top left corner of the application window; the VM continues to run in the background. You need to explicitly shut down the VM before Boxes really switches it off. If the mouse pointer is trapped in a VM, you can free it using the Ctrl+Alt keyboard shortcut.

Using the context menu in the overview (or the active VM's hamburger menu), you can access Properties. This is where you can share the contents of the clipboard between the VM and the host system (see "File Sharing" box) and forward devices connected to the host to the VM below Devices and Shares. In the System tab, you will find graphical history displays of CPU load, read/write operations, and network traffic. You can also adjust the size of the working memory and the virtual hard disk (Figure 5).

Figure 5: The optional settings for the individual VMs are very limited. You can only change the size of the RAM and the virtual hard disk.

File Sharing

With the Properties | General option enabled below Share clipboard, you can easily exchange data between the guest and host systems. Texts are transferred in both directions using Ctrl+C and Ctrl+V. Simply drag files and folders from the File Manager to the VM application window. You will then be taken to the Downloads/ folder of the corresponding user. Alternatively, load files into the VM via the hamburger menu and the option Send file …. For the opposite direction, that is, from guest to host, this method does not yet work.

To copy data from the VM to the host or to set up a permanent data channel between the VM and the host system, configure a new shared folder below Properties | General | Devices and shares. In the file manager, the share will appear as Spice client folder under + Other locations (Figure 6).

Figure 6: A shared folder from the host system appears in a Gnome Boxes VM as Spice client folder in the network neighborhood.

If a VM no longer reacts, you can also force a restart or shutdown here. If you only need the machine for services in the background (such as a network stack for the web server and database – see the box entitled "User Mode Networking"), the Run in background option in this window can also be used to prevent the VM interface from opening. An interface configured in the VM is not affected by this option and still requires resources. It is therefore best to switch off the launch of the graphical environment completely in the corresponding VM or install the system without a GUI from the outset.

User Mode Networking

In the basic configuration, Qemu/KVM sets up a separate network between the host system and the guest. From the guest system you can reach the host via IP address or depending on the distribution. However, guests are not allowed to communicate with each other, and the guest cannot be reached from the host. To run a LAN-accessible service, such as a mail or database server, on the guest, you first need to configure a network bridge on the host [8].

The last tab, Snapshots, offers the possibility to take snapshots of the system loaded in the VM – handy if you want to experiment with the system or gain experience with a new distribution. All you have to do is click on the plus button. Using the gear menu next to the individual snapshots, you can restore an old state at the push of a button, rename the snapshot, or delete it from the hard disk.


In everyday life, Gnome Boxes impresses as an easy-to-use virtual system. In particular, current distributions with Gnome desktops fit seamlessly into the host system, from installation to a running system (see the "Guests" box). However, Boxes does not yet support advanced functions, such as dragging virtualized applications into the host system's window manager.


For the guest and host to understand each other perfectly, the SPICE Guest Agent (the binary is usually named spice-vdagent) needs to be running on the guest – the service can be compared with the VMware tools or VirtualBox's Guest Extensions. For guest systems with Gnome desktops (since version 18.04 this also includes Ubuntu), this is usually the case by default. The resolution of the guest system is automatically adjusted to the window size in the live system; files can be transferred using drag and drop and the guest and host clipboards are synchronized. In addition, the image build-up in the VM with the SPICE Agent enabled is considerably accelerated.

However, on systems with other desktops, such as KDE Plasma or Xfce, you need to install the SPICE Agent retroactively. For Debian based distributions, do this as shown in Listing 2. Depending on the distribution, the virtualized system needs a reboot afterwards. In our lab, KDE Plasma 5.12.2 proved to be fully compatible with Netrunner 18.03. With Xfce 4.12 under Linux Mint Xfce 19, the clipboard worked in our lab, but transferring files failed. Also, the VM's resolution was not adjusted after changing the window size, until we ran the command:

xrandr --output Virtual-1 --auto

Exotic desktops like Moksha 0.3.0 from Bodhi Linux 5.0.0 didn't really understand what to do with the SPICE Guest Agent. According to the developers responsible for the SPICE agent at Red Hat, the fault lies with the desktops themselves [6].

For Windows guests, you need to load and install the SPICE Guest Tools [7] on the VM (Figure 7). On Windows 7 and Windows 10, the clipboard can be synchronized and files can be transferred using drag and drop, but automatic resolution adjustment does not work. For an optimized display, there is only the possibility to configure the resolution manually in the Windows system's settings or to switch the graphic back end to QXL, which is not possible with Boxes itself.

Figure 7: For Windows guests to work with Gnome Boxes, you must install the SPICE Guest tools on the virtual system.

Listing 2

Installing the SPICE Agent on Debian

$ sudo apt install spice-vdagent
$ sudo systemctl enable spice-vdagent
$ sudo systemctl start spice-vdagent

The most important functions work without too much overhead. No guest extensions are needed for copying and pasting texts between Linux guests and the host system if you choose the right system. Adjusting the resolution of the virtual system to the size of the application window also works for current distributions without installing additional drivers on the guest system.

All in all, Gnome Boxes is an impressively simple and unpretentious VM solution. A Linux VM can be set up with a few clicks, from downloading the ISO image to setting up the graphical desktop. However, it lacks options for controlling the virtual system. For example, there is no option for managing the number of virtual CPU cores in Boxes. For some, this restriction to the bare essentials may be welcome; for others, Boxes offer enough to justify a switch from VirtualBox. Good thing there's a range of great VM options on Linux.


  1. Oracle VM VirtualBox Extension Pack Personal Use and Evaluation License:
  2. Gnome Boxes:
  3. Qemu:
  4. SPICE:
  5. libosinfo:
  6. "Auto-screen-resolution change of qxl/spice guest not working":
  7. SPICE Guest Tools download:
  8. Bridged networking in Ubuntu:

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content


    Red Hat peps up performance of multimedia applications on remote desktops with SPICE (Simple Protocol For Independent Computing Environments).

  • KVM Front Ends

    If you want to care for a zoo full of exotic KVM guest systems on your desktop, you could use a little help from a graphical front end.

  • BlueSpice 4.1

    Keep your team collaborating with BlueSpice, a wiki tool focused on professional customers.

  • VirtualBox 7.0 Now Available for Installation

    One of the most popular virtual machine applications for Linux has been upgraded to a major new release that offers an overhauled UI and some pretty important features.

  • Virtualization Tools

    Running server systems in virtual environments is a popular approach, but the technology offers benefits to desktop users. In this article, we investigate some virtual desktop alternatives.

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More