dsoxlab vm create <name> creates a virtual machine in a single command,
with no lab catalogue and no meta.yml file, and hands control back once the
machine answers over SSH. dsoxlab vm ssh <name> connects to it,
dsoxlab vm list shows the machines created this way, and
dsoxlab vm destroy <name> removes the machine along with everything created
for it. This lesson is for anyone who wants a throwaway Linux machine to try a
command or follow a guide, on a workstation that already runs dsoxlab vm
labs.
What you will learn
- Create a VM with
dsoxlab vm create, and read what the command reports. - Connect to the VM with
dsoxlab vm ssh, or withssh <name>.lab. - List the VMs you created, then destroy them without leaving anything behind.
- Choose the distribution, the size and the provider of a VM.
- Recognise the command's refusals: name taken, invalid name, unknown VM.
What you need before you start
dsoxlab vm uses the same tools as vm labs: a hypervisor, the software
that runs virtual machines (KVM or Incus), Terraform, which creates the
machine, and access to /dev/kvm. The lesson
Install dsoxlab locally explains how to set
them up with dsoxlab doctor --fix.
You also need an up-to-date dsoxlab (uv tool upgrade dsoxlab): the first
versions of dsoxlab vm had defects, one of them on Incus, described below.
On a fresh workstation, dsoxlab doctor --fix takes two runs. The first
installs the hypervisor and adds your account to its groups. After you log in
again, the second sets up what only becomes necessary once the hypervisor is
there: Terraform and the Include line in ~/.ssh/config (see below).
When run without a catalogue, dsoxlab doctor still asks for a "Get a
catalogue" step. To use dsoxlab vm on its own, you can ignore it: the
command needs no catalogue.
Create a VM
Without options, the VM is an Ubuntu 24.04 with 2048 MB of memory,
2 vCPUs and a 20 GB disk. It is created on KVM if KVM is present, otherwise
on Incus. Its name, in lowercase letters, digits and dashes, also becomes its
network name, <name>.lab:
dsoxlab vm create guide-endsoxlab writes the machine description itself, under
~/.local/share/dsoxlab/vms/guide-en/, picks a free subnet between
10.10.100.0/24 and 10.10.199.0/24, creates an SSH key, then starts the
provisioning. Output from an Ubuntu 24.04 workstation with KVM:
ℹ VM guide-en: ubuntu24, 2048 MB, 2 vCPU, 20 GB, on kvm, network 10.10.100.0/24.ℹ Provisioning infrastructure (provider: kvm)…
✔ host["guide-en.lab"] (0s) ✔ cloudinit["guide-en.lab"] (0s) ✔ lab (0s) ✔ base_image["ubuntu24"] (40s) ✔ host["guide-en.lab"] (0s) ✔ host["guide-en.lab"] (1s) Creating complete ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 6/6 0:00:42
ℹ Direct connection enabled: ssh <machine> now works (fragment/home/bob/.ssh/config.d/vm-guide-en.conf).✔ Provisioning complete: 1 host(s) ready.ℹ guide-en.lab → 10.10.100.11✔ VM guide-en is ready (10.10.100.11).ℹ Connect: dsoxlab vm ssh guide-en, or ssh guide-en.lab.Read the first line: it sums up the distribution, the size, the provider and
the network chosen. The base_image line, the preparation of the
distribution image, takes most of the time (40 s here). It comes back for
every VM: a second Ubuntu VM created right after needed 41 s on that same
line. The whole command took 73 s on this workstation. The last lines give
the VM's address and the two ways to connect to it.
Connect to the VM
The first way goes through dsoxlab, and always works:
dsoxlab vm ssh guide-enThe second, ssh guide-en.lab, goes through your SSH client. For that,
dsoxlab writes an SSH configuration fragment in
~/.ssh/config.d/vm-guide-en.conf, as the output above says. Your client only
reads it if ~/.ssh/config contains, at the top of the file, the line
Include ~/.ssh/config.d/*.conf. When that line is missing, vm create
warns you, and ssh guide-en.lab does not find the machine.
dsoxlab doctor --fix adds this line for you. With it in place, the SSH
client reaches the VM directly:
ssh guide-en.lab 'hostname; grep PRETTY_NAME /etc/os-release'guide-en.labPRETTY_NAME="Ubuntu 24.04.5 LTS"Once connected, you are on a machine like any other: install, break, start again. Nothing you do there touches your workstation.
List and destroy VMs
dsoxlab vm list shows the VMs created by dsoxlab vm create, with their
provider, distribution, size and address:
VMs┏━━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┓┃ Name ┃ Provider ┃ Distribution ┃ Size ┃ Address ┃┡━━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━┩│ guide-en │ kvm │ ubuntu24 │ 2048 MB · 2 vCPU · 20 GB │ 10.10.100.11 │└──────────┴──────────┴──────────────┴──────────────────────────┴──────────────┘dsoxlab vm destroy <name> destroys the VM, then deletes its files. The
command asks for a confirmation before destroying anything. In a script,
or without a terminal, add --yes: otherwise it stops with exit code 2 and
the message This command asks for a confirmation, and there is no terminal to give it. Output:
dsoxlab vm destroy guide-en --yesℹ Destroying infrastructure (provider: kvm)…
✔ host["guide-en.lab"] (0s) ✔ cloudinit["guide-en.lab"] (0s) [...] Destroying complete ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 6/6 0:00:02ℹ SSH fragment for vm-guide-en removed: it pointed at destroyed machines.✔ Infrastructure destroyed.✔ VM guide-en destroyed, and its files removed.The VM's SSH fragment goes with it. Once the last VM is destroyed,
dsoxlab vm list answers ℹ No VM created with dsoxlab vm create.
The files are deleted only if the destruction succeeded. If it fails, the
folder ~/.local/share/dsoxlab/vms/<name>/ stays in place: it is what lets
you find and remove a machine left running.
Choose the distribution, the size and the provider
The options of dsoxlab vm create change the defaults:
| Option | Effect | Default |
|---|---|---|
--distro | The distribution: ubuntu24, alma10, debian13, ubuntu26… | ubuntu24 |
--ram | Memory, in MB | 2048 |
--cpu | Number of vCPUs | 2 |
--disk | Size of the system disk, in GB | 20 |
--extra-disk | A second empty disk, seen as /dev/vdb, in GB; 0 for none | none |
--provider | kvm or incus | kvm if present, otherwise incus |
For example, for an AlmaLinux 10 on Incus, or for a bigger machine with a second disk, handy to practise LVM:
dsoxlab vm create alma --distro alma10 --provider incusdsoxlab vm create guide-big --ram 4096 --cpu 4 --extra-disk 10Both commands ran. On the alma VM,
/etc/os-release reports AlmaLinux 10.3 (Mauve Lion). For guide-big, the
first line of vm create sums up the requested size (4096 MB, 4 vCPUs,
20 GB). Once connected with dsoxlab vm ssh guide-big, the VM confirms it
from the inside:
nproc; free -m | head -2; lsblk -d -o NAME,SIZE4 total used free shared buff/cache availableMem: 3909 464 3032 2 645 3444NAME SIZEsr0 46Kvda 20Gvdb 10GThe 4 vCPUs are there, the memory seen by the system (3909 MB) is a little
below the 4096 MB requested, because the kernel keeps a share of it, and the
10 GB second disk shows up as vdb. The small sr0 is the configuration disk
that dsoxlab attaches at boot. Mind your workstation's memory: each VM
reserves the amount given by --ram for as long as it runs.
What to do when vm create refuses?
The command checks the name before creating anything. Three refusals come up:
| Message | Cause | What to do |
|---|---|---|
A VM named « guide-en » already exists (…) (code 1) | A VM already has this name | dsoxlab vm ssh guide-en to connect, or dsoxlab vm destroy guide-en to start over |
« Guide_EN » cannot be a VM name: lowercase letters, digits and dashes only, starting with a letter, 32 characters at most. (code 2) | The name contains an uppercase letter or a _ | Pick a name such as guide-en |
No VM named « guide-en ». (code 1) | vm ssh or vm destroy targets an unknown name | Pick a name from dsoxlab vm list |
A name already used by a machine of the hypervisor, created by a catalogue
for example, is refused too: pick another name. If creation fails halfway,
the command says so and suggests dsoxlab vm destroy <name> to remove what
may have been created.
Key takeaways
dsoxlab vm create <name>creates a VM with no catalogue and nometa.yml: Ubuntu 24.04, 2048 MB, 2 vCPUs and 20 GB by default, on KVM, otherwise Incus.- The command hands control back once the VM answers over SSH, and gives its address.
dsoxlab vm ssh <name>always works;ssh <name>.labneeds the lineInclude ~/.ssh/config.d/*.confin~/.ssh/config.dsoxlab vm destroy <name>asks for a confirmation (--yesin a script), removes the VM and its files, and keeps the folder if the destruction fails.--distro,--ram,--cpu,--disk,--extra-diskand--providerchange the machine created.- On a fresh workstation,
dsoxlab doctor --fixtakes two runs, with a new login in between.