Skip to content

virt-manager — the GUI for libvirt, used the way operators actually use it

A practical walkthrough of virt-manager — connecting to a remote host, creating a guest, editing hardware, attaching a console — for operators who prefer the desktop.

virt-manager is the desktop GUI for libvirt. It speaks the same libvirt API as virsh, so anything done in the GUI is reflected in the XML and vice-versa. For laptops attached to a fleet of headless KVM hosts it’s a friendly day-job tool — connect over SSH, see thumbnails of every guest, open a console window, edit hardware visually. This article is the walkthrough for someone whose first interaction with KVM is the GUI rather than the CLI.

How to verify

virt-manager is an X/Wayland desktop application; you install it on the operator’s workstation, not the hypervisor. It depends on libvirt-glib and ssh-askpass for remote connections.

# On Linux desktop
sudo apt install virt-manager
which virt-manager && virt-manager --version

# On macOS via brew (uses XQuartz)
brew install virt-manager

# Verify your SSH access to the hypervisor uses key auth, not password
ssh -o BatchMode=yes ops@kvm-host.example 'virsh list --all'

The SSH check matters — virt-manager spawns SSH to talk to remote libvirt, and an interactive password prompt during the connection produces a frustrating loop.

What’s happening

virt-manager is a thin GTK frontend over libvirt-glib. When you “connect to a remote host,” it spawns ssh user@host -- nc -U /var/run/libvirt/libvirt-sock (or the LXC tunnel transport) and pipes libvirt RPC over that. There is no agent or service to install on the hypervisor beyond libvirtd. The console view embeds either VNC or SPICE; the embedded viewer is gtk-vnc or virt-viewer.

Every action in the GUI ultimately calls a libvirt API method. “Power off” runs virDomainDestroy; “Force off” is also virDomainDestroy (no graceful API call); “Shutdown” is virDomainShutdown. Knowing this lets you correlate what you click to what the libvirtd log records.

The procedure

  1. Install on the workstation, not the host. virt-manager runs on your desktop and connects out to KVM hosts:

    sudo apt install -y virt-manager virt-viewer
    virt-manager &
  2. Add a remote connection. File → Add Connection. Hypervisor: QEMU/KVM. Connect to remote host over SSH. Username: your ops account. Hostname: the KVM host. Check “Autoconnect” if this is a host you visit daily:

    Connection URI: qemu+ssh://ops@kvm-host.example/system

    The first connection prompts for SSH host-key verification — accept it, and from then on the connection opens with no prompts (provided your key is in ~/.ssh/authorized_keys on the host).

  3. The main window. Each host is a top-level item showing every defined domain. Right-click → Open opens the console viewer; double-click does the same. Right-click → Run starts a stopped domain. Right-click → Migrate moves a domain to another connected host.

  4. Create a new virtual machine. File → New Virtual Machine, or the icon. Four screens: install media (ISO, network install, import existing disk, manual), OS detection (let virt-manager fill in osinfo from the ISO), memory and CPU, disk. Past those, virt-manager assembles the XML and starts the install. For headless production guests, prefer virt-install from the CLI (see virt-install CLI) — the GUI is faster for one-off lab work.

  5. Edit a guest’s hardware. Open the guest, click the lightbulb icon in the toolbar. Left pane lists each device (CPU, memory, disks, NICs, controllers, channels). Right pane shows the XML fragment for the selected device. Adding a NIC, attaching a CD-ROM, changing the VNC listen address — all via the Add Hardware button. Changes apply on next boot unless the device supports hotplug (virtio disks, virtio NICs do; CPU and memory require additional XML setup).

  6. Console access. The console icon (top-left in the guest window) attaches to either the serial console or the graphical (VNC/SPICE) console. Headless cloud images give you serial; Windows guests give you graphics. Ctrl+Alt+Shift+F detaches the keyboard grab; Ctrl+Alt+Shift+R sends Ctrl-Alt-Del.

  7. Snapshots — usable but limited. Snapshot pane lets you create internal snapshots only. External snapshots (the production-grade kind) need virsh — see virsh basics.

Operational notes

  • qemu+ssh:// requires nc (netcat-openbsd) on the remote host — minimal containers and stripped-down RHEL images sometimes lack it. The fix is sudo apt install netcat-openbsd (or nmap-ncat on RHEL).
  • A connection that fails with Failed to connect socket to '/var/run/libvirt/libvirt-sock': Permission denied means the SSH user is not in the libvirt group on the remote host.
  • The console viewer freezes if the network between your laptop and the host gets lossy; close the console window (not the guest), then reopen.
  • virt-manager edits to a running guest are persisted to XML only when the guest is shut down and started again — “live” edits show in the GUI but a power-cycle reverts them unless you also tick the persistent option.
  • On Wayland desktops, the console window sometimes loses keyboard focus mysteriously; using virt-viewer directly (virt-viewer -c qemu+ssh://ops@kvm-host/system web01) avoids the issue.

Stack Harbor uses virt-manager as one of several front doors to a libvirt fleet — operators on macOS or Linux laptops have it for ad-hoc work, but every standing change is captured in config management. Clients with a “wild west” KVM environment, where every VM was created in the GUI and nobody knows which host has which disks, get that consolidated through onboarding to Managed Operations.