77

I have a 64 bit Ubuntu 9.10 workstation with two virtualized guest OSes using KVM/QEMU. Also both 64-bit. One is Fedora 12 the other is beta of Ubuntu 10.04.

The problem is that I would like to use a larger size display that is configured by default. Both guest OSes have a maximum screen resolution of 1024x768. I would like to increase this to something like 1280x900 or 1440x900. The resolution of the host system is 1920x1080.

This configuration appears to be a result of the installation detecting the resolution being reported by the virtual screen during installation.

The only information I have found on the subject suggests modifying the xorg.conf file in the /etc/X11 directory. Neither guest system has this file.

I tried creating one by hand in the Fedora system and managed to render it completely unusable. Not a big deal as this is recently installed and can be reinstalled easily.

Is what I want to do possible? If so, how do I accomplish it?

Jim Reineri
  • 1,037

12 Answers12

33

-vga virtio

Using this option allows me to go all the way up to 4096 x 2160.

Of course, this is useless since my display only goes up to 1080p, so I set 1080p.

Then you can toggle fullscreen with Ctrl + Alt + F, or by passing -full-screen.

How I guessed it: virtio in general means: simulate a generic convenient VM machine without normal hardware restrictions.

Tested with this exact setup: https://askubuntu.com/questions/884534/how-to-run-ubuntu-16-04-desktop-on-qemu/1046792#1046792

As explained there, QEMU has a feature which automatically updates the resolution as you increase the host window size e.g. by dragging the borders with your mouse. But it also works if you go into the guest Ubuntu resolution settings. But if you select a huge guest resolution with a tiny host window, that will of course be useless (QEMU will have to sample multiple pixels into one), so generally you just want to let QEMU automatically scale for you.

This screenshot shows how my guest could go up to 4k:

enter image description here

30

2021 Solution for virt-manager users

Steps

  • Open terminal
  • virt-manager
  • Open VM settings
  • Go to "Video" tab
  • Change to "Virtio"
  • Run / restart VM
  • Open settings in guest OS (eg I run Debian 10 with XFCE so I open XFCE settings)
  • Change display resolution

Here's a screenshot of the relevant tab on virt-manager

settings

user3728501
  • 3,404
  • 9
  • 39
  • 54
17

Use the vmvga Video Card

I use virt-manager (as I'm a complete noob to kvm and libvirt).

I was able to get higher resolutions on a Windows 7 guest by changing the video card from vga to vmvga in the virtual machine's settings window.

diffalot
  • 179
16

Add the '-vga std' flag to the command line

Basically, the virtual machine loads its own virtual driver. Hardware virtualization is necessary because virtual disk images are often copied to many different systems with diverse architectures. By abstracting the hardware the vm images are capable of doing this.

By using the '-vga std' flag you make the GuestOS load a standard VGA device that should be able to support resolution equal-to-or-greater than your physical card can handle.

For more info check out this article.

Note: If you're using an older version of kvm/qemu the you might need to use the '-std-vga' flag instead.

If you aren't able to reach resolutions greater than 1600x1200 note that there are still some issues with this option.

Evan Plaice
  • 1,587
8

I know it's old, but I ended up here in June 2023. I installed Windows 11 on virt-manager and Windows was unable to change my screen resolution (locked at 1280x800, impossible to change). My video is configured as virtio in virt-manager and my user has been added to libvirt and libvirt-qemu groups. But none of that helped.

However, the solution was simple: install virtio-win drivers using an ISO image. Download it HERE. I chose Stable virtio-win ISO.

Destroy666
  • 12,350
Daniel
  • 208
5

As of 2014, if you want to get better than the 1024x768 resolution offered by the Cirrus vGPU, and you are running KVM as your hypervisor on an x86_64 hostOS platform, you should look into using the QXL vGPU driver in the guestOS, coupled with the spice-server display. This can be configured from your virt-manager GUI settings (or of course from CLI args).

In my case, I created the VM using virt-install, put the OS on the vHDD using the normal vnc-style control and the normal cirrus-vGPU. Once everything was working, and all guestOS (and hostOS) software updates had been applied, I used virt-manager to change from vnc-display to spice-graphics, and from cirrus-video to QXL-video. It also helps to add the 'channel' to your VM for spice-vdagent[d] running inside the guest, which allows you to cut-n-paste data in between guestOS apps and hostOS apps pretty decently.

Besides offering high resolutions, the QXL/spice setup was a big improvement over the Cirrus/VNC setup when watching videos in the guestOS -- I actually got some thermal-trip warnings from the CPU when attempting to watch fullscreen videos in 1024x768 Cirrus/VNC, but the laptop ran cool and the fans were quiet when doing fullscreen 1920x1080 video with the more-efficient QXL/spice option. There are limitations on what sort of installations are supported by QXL/spice, but if your system(s) can use them, they are recommended for improved 2D and video-playback. http://www.linux-kvm.org/page/SPICE , scroll down to "Enabling SPICE using virt-manager". I wasn't prompted to add the channel, as the page claims, but it wasn't hard to add manually. If you are working with windows-guestOSes, or having trouble with the brief instructions at the linux-kvm.org site, see here -- http://www.spice-space.org/page/Documentation (but beware both the wiki and the main site are WOEFULLY out-of-date with many pages from 2009 through 2012, so tread carefully). The project is actively developed, but not very actively documented.

QXL/spice is not especially straightforward at the moment, and may not work in your desired software/hardware enVironment. Still, with a bit of elbow-grease it can be made to work, and the upside is significant (especially if battery-life and/or fan noise are concerns). You won't get truly high performance graphics -- investigate VFIO and VT-d/IOMMU passthru for that possibility iff you have the specialized CPU+GPU hardware needed and plenty of time to try and get it working. QXL/spice gives decent 2D and video-playback speed, though.

ntdn
  • 59
4

As of 2023, if you are using a Windows guest you can use Windows SPICE Guest Tools.

How to install Windows SPICE Guest Tools on QEMU/KVM Virtual Machine Manager

To start, make sure inside the VM manager "Show virtual hardware details" -> "Video < Model-Name >" you have QXL selected.

If it looks like this:

enter image description here

then you continue with the following steps.

The Process

  1. Start the Windows VM.

  2. Open your favorite browser, inside the Windows VM.

  3. Go to SPICE Website Download Page.

enter image description here

  1. Scroll down to "Windows binaries".

  2. In the first sentence you should see:

  • "Windows SPICE Guest Tools (spice-guest-tools)"
  • Click -> (spice-guest-tools) to download it on the Guest VM.

enter image description here

  1. Run through the installer. The defaults should be fine.

enter image description here

  1. Restart

You should now be able to change the "Display resolution" in the Windows VM.

enter image description here

Hopefully this helps.

Toto
  • 19,304
sonAndrew
  • 141
2

-vga std is the default, so if it does not work for you, explicitly specify it is useless. -vga virtio should be a good option. While, remember install the drivers if it does not already installed kvm-guest-drivers-windows.

Sometimes, resolution is limited by ram or vram available for the display device. So if -vga type does not work, try to use

-vga none \
-device driver[,prop[=value][,...]] \

So you can adjust (increase the ram and vram) the display device to support larger resolutions.

-device driver[,prop[=value][,...]]

Add device driver. prop=value sets driver properties. Valid properties depend on the driver. To get help on possible drivers and properties, use -device help and -device driver,help.

qemu-system-x86_64 -device help

By this above command, you can get all possible drivers, then look Display devices: section to find the right device. For example, if you choose qxl-vga, then you can use:

qemu-system-x86_64 -device qxl-vga,help

Get the options available for this device.

Then you can use your device with its options like:

qemu-system-x86_64 \
  -vga none \
  -device qxl-vga,ram_size=268435456,vgamem_mb=256,vram_size=268435456 \
Lee Li
  • 181
1
  1. Boot into shell mode with QEMU. If you use a custom kernel, then add init=/bin/bash after rw in the append argument. (e.g. -append "root=/dev/sda2 panic=1 rootfstype=ext4 rw init=/bin/bash") Otherwise, you could boot into recovery mode, which will also give you a root shell. (This is all from the guest OS, the one you are running in QEMU)
  2. After you boot into shell mode, you will have a root/su shell, with no GUI.
  3. Now run: nano /etc/X11/xorg.conf. This will be a new file.
  4. Type:
Section "Screen"
    Identifier "Default Screen"
    SubSection "Display"
        Depth 16
        Modes "800x600" "640x480"
    EndSubSection
EndSection
  1. Reboot

NOTES:

  • The extra "640x480" is in case the "800x600" fails.
  • I can't get it to '1024x768'. It will just fall back to 800x600
1

2023 called and the Spice Guest Tools is freely available here (look for the spice-guest-tools link):

https://www.spice-space.org/download.html

0

In the guest install spice-vdagent, so guest and host can communicate window size changes.

-4

The solution "2021 Solution for virt-manager users" by user3728501 is work for me

I have follow the solution from him and this work for me THANK YOU!

I wrote this on 25 June 2021 at 8:28 a.m.

I use Ubuntu 20.04

before I install the new program I ran

sudo apt update && sudo apt upgrade -yy

then I search "how to install qemu virt-manager ubuntu 20.04" from google

I have install virt-manager qemu by follow : https://phoenixnap.com/kb/ubuntu-install-kvm

at the step to add user I ran :

sudo adduser $USER libvirt

sudo adduser $USER libvirt-qemu

reboot

after I the installation and add user done I have reboot my system

now my system has start up then I open the virt-manager(using my normal GUI interface)

just create one guest OS for testing in my case I have download Manjaro iso image in ~/Downloads so I will use this image and after create the guest os successfully I have run the "update" in my guest OS by the command

pamac update

then I shutdown my guest OS and back to my virt-manager window I selected :

Sorry they not allow me to post the image but the image link is here:

https://i.ibb.co/LCxJdkV/2021-06-25-qemu-guest-window-resize.png

by the way my Ubuntu 20.04 I am using i3wm instead of the default window manager as I like i3wm because it easier for me to using i3

I have my bash script : https://github.com/farookphuket/ubuntu_my_config.git

I am thai so my english speaking is quite bad I am sorry but I have make a video how do I setup i3wm for manjaro using my bash script :

https://www.youtube.com/watch?v=q3Sanjl93dQ

hope this help someone

thank you