Incus is a manager for virtual machines and system containers.
A virtual machine (VM) is an instance of an operating system that runs on a computer, along with the main operating system. A virtual machine uses hardware virtualization features for the separation from the main operating system. With virtual machines, the full operating system boots up in them. While in most cases you would run Linux on a VM without a desktop environment, you can also run Linux with a desktop environment (like in VirtualBox and VMWare).
In How to run a Windows virtual machine on Incus on Linux we saw how to run a run a Windows VM on Incus. In this post we see how to run a Linux Desktop virtual machine on Incus.
Table of Contents
- Updates
- Prerequisites
- Cheat sheet
- Availability of images
- Booting a desktop Linux VM on Incus
- Troubleshooting
-
- I closed the desktop window but the VM is running. How do I get it back up?
- Error: This console is already connected. Force is required to take it over.
- Error: Instance is not running
- I get no audio from the desktop VM! How do I get sound in the desktop VM?
- How do I shutdown the desktop VM?
- Error: Failed instance creation: The image used by this instance is incompatible with secureboot. Please set security.secureboot=false on the instance
- Error: Failed instance creation: Failed creating instance record: Add instance info to the database: Failed to create “instances” entry: UNIQUE constraint failed: instances.project_id, instances.name
-
Updates
No updates yet.
Prerequisites
- You should have a system that runs Incus.
- A system with support for hardware virtualization so that it can run virtual machines.
- A virtual machine image of your preferred Linux desktop distribution.
Cheat sheet
Availability of images
Currently, Incus provides you with the following VM images of Linux desktop distributions. The architecture is x86_64
.
Run the following command to list all available Linux desktop images. incus image
is the section of Incus that deals with the management of images. The list
command lists the available images of a remote/repository, the default being images:
(run incus remote list
for the full list of remotes). After the colon (:
), you type filter keywords, and in this case we typed desktop
to show images that have the word desktop
in them (to show only Desktop images). We are interested in a few columns only, therefore -c ldt
only shows the columns for the Alias, the Description and the Type.
$ incus image list images:desktop -c ldt
+------------------------------------------+---------------------------+-----------------+
| ALIAS | DESCRIPTION | TYPE |
+------------------------------------------+---------------------------+-----------------+
| archlinux/desktop-gnome (3 more) | Archlinux current amd64 | VIRTUAL-MACHINE |
+------------------------------------------+---------------------------+-----------------+
| opensuse/15.5/desktop-kde (1 more) | Opensuse 15.5 amd64 | VIRTUAL-MACHINE |
+------------------------------------------+---------------------------+-----------------+
| opensuse/15.6/desktop-kde (1 more) | Opensuse 15.6 amd64 | VIRTUAL-MACHINE |
+------------------------------------------+---------------------------+-----------------+
| opensuse/tumbleweed/desktop-kde (1 more) | Opensuse tumbleweed amd64 | VIRTUAL-MACHINE |
+------------------------------------------+---------------------------+-----------------+
| ubuntu/24.10/desktop (3 more) | Ubuntu oracular amd64 | VIRTUAL-MACHINE |
+------------------------------------------+---------------------------+-----------------+
| ubuntu/focal/desktop (3 more) | Ubuntu focal amd64 | VIRTUAL-MACHINE |
+------------------------------------------+---------------------------+-----------------+
| ubuntu/jammy/desktop (3 more) | Ubuntu jammy amd64 | VIRTUAL-MACHINE |
+------------------------------------------+---------------------------+-----------------+
| ubuntu/noble/desktop (3 more) | Ubuntu noble amd64 | VIRTUAL-MACHINE |
+------------------------------------------+---------------------------+-----------------+
| ubuntu/plucky/desktop (1 more) | Ubuntu plucky amd64 | VIRTUAL-MACHINE |
+------------------------------------------+---------------------------+-----------------+
$
These images have been generated with the utility distrobuilder
, https://github.com/lxc/distrobuilder The purpose of the utility is to prepare the images so that when we launch them, we get immediately the desktop environment and do not perform any manual configuration. The configuration files for distrobuilder to create these images can be found at https://github.com/lxc/lxc-ci/tree/main/images For example, the archlinux.yaml
configuration file has a section to create the desktop image, along with the container and other virtual machine images.
The full list of Incus images are also available on the Web, through the website https://images.linuxcontainers.org/ It is possible to generate more such desktop images by following the steps of the existing configuration files. Perhaps a Kali Linux desktop image would be very useful. In the https://images.linuxcontainers.org/ website you can also view the build logs that were generated while building the images, and figure out what parameters are needed for distrobuilder
to build them (along with the actual configuration file). For example, here are the logs for the ArchLinux desktop image, https://images.linuxcontainers.org/images/archlinux/current/amd64/desktop-gnome/
Up to this point we got a list of the available virtual machine images that are provided by Incus. We are ready to boot them.
Booting a desktop Linux VM on Incus
When launching a VM, Incus provides by default 1GiB RAM and 10GiB of disk space. The disk space is generally OK, but the RAM is too little for a desktop image (it’s OK for non-desktop images). For example, for an Ubuntu desktop image, the instance requires about 1.2GB of memory to start up and obviously more to run other programs. Therefore, if we do not specify more RAM, then the VM would struggle to make do of the mere 1GiB of RAM.
Booting the Ubuntu desktop image on Incus
Here is the command to launch a desktop image. We use incus launch
to launch the image. It’s a VM, hence --vm
. We are using the image from the images:
remote, the one called ubuntu/plucky/desktop
(it’s the last from the list of the previous section). We configure a new limit for the memory usage, -c limits.memory=3GiB
, so that the instance will be able to run successfully. Finally, the console is not textual but graphical. We specify that with --console=vga
which means that Incus will launch the remote desktop utility for us.
$ incus launch --vm images:ubuntu/plucky/desktop mydesktop -c limits.memory=3GiB --console=vga
Launching mydesktop
Here is a screenshot of the new window with the running desktop virtual machine.