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.

18 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.

  11. Cerhn says:

    Good site, thanks for the help. The xorg config did not work, but the tutorials were of great use in getting xen/libvirt up and running,

  12. Fede Agostini says:

    I want to configure a 16:9 screen resolution. I execute:

    $ gtf 1920 1080 60 -x

    # 1920x1080 @ 60.00 Hz (GTF) hsync: 67.08 kHz; pclk: 172.80 MHz
    Modeline "1920x1080_60.00" 172.80 1920 2040 2248 2576 1080 1081 1084 1118 -HSync +Vsync

    $ sudo xrandr --newmode "1920x1080_60.00" 172.80 1920 2040 2248 2576 1080 1081 1084 1118 -HSync +Vsync

    $ sudo xrandr --addmode default 1920x1080_60.00

    $ xrandr
    xrandr: Failed to get size of gamma for output default
    Screen 0: minimum 640 x 480, current 1680 x 1050, maximum 1920 x 1200
    default connected 1680x1050+0+0 0mm x 0mm
    1920x1200 0.0
    1600x1200 0.0
    1680x1050 0.0*
    1400x1050 0.0
    1280x1024 0.0
    1440x900 0.0
    1280x960 0.0
    1280x800 0.0
    1024x768 0.0
    800x600 0.0
    640x480 0.0
    1920x1080_60.00 60.0

    But i have this error.

  13. Fede Agostini says:

    Sorry… this error

  14. Fede Agostini says:

    well… I have a problem with links.
    Error

  15. bodhi.zazen says:

    @Fede Agostini I see the link, but what is the problem ? the gma500_gfx driver does not allow changing resolution. Or it your resolution off ?

  16. Pingback: CentOS 6 使用紀錄 « 喝茶也喝咖啡

  17. joe says:

    Hey thanks for getting me on the right track. I needed to add a ModeLine for my virtual guest but didn’t know where to find the settings. This helped: http://www.x.org/wiki/FAQVideoModes/#index3h2

  18. Cyrus says:

    Thanks… It works like a charm….
    for new comers to libvirt in order to edit the guest xml file run the folloing at host
    #virsh edit
    go to
    and change the type

Add Comment Register



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>