This guide explains what is Gnome Boxes and how to install Boxes on various Linux distributions and then how to manage remote and virtual machines with Gnome boxes from a Linux desktop operating system.
Table of Contents
Introduction to Gnome Boxes
Boxes is a simple graphical virtual machine management application developed by GNOME. Using Boxes, we can view, access, and manage remote and virtual systems.
We can also browse the local or remote virtual machines, set the VMs preferences, and monitor their performances from the Boxes' dashboard. No need to memorise any commands! Most operations can be easily done with a couple mouse clicks.
Please note that Boxes isn't a viable alternative to other advanced VM managers, for example Virt-manager. Virt-manager is targeted towards system admins and experienced users who wants to setup a full-fledged virtualised solution.
In contrast to Virt-manager, Boxes is specifically designed for typical desktop users who wants a very easy and safe way to try new operating systems.
Under the hood, Boxes shares a lot of code with virt-manager project, mainly in the form of libvirt, libosinfo and qemu. It is written using C and Vala programming languages and released under GPL.
Install Gnome Boxes in Linux
Gnome Boxes has been packaged for many popular Linux distributions and is available in the official repositories.
To install Gnome Boxes on Arch Linux and its variants, run:
$ sudo pacman -S gnome-boxes
Debian, Ubuntu, Linux mint and Pop OS:
$ sudo apt install gnome-boxes
Fedora, RHEL, CentOS, AlmaLinux and Rocky Linux:
$ sudo dnf install gnome-boxes
openSUSE:
$ sudo zypper install gnome-boxes
Gnome Boxes is also available as flatpak application. If you haven't installed flatpak command line interface on your Linux system yet, refer the following link.
After installing flatpak, run the following command to install Gnome Boxes:
$ flatpak install flathub org.gnome.Boxes
To run Gnome Boxes, do:
$ flatpak run org.gnome.Boxes
Manage Remote and Virtual Machines with Gnome Boxes
Your Linux system should have at least 8 GB RAM and 20 GB of free disk space to run Boxes efficiently. Also, make sure your processor supports hardware virtualization (VT) to get smoother experience!
To check if your CPU supports VT, run this command:
$ gnome-boxes --checks
If you a line that states The CPU is capable of virtualization: yes
in the output, you are good to go!
(gnome-boxes:27364): Boxes-WARNING **: 18:39:29.108: util-app.vala:347: Failed to execute child process ?restorecon? (No such file or directory)
• The CPU is capable of virtualization: yes
• The KVM module is loaded: yes
• Libvirt KVM guest available: yes
• Boxes storage pool available: no
Could not get “gnome-boxes” storage pool information from libvirt. Make sure “virsh -c qemu:///session pool-dumpxml gnome-boxes” is working.
• The SELinux context is default: no
Report bugs to <http://gitlab.gnome.org/gnome/gnome-boxes/issues>.
Boxes home page: <https://wiki.gnome.org/Apps/Boxes>.
Please note that ff you have installed Boxes using flatpak, the gnome-boxes --checks
command may not be available.
Gnome Boxes Dashboard
Launch Boxes from the application launcher or menu. The default interface of Boxes will look like below.
As you can see, the Boxes dashboard is very simple and tidy!
It has a + (plus) sign on the top left, which allows you to create a new virtual machine or connect to a remote VM.
On the center, you will have options to view all machines or local only or remote only machines.
On the right side of the Boxes dashboard, you have a search box to search for a local or remote VMs, toggle view button, and a hamburger menu which lists the Keyboard shortcuts, help section and about section.
Create a New Virtual Machine
Click on the + (plus) sign on the top left to create a new virtual machine. A new window will open within the Boxes dashboard. You need to select an operating system to begin.
You will be given two choices under the "Select an OS Source" section. You can either:
- browse and search for a guest operating system to install,
- or select an .iso file from your local drive to install a VM.
If you choose the first option, you will see list of available OS versions in the next window. Pick any OS listed there and Boxes will automatically download it from the Internet. You will be notified after the download is complete.
Use the search box provided in the above window to quickly find your preferred OS version.
The second option is for those who wants to install the operating system from an ISO file stored in the local drive. Click "Operating System Image File" under the Select an OS Source section in the Boxes home window and choose the ISO file from your local disk.
After choosing the ISO file, Boxes will automatically assign required RAM and disk size based on the OS version. I chose CentOS 8 minimal ISO, and Boxes allocated 2 GB RAM 21.5 GB of disk space.
You will also have options to customize the VM as you wish. If you think the default RAM and disk space are not enough, click the Customize option and adjust the size of RAM and disk space. Finally, click Create button to create a new VM.
The guest operating system's installation process will start now! Just continue the installation as usual and complete it.
By default, Boxes stores disk images in ~/.local/share/gnome-boxes/images/
directory. If you are using other software that interfaces with libvirt, such as virt-manager, then Boxes will also read from the folder that software uses to store its images.
If you have installed Boxes via flathub, the disk images will be stored in ~/.var/app/org.gnome.Boxes/
location.
The configuration files are stored in ~/.config/libvirt
and ~/.config/gnome-boxes
locations.
Viewing Virtual Machine Details
To view the details of a VM, just right click on it and choose "Properties" from the right-click context menu. In the Properties menu, choose "System" option to view its details such as;
- total size of allocated RAM,
- total size allocated disk space,
- total number of CPU cores.
You can change these values as per your liking.
Connect to a Remote System
As stated already, Gnome Boxes can be able to connect to a local VM or a remote virtual system running in the same network.
To connect to a remote VM, click the + (plus) sign in the Boxes dashboard and choose "Connect to a Remote Computer" option.
The remote system can be connected using any one of the following methods:
- spice (remote Xspice server)
- rdp (remote desktop protocol)
- ssh (secure shell)
- vnc (VNC server)
For the purpose of this guide, I am going to access my remote VM via SSH. To do so, enter the following URL in the "Connect to Box" window.
ssh://root@192.168.225.52:22
Here,
- root - root user of my remote system,
- 192.168.225.52 - IP address of remote system,
- 22 - SSH port number.
Replace these values with your own and click Connect button.
Enter the user name of the root user to access the remote system console.
Create Snapshots of Virtual Machines
Snapshots are often used to save the current working state of a VM. They will be useful to restore the VM to earlier state if something goes wrong in future.
For instance, you may want to test a software on your VM or update your VM's OS to newer version. If the VM is broken after installing a specific software or updating the whole system, you can simply switch back to the previous working state.
To create a snapshot of a VM, right click and choose Properties. Go to the Snapshots section and click the + (plus) sign. A new snaphsot will be created with current timestamp in the name, for example 25/09/20, 07:13:16 PM IST.
You can also give a meaningful name to the snapshot to easily find and restore a snapshot later.
To rename a snapshot, click the gear icon next to each snapshot and choose "Rename" option and change the name to something more meaningful, for example "CentOS 8 with LAMP stack".
To restore a snapshot, just click the gear box again and choose "Revert to this state" option.
If you don't need a snapshot anymore, click the gear button and choose "Delete".
Clone Virtual Machines
Cloning virtual machines is often useful in many cases. You may want to deploy many identical VMs for testing purposes. Instead of manually creating multiple VMs one by one, we can make copies of an existing VM.
Cloning a virtual machine creates a new virtual machine that is configured with the same virtual hardware, installed software, and other properties that were configured for the original virtual machine.
To clone a Virtual machine from Boxes, just right click on it and choose "Clone" from the context menu. A new VM will be created with exact replica of the original machine.
View Virtual Machine's Logs
If a VM is not starting up, you can refer the logs to get a clue of what went wrong. To view the log file of a VM, right click on it and choose "Properties". In the Properties window, go to the "System" tab and click "Troubleshooting Log".
The log file displays the virtual machine state, the virtual machine libvirt configuration, and the QEMU hypervisor log.
Conclusion
In this guide, we looked at how to manage remote and virtual machines with Gnome boxes in Linux. Boxes doesn't include any advanced options like its counterparts. It is just a beginner-friendly, light-wight graphical tool that focuses mostly on simplicity and usability out of the box.
If you want to turn your Linux desktop into a simple virtualization environment in couple minutes, Gnome Boxes might be a good choice!
Resource:
Featured image by Gordon Johnson from Pixabay.