Table of Contents

Client Resolution

To fix or automate the display resolution for an XFCE guest using LightDM inside virt-manager (QEMU/KVM), you generally need to address two distinct parts: the LightDM login screen and the XFCE user desktop session.

Step 1: Install Spice Guest Tools

This enables Auto-Resizing for your desktop environment to automatically match your virt-manager window size, you must have the guest agent installed and running inside the virtual machine.

# apt install spice-vdagent qemu-guest-agent
# systemctl enable --now spice-vdagentd

Step 2: Fix LightDM Login Screen Resolution

The LightDM login screen loads before your XFCE session profile, which often makes it fallback to a tiny default resolution (like 800×600). You can force it to a specific size using xrandr. Find out the display output name of your virtual monitor. Run this in a terminal inside the VM:

xrandr

Look for the connected device name. In virt-manager, it is usually Virtual-1 (or Virtual-0, VGA-1). Open the LightDM configuration file:

# nano /etc/lightdm/lightdm.conf

Scroll down or search (Ctrl + W) for the [Seat:*] section. Look for the display-setup-script line. Uncomment it (remove the #) and add your targeted xrandr command. For example, to force a 1920×1080 resolution:

...
[Seat:*]
...
display-setup-script=xrandr --output Virtual-1 --mode 1920x1080

(Replace Virtual-1 with your actual output name and 1920×1080 with your desired target resolution). Save file and restart the client.

Step 3: Optimize Virt-Manager Hardware Settings

(If still limited)If you cannot select higher resolutions inside XFCE's Settings > Display, you may need to adjust the virtual hardware layout:

  1. Shut down the virtual machine.
  2. Open the VM's hardware details window (the Lightbulb icon in virt-manager).
  3. Select the Video device:
    1. Recommended Layout: Set the model to Virtio (with 3D Acceleration disabled if XFCE experiences black screen bugs) or QXL.
    2. RAM Allocation: If using higher resolutions (like 1440p or 4K), increase the Video RAM or vgamem value from 16MB to 64MB or 128MB to ensure the virtual framebuffer can support the pixel density.
  4. Make sure your Display device is set to Spice server.
  5. Boot the VM

Step 4: Fallback Script for Sticky XFCE Resizing

If XFCE forgets your resolution on reboot despite spice-vdagent running, you can force it into your user profile via XFCE Autostart:

With these configurations in place, LightDM will scale elegantly on startup, and your XFCE desktop will automatically expand to match your host monitor. If your screen stays black or fails to register changes, let me know your Linux host/guest distribution and the exact Video model type you selected in virt-manager!