QEMU and KVM Problems

14 replies [Last post]
Telinome

I am a member!

Offline
Joined: 08/13/2013

I'm not sure what help I hope to get, as I really don't know much about my problem.

A while ago, after struggling to get it working, I finally got VirtualBox working, and it worked great. Then, I upgraded to Trisquel 7 when it first came out, and because there were parts that didn't work right, I ended up reinstalling 6.0.1. I never bothered to go through all that trouble again to set up VirtualBox.

Now, though, I want to take another look at 7 in a virtual machine to see how it's progressed. VirtualBox is pretty much off the table, since I use jxself's kernel (I have both 3.14 and 3.10 installed), which doesn't include the necessary VirtualBox module. So, taking the advice of the forums, I've been experimenting with QEMU and KVM.

My first few experiments were disasters. Nothing worked, and while I find the help giving on this forum usually useful, the QEMU and KVM documentation is so far above my head, I can't get anything out of it.

Finally, using virt-manager and KVM, I've been able to get some things running. I changed the default directory to a place on my data drive instead of my OS drive, so I had a ton of space to work with. I've been able to create a few guest machines, and even managed to install a few OSs. But I still encounter lots of problems.

1) I can't bridge my network interfaces like it describes at https://trisquel.info/en/wiki/virtualization-using-kvm. I know I don't have a static IP address, so I use the dhcp option. But, my computer is connected to the internet through a wireless connection (I'm working on drilling a hole in the wall to run an ethernet cord through it). If I try to change the bridge_port to wlan0, I get an error that says a bridge cannot be connected to it. If I leave it as eth0, I don't get an error, but when I do ifdown/up, I get the message about "Waiting for br0 to get ready", and even after walking away for f10 minutes, nothing happens.

2) There are plenty of times where the guest machines don't boot. They spew lots of post screen errors instead. Generally, closing down the machine and virt-manager altogether, then trying again will solve it. But sometimes, I have to delete the entire guest machine because once it breaks, it doesn't ever come back.

3) Everything in my virtual machines is extremely sluggish. I've read that running in KVM should be nearly as fast as running on a physical machine, but that is not my experience at all. I've tried to work out this virtio stuff, but the documentation is again so far above me that I can't even tell if I HAVE virtio available. The mouse is one of the worst culprits--it moves slowly and gets trailed by 4-5 other pointers behind it. I tried adding a tablet to the guest machine, but upon booting up the guest machine, it doesn't recognize that setting. Maybe it's because I don't actually have a physical writing tablet connected to the computer (the tip and documentation don't say anything about it other than "add and make a writing tablet the default pointer").

4) Sometimes, the visual display is awful. I installed Mint 17 XFCE as a test in a guest machine, and many of the visual elements were corrupted and unrecognizable, which is not the case when I boot up the Live CD on my computer to compare. AT least this wasn't a problem with trying to test out Trisquel 7, but I noticed that some of the other visual effects that I remembered from my brief time using 7 weren't there, either.

4) There are so many settings for the machines in virt-manager that I don't understand, so I can't tell if one of them helps me more than the others.

While it took me a long time to get VirtualBox to actually up and run, once I was able to boot the guest machines and install OSs, the guest machines ran like dreams with very little need for tweaking. I was hoping that, using graphical tools like virt-manager or AQEMU, I would be able to get the same results with QEMU and KVM.

Because I'm so very lost, I can't really give more specific questions or issues than that right now. If anyone is willing to really take the time to patiently help me walk through some steps until I have a better understanding of what's going on, I would really appreciate it.

Telinome

I am a member!

Offline
Joined: 08/13/2013

I have heard people mention gnome-boxes, and I would LOVE to give it a try. But it doesn't seem to be in the 6.0.1 repos. How can I get it?

Telinome

I am a member!

Offline
Joined: 08/13/2013

Well, I figured out this problem. 6.0.1 is based on Ubuntu Precise. Boxes was built for Trusty. I have the Trusty kernel, but the rest of my packages are still from the Precise release. I had found the Boxes package on Ubuntu Updates, but if I want to install it, I have to update a LOT of dependencies, one by one. I could probably do it, once I figure out the chain of dependencies, but it would take some time.

I could update to Trisquel 7 and get it from the repos. But, I wanted to test out 7 in a virtual machine first, so... that defeats the purpose.

Unless it's safe to add an Ubuntu PPA, download and install Boxes with dependencies, and then remove the repository.

BugRep
Offline
Joined: 04/05/2012

3) To use the Tablet you don't need the actual hardware tablet. It is used for sending clicks and mouse movement without the need for your mouse to be locked to the virtual machine (no need to press Ctrl+Alt to release the mouse).

4) Check your settings for Display and Video. Display is set to SPICE by default, and if you use SPICE you should use QXL Video, which is not set by default. You can use VNC instead of SPICE, but you won't be able to hear sound from the VM. You can use VNC with Vga. I don't know what will work for you. Experiment.

4) A tip: If you use XFS partition on the host for where your VM images are, you should set Cache mode for hard disk (in the settings for the VM) to None. Virtual hard disk performance is for some reason very bad when XFS (on the host) is used with caching.

P.S. SPICE is default on Trisquel 7. On Trisquel 6 you would need to install a different kvm binary (from the repos) and probably rename some files in /usr/bin, so just mentioning it in case you try Trisquel 7 again.

Telinome

I am a member!

Offline
Joined: 08/13/2013

I'd read about SPICE, but when I tried it, it didn't work. Your explanation tells me why, though, thank you.

I'll keep experimenting with video modes and see if something works better.

Trisquelian
Offline
Joined: 01/23/2015

Telinome,

Using KVM virtualization usually implies setting static values in the respective internet configuration file (/etc/network/interfaces) and I have used this method, but it's just too unpractical. So I really recommend that you get Virtualbox if you find yourself frequently on the move.

Seeing that you have already read the Documentation post (verified that you have the appropriate intel/amd modules) and if you still want to stick to KVM the first thing to sort out is the networking issue. For this we will need some more information as wireless networking is quite diverse. Assuming you have your wireless interface configured( it exists in the output of ifconfig) and that you can currently connect to the internet, we will have to find more about your network through the output of "iwlist scan" and it should allow you to see what type of security you have. I will just include the configuration for WPA as it is the one I have at hand and you did not specify the security protocol/encryption mode yet (this should be your /etc/networking/interfaces file):
Note: You need root permission to change the contents of that file. You won't be able to use the GUI for managing network connections with this configuration file.
You want to try this first configuration mode prior to jumping to the bridging part.
Note2: Make a copy of this file as i will come in handy later if you want to just use the GUI again.

auto lo
iface lo inet loopback

auto WIRELESS_INTERFACE_NAME
iface WIRELESS_INTERFACE_NAME inet dhcp
        wpa-ssid REPLACE_WITH_YOUR_SSID
        wpa-psk REPLACE_WITH_YOUR_WPA_PASSWORD

For the bridging part, you just need to change "dhcp" into "manual" and add br0 configuration from the Wiki, I cannot recall if the "wpa-ssid" and "wpa-psk" had to be moved under the br0 declaration, but you can test this out easily ( this is as far as I rember and I don't have the hardware to test this right now). As specified in the Wiki you might have to remove the "#" from those few lines if you are having weird connection issues, because it usually isn't necessary.

#### For the errors part #
Were the errors inside the virtual machine or on the command line? You can always run virt-manager from the command line with the "--debug" flag, which will report anything that is more than a slight error. The output also goes to "~/.virt-manager/virt-manager.log" when the flag is not used.

### For connecting hardware #
This is the kind of stuff that virt-manager's documentation is for. You may want to have a look at that first if it exists.

### Graphics issues #
It does really depend on your configuration (number of CPUs, RAM, other parameters if configured outside of virt-manager), on your hardware so you should also tell us more about that and also on what you are trying to run on the Virtual Machine. I cannot run desktop versions that require hardware accelerated graphics, due to my hardware.

Telinome

I am a member!

Offline
Joined: 08/13/2013

Because I messed around with trying to get things to work, my /etc/network/interfaces doesn't even list my wireless connection. It just shows the "auto lo" and "iface lo inet loopback" lines. It used to show more, but when the Network Manager freaked out and wouldn't connect me anymore, I cleared everything except those two lines. The Network Manager found my wireless signal again and connected, and it works, but my interfaces file never changed.

I will take the steps you suggested and see if that allows me to bridge.

For the errors, they are instead the virtual machines. Sometimes they come up and won't let the virtual machine boot, just like if you went to boot your physical computer and errors showed up instead. Sometimes they don't, and things boot normally. No idea why it only happens sometimes and not other times.

I've attached information from sysinfo, which hopefully has all the information you asked about.

AttachmentSize
Compy.txt 3.46 KB
doolio
Offline
Joined: 12/31/2013

I think the default is for the interfaces file just to have the loopback (or lo) entries. It's the case on my machine.

Trisquelian
Offline
Joined: 01/23/2015

It depends on what program is managing your network interfaces. Some add an entry to an external configuration file, for example when it includes WPA configurations.
But idealy that's how you want the file to look like in the case of NetworkManager.

doolio
Offline
Joined: 12/31/2013

Thanks for the clarification.

Trisquelian
Offline
Joined: 01/23/2015

The hardware does not seem to be an issue, but will still need some more info other than it not booting sometimes. You could try to install the basic netinstall version of Trisquel and see if it also breaks, but this is like walking in the dark.

Trisquelian
Offline
Joined: 01/23/2015

Since I do not seem to be able to edit my own post:
"Virtualbox will not be included in Trisquel 7 as the newer versions (from 4.2 on) depend on the non-free open watcom compiler." I was not aware of this change and therefore I cannot really recommend your to use Virtualbox anymore.

Telinome

I am a member!

Offline
Joined: 08/13/2013

Yep, that's why I'm trying to use something different. But ecause I'm still using Trisquel 6.0.1, I still have VirtualBox, since (from my understanding), the version of VirtualBox in 6.0.1 is NOT the version that needs the non-free compiler, so I could still use it if I could get it to work again, I just don't want to go through all that trouble and then leave it behind when I eventually move to Trisquel 7.

I would like to give gnome-boxes a try, if I can find a way to get it in Trisquel 6.0.1.

catfishes

I am a member!

Offline
Joined: 07/24/2013

Can't remember where I got these instructions but they work for me.
I've never got aQemu to do anything so this is all from the terminal.

This creates a flexible disk image:

qemu-img create -f qcow2 trisquel.img 100g

In the directory where you made your image put your iso and:

sudo kvm -m 1024 -cdrom trisquel_7.0_amd64.iso -boot d trisquel.img

To start the image after install do:

sudo kvm -m 1024 trisquel.img

-m is the amount of memory you want to allocate. 512 is probably enough.