How to improve resolution in KVM

Once again I found myself trying to “fix” something that has been bothering me for some time – the Resolution in KVM guests is sometimes poor, as low as 800×600.

As it turns out, one can increase the resolution of the guests much higher by using a custom xorg.conf and the std vga driver.

Save the following in /etc/X11/xorg.conf in the Guest OS.

Direct download – bodhi.zazen’s kvm xorg.conf

As root run:

wget http://bodhizazen.net/adblock/kvm.xorg.conf -O /etc/X11/xorg.conf

xorg.conf

Section "ServerLayout"
Identifier "BodhiZazen’s KVM xorg.conf"
Screen 0 "Screen0" 0 0
InputDevice "Mouse0" "CorePointer"
InputDevice "Keyboard0" "CoreKeyboard"
EndSection

Section "Module"
Load "record"
Load "dri"
Load "extmod"
Load "glx"
Load "dbe"
Load "dri2"
EndSection

Section "InputDevice"
Identifier "Keyboard0"
Driver "kbd"
EndSection

Section "InputDevice"
Identifier "Mouse0"
Driver "vmmouse"
Option "Protocol" "SysMouse"
Option "Device" "/dev/sysmouse"
Option "ZAxisMapping" "4 5 6 7"
EndSection

Section "Monitor"
Identifier "Monitor0"
VendorName "Monitor Vendor"
ModelName "Monitor Model"
HorizSync 20.0 – 50.0
VertRefresh 40.0 – 80.0
Option "DPMS"
EndSection

Section "Device"
Identifier "Card0"
Driver "vesa"
VendorName "Cirrus Logic"
BoardName "GD 5446"
BusID "PCI:0:2:0"
EndSection

Section "Screen"
Identifier "Screen0"
Device "Card0"
Monitor "Monitor0"
SubSection "Display"
Viewport 0 0
Modes "1600×1200"
EndSubSection
EndSection

Note: The vmware mouse driver is installed on most distros by default. If you need to install it use:

# Fedora
yum install xorg-x11-drv-vmmouse

#Debian / Ubuntu
apt-get install xorg-input-vmmouse

If you need a higher/lower resolution, change “1600×1200″ to your desired resolution.

Finally, when we restart KVM use the “std” video driver. The default video driver is cirrus.

kvm -m 512 -vga std -disk file=/path/to/linux.qcow,cache=writeback,media=disk

You may specify vga from Virtmanager or in your guest xml file (if you are using libvirt).

<model type='vga' vram='9216' heads='1'/>

This entry was posted in Linux and tagged KVM, Virtualization. Bookmark the permalink.

2 Responses to How to improve resolution in KVM

  1. Pingback: Shadows of epiphany » Blog Archive » How to improve resolution in KVM | Linux Affinity

  2. Pjotr says:

    Excellent article, this was exactly my problem I googled a few days ago. Thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>