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/tweaks/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 , . Bookmark the permalink.

10 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!

  3. The requested URL /adblock/kvm.xorg.conf was not found on this server.

  4. bodhi.zazen says:

    @ Gary Friedman

    I moved it here : http://bodhizazen.net/tweaks/kvm.xorg.conf

    /me goes to update blog …

  5. Halodude says:

    does this work with bodhi Linux too? I’m just a bit confused because you said it was for KVM.

    Apologies if I come across as being a noob

  6. bodhi.zazen says:

    @Halodude :

    I am not sure where the confusion comes from so a little background so we are all on the same page.

    KVM is a virtualization technology

    http://www.linux-kvm.org/page/Main_Page

    This how to is written for Linux Guests.

    So yes this how-to would work if you are running bodhi linux as a guest using KVM (as opposed to vmware or virtualbox), but not if you are running bodhi linux outside of KVM.

  7. Kattfisken says:

    Don’t you find the standard VGA driver to be incredibly slow? Or is it just newer Ubuntu/Debian where it’s excrutiatingly slow?

  8. bodhi.zazen says:

    Yes it is slow and this is an old post.

    The current solution is to use spice.

  9. Kattfisken says:

    When I say slow, I mean so slow you see every new window you move/create actually being written line by line. It’s basically not usable. Spice… that’s Fedora right? My problem here is that I really want std VGA to work, because it seems to be the only thing to support the TeamViewer software. Surely other people have the same problem, where they for some reason want the std VGA driver to work fluently in 2D environments?

  10. bodhi.zazen says:

    @Kattfisken – Yes, it can be very slow. Try spice, problem is last I looked spice was not fully imported to Debian / Ubuntu as of yet, but there is a ppa you can try. spice is very fast.

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>