Skip to content

How to Start a KVM, Xen or OpenVZ VM from the Command Line

Updated 6 min read

Updated: 12 October 2026 · Applies to: KVM hosts with virsh (libvirt 11.3.0) and virt-install 5.0.0 on Debian 13, tested with the libvirt test driver; Xen 4.20 xl tools (Debian 13 package); OpenVZ and Virtuozzo (prlctl, vzctl) and SolusVM 1 and 2 (from vendor documentation)

To start (launch) an existing virtual machine from the command line, log in to the host node as root and run the start command of its hypervisor:

virsh start web01               # KVM (libvirt)
xl create /etc/xen/web01.cfg    # Xen
prlctl start 101                # OpenVZ 7 and Virtuozzo
vzctl start 101                 # OpenVZ

These commands run on the server that hosts the virtual machines, not inside a VPS. If you have a Ucartz VPS, you start, stop and reboot it from the client area instead: see the last section.

1. KVM: start a VM with virsh

  1. List all VMs (libvirt calls them domains) with their state. Plain virsh list shows only running ones:
    # virsh list --all
     Id   Name    State
    ------------------------
     1    test    running
     -    web01   shut off
  2. Start the VM by name:
    # virsh start web01
    Domain 'web01' started
  3. Check that it runs:
    # virsh domstate web01
    running
  4. Make it start automatically when the host boots:
    # virsh autostart web01
    Domain 'web01' marked as autostarted
    virsh list --all --autostart shows every VM with autostart on.

The output above is a lab example from libvirt's built-in test driver in a Debian 13 container, which simulates a KVM host (it always includes a VM called test). The virsh messages are the same on a real host. Run virsh as root or with sudo: as a normal user it connects to your own user session and does not see the system's VMs. More listing options: virsh list Command: List All KVM and QEMU Virtual Machines (Domains) on Linux.

Other start options and messages you may see:

  • virsh start web01 --console starts the VM and attaches to its console; --paused starts it paused.
  • error: Domain is already active: the VM is already running.
  • error: failed to get domain 'db02': there is no VM with that name; check the spelling with virsh list --all.
  • To start a VM from an XML file, virsh define /srv/vm/web01.xml registers it permanently, then virsh start web01 starts it. virsh create /srv/vm/web01.xml starts a temporary (transient) VM that is not kept after it stops.

To start every VM that is shut off, for example after a host reboot without autostart:

for vm in $(virsh list --name --state-shutoff); do virsh start "$vm"; done

To stop a VM, virsh shutdown web01 asks the guest to shut down cleanly, and virsh destroy web01 cuts its power at once (it does not delete the VM).

2. KVM: launch a new VM with virt-install

To create a new VM and boot it from an installer ISO in one step, use virt-install (package virtinst). Memory is in MiB and the disk size in GiB:

# virt-install --name web02 --memory 2048 --vcpus 2 --disk size=20 \
    --cdrom /srv/vm/debian-13.iso --os-variant debian13 --noautoconsole
Starting install...
Allocating 'web02.qcow2'                                    |  20 GB  00:00
Creating domain...                                          |         00:00

Domain is still running. Installation may be in progress.
You can reconnect to the console to complete the installation process.

(Lab example from the libvirt test driver.) Add --dry-run to check the options without creating anything, and run virt-install --osinfo list to see the accepted --os-variant names. According to the virt-install manual, setting the OS lets it enable fast virtio devices.

3. Xen: start a domain with xl

Xen guests are started from their configuration file with xl, which replaced the old xm tool. If an old guide says xm create, use xl create:

xl create /etc/xen/web01.cfg       # start the domain
xl create -c /etc/xen/web01.cfg    # start it and attach to its console
xl list                            # running domains (Domain-0 is the host)
xl shutdown web01                  # clean shutdown
xl destroy web01                   # immediate power off

According to the xl manual, xl create returns as soon as the domain is started, which does not mean the guest OS has finished booting. On Debian 13 the Xen tools (version 4.20) install example configurations in /etc/xen/ (xlexample.hvm, xlexample.pvhlinux and xlexample.pvlinux).

To start a domain automatically at boot, put its configuration file (or a link to it) in /etc/xen/auto/. The xendomains service starts the domains found there, as set by XENDOMAINS_AUTO=/etc/xen/auto in /etc/default/xendomains:

mkdir -p /etc/xen/auto
ln -s /etc/xen/web01.cfg /etc/xen/auto/

If xl list answers ERROR: Can't find hypervisor information in sysfs! (as it did in our test container), the system is not running on the Xen hypervisor. Reboot the host into its Xen boot entry first.

4. OpenVZ and Virtuozzo: start a container

According to the OpenVZ documentation:

vzlist -a              # all containers (without -a only running ones)
vzctl start 101        # start container 101
vzctl start 101 --wait # wait until it has reached its default runlevel
vzctl stop 101
vzctl status 101
prlctl start 101       # OpenVZ 7 and Virtuozzo 7
prlctl enter 101       # open a shell inside the container

vzctl start --force starts a container that has been disabled. More commands: OpenVZ useful commands.

5. SolusVM nodes

The virtual servers on a SolusVM node are ordinary KVM guests, Xen domains or OpenVZ containers, so the commands above work on the node itself. According to SolusVM's documentation:

  • SolusVM 1: its command-line utilities in /usr/local/solusvm/scripts/ on the master have no boot command. Start a server from the admin panel or with the admin API function vserver-boot (variable vserverid). After starting VMs by hand on a node, update their status in the panel with php /usr/local/solusvm/scripts/cli.php --action=statusupdateall, which does the same as refreshing Node > Virtual Servers.
  • SolusVM 2 manages KVM virtual machines and Virtuozzo/OpenVZ containers and has a REST API that can do anything the web interface can, including starting servers.

SolusVM says SolusVM 1 remains supported but gets no major new features, and recommends SolusVM 2, which is under active development. Panel users can follow How to Start or Boot Your VPS via SolusVM.

Starting a Ucartz VPS

Ucartz KVM VPS run on Virtualizor and are managed from the Ucartz client area. Your VPS is a guest on our node, so customers cannot run hypervisor commands for it, and there are no VMs to start from inside the VPS. Use the client area instead:

To run your own virtual machines with KVM, you need a host you control, such as an unmanaged dedicated server. Background: What Is KVM Virtualization and How Does a KVM VPS Work.

Official documentation: virsh(1), xl(1) and the SolusVM documentation.

Related services

KVM VPS hosting

NVMe SSD and full root access, with Free Basic Managed Support.

Managed cPanel VPS

cPanel included; we handle updates, security and monitoring.

Was this answer helpful?

Still stuck? Open a ticket