How to launch an instantly functional Linux desktop VM with LXD


Duration: 1:00

Besides system containers, LXD supports virtual machines as of the previous 4.0 LTS. This enabled a nifty addition that many are not familiar with: LXD desktop images. These virtual machine images provide an immediately functional desktop environment with no setup needed at all! All you need is a single command.

What you’ll learn

How to launch an instantly functional Linux desktop VM

What you’ll need

  • Ubuntu Desktop 16.04 or above

  • LXD snap installed and running

Initiate an Ubuntu Desktop VM

Duration: 1:00

To initiate a desktop image we need a single command. We will launch an image from the LXD image server, name the instance Ubuntu, and designate that it should be a VM. Since we’re launching a virtual machine that needs more resources than a simple container, we should increase the CPU and memory limits. Finally, in order to immediately get the video output, we need to add - -console=vga.

The full command for launching an Ubuntu 22.04 VM would then look like this:

lxc launch images:ubuntu/22.04/desktop ubuntu --vm -c limits.cpu=4 -c limits.memory=4GiB --console=vga

These images are bigger than usual, but it should take less than a minute (depending on your internet speed) for the image to be downloaded and launched. You should then get a remote viewer window with your desktop VM, as shown below.

Let’s do one more - Archlinux Desktop VM

Duration: 1:00

Launching an Archlinux Desktop VM is similar to what we’ve done previously with Ubuntu, with a single addition - disabling secure boot.

The full command for launching an Archlinux VM would then look like this:

lxc launch images:archlinux/desktop-gnome archlinux --vm -c security.secureboot=false -c limits.cpu=4 -c limits.memory=4GiB --console=vga

And again, you should have a fully functional Archlinux VM in under a minute.

It’s that easy

Duration: 1:00

That’s all, folks. It’s that easy to launch an immediately functioning desktop VM.

Please note: at the time of writing, the available desktop images are: Ubuntu/22.04, Ubuntu/21.10, Ubuntu/20.04, Archlinux/desktop-gnome, Opensuse/15.3/desktop-kde, Opensuse/tumbleweed/desktop-kde.

For an up to date list, you can visit the community image server.

If you’d like to know more about LXD, take a look at the following resources:

If you have further questions or need help, visit the discussion forum.