Skip to content

KVM SPICE Display Not Working — Quick Fix

DodaTech Updated 2026-06-24 3 min read

In this tutorial, you'll learn about KVM SPICE Display Not Working. We cover key concepts, practical examples, and best practices.

The Problem

The SPICE display console for a KVM VM cannot be opened or shows a black screen. The connection may be refused, or the SPICE server inside the guest may not be responding. Clipboard sharing and USB redirection may also fail.

Error example:

Unable to connect to SPICE server.
Connection refused at 127.0.0.1:5900
Cannot complete the SPICE connection: Authentication failed

The Fix

Step 1: Verify the VM has a SPICE video device

WRONG — using VNC and assuming SPICE works:

# VNC and SPICE are different display protocols
# The VM must be configured for SPICE

RIGHT — check the VM's video configuration:

virsh dumpxml vm-name | grep -A 5 "<graphics"

Output:

<graphics type='spice' port='5900' autoport='yes' listen='127.0.0.1'>
  <listen type='address' address='127.0.0.1'/>
</graphics>
<video>
  <model type='qxl' ram='65536' vram='65536' vgamem='16384' heads='1'/>
</video>

If the graphics type is vnc, SPICE will not work. Change it with virsh edit vm-name and update the guest driver to use qxl video.

Step 2: Fix SPICE authentication

WRONG — using a password-less SPICE connection over the network:

# SPICE passwords protect VMs from unauthorized access
# But incorrect password codes cause connection failures

RIGHT — set or clear the SPICE password:

# Set a password
virsh edit vm-name
# Add: <graphics type='spice' password='mypassword' port='5900' autoport='yes'/>

# Or remove password for local only
virsh edit vm-name
# Remove the password attribute

Use DodaTech's Remote Console Manager to securely connect to SPICE consoles without manual password configuration.

Prevention Tips

  • Use SPICE instead of VNC for better performance and USB redirection
  • Install SPICE guest tools (spice-vdagent) inside the guest for clipboard integration
  • Configure TLS encryption for SPICE connections over untrusted networks
  • Use autoport='yes' to avoid port conflicts between VMs
  • Use DodaTech's Display Protocol Benchmarker to choose between SPICE and VNC

Common Mistakes with spice display

  1. Non-exhaustive pattern matches that compile with warnings then crash at runtime
  2. Misunderstanding that String is [Char] with poor performance for large text operations
  3. Using foldl instead of foldl' causing stack overflow on large lists

These mistakes appear frequently in real-world KVM code. DodaTech's contributors have identified these patterns through analysis of open-source projects and production systems.

Practice Exercise

Write a pure function that safely divides two integers using Maybe, then test it with edge cases like division by zero and negative numbers.

This exercise reinforces the concepts covered in this guide. Try implementing it before checking online solutions.

FAQ

### What is the difference between SPICE and VNC?

SPICE (Simple Protocol for Independent Computing Environments) supports multi-monitor setups, USB redirection, clipboard sharing, and audio streaming. VNC is simpler but lacks these features. SPICE offers better performance for desktop workloads, while VNC is more widely supported by clients.

Why does SPICE show a black screen after VM boot?

The SPICE guest agent (spice-vdagent) may not be installed or running inside the guest. Install it with apt install spice-vdagent or yum install spice-vdagent. For Windows guests, install the SPICE guest tools from the virtio driver ISO.

How do I enable SPICE over the network securely?

Change the listen address to 0.0.0.0 or a specific IP, and configure TLS certificates in the /etc/pki/libvirt-spice/ directory. Use virsh edit to add <graphics type='spice' port='5900' listen='0.0.0.0' autoport='no' tlsPort='5901'/> and distribute the client certificate to SPICE clients.

Related: DodaTech's KVM Remote Access Gateway provides secure SPICE proxy access to VMs, eliminating the need for direct SPICE port exposure.

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro