Virt-Manager Beginner Tips (Shallow Thoughts)

Akkana's Musings on Open Source Computing and Technology, Science, and Nature.

Mon, 25 Apr 2022

Virt-Manager Beginner Tips

A couple of small tips on QEMU/KVM/VirtManager that I picked up while migrating my Windows 10 virtual machine from VirtualBox, for use once you get virt-manager running and migrate your VirtualBox VMs to virt-manager/QEMU:

How to change the Screen Resolution

Like VirtualBox, VirtManager gives you a 1024x768 window by default. To change that, in the info/lightbulb screen, under Video change to Virtio. Then when you're booted into the guest OS, you can change resolution in Display Settings.

Start Your VM from the Command Line

It's kind of a hassle to start the virt-manager console, doubleclick on the VM and start it, then minimize the console so it's not in the way. Is there a way to go straight to the VM window?

I found two ways that work but do require that you have virt-manager set up. Starting it in pure qemu is harder.

The easist way:

virt-manager --connect qemu:///system --show-domain-console win10
brings up the VM window, no need for the virt-manager console. If qemu:///system isn't the session you're using, To get the URI for the connection, use Edit/Connection Details from virt-manager's console window to find the right URI.

Or you can use virsh. Find the name of your VM (mine is win10) with

virsh list --all

You can start it with virsh start win10 — but that starts it up without giving you a window. Maybe useful for Linux server sessions, not so good for a Windows desktop. Besides which, virsh shutdown win10 gives a message "Domain 'win10' is being shutdown", but doesn't actually shut it down (as virsh list --all will show you). You have to kill it ungracefully with virsh destroy win10.

If you want to see a window, you can get one with virt-viewer win10, but first you have to install virt-viewer, a separate program that isn't included automatically with virt-manager.

But is there a way to start it using just qemu and not virt-manager? You can look at /var/log/libvirt/qemu/win10.log (you'll probably need sudo for that) to get the commandline arguments virt-manager is passing to qemu. But there's an easier way:

virsh domxml-to-native qemu-argv --domain win10
gives you the whole, incredibly long, command line.

However, with either of these you probably won't be able to run it; the flags virt-manager uses depend on a temporary directory that libvirt creates plus pseudo-devices and services unique to libvirt. So if you want to be able to run your VM in QEMU without the need for libvirt, you'll need to do some experimenting. You can use this article as a starting point, but it references lines my virt-manager doesn't use and suggests replacements that don't work any more.

There's one more thing I wanted to do: share a directory between the Linux host and Windows Guest. In VirtualBox you just give it the path to the shared folder. In virt-manager/QEMU, I've spent a day on it so far, with no success, so I'll make that a separate article.

Tags: , , ,
[ 14:33 Apr 25, 2022    More linux | permalink to this entry | ]

Comments via Disqus:

blog comments powered by Disqus