QEMU frequency mismatch on Kubuntu

I have the following message on my Kubuntu 17.10 - I googled the message but unfortunately hits are way too technical for me to find a solution:

Emulator: qemu-system-i386: warning: TSC frequency mismatch between VM
(2394456 kHz) and host (2394457 kHz), and TSC scaling unavailable

With the following symptom: enter image description here

At first launch everything worked well in this regard, so I don't know what caused the issue and how to solve it.


Solution 1:

I had the same problem due to some updates, I opened my Android Virtual Device Manager from Android Studio (Tools->AVD Manager) then matched the emulator where the problem occurred. I clicked the dropdown icon from Actions column and selected the Wipe Data option.

Solution 2:

I have the solution via a workaround!

tl;dr version: -use-system-libs option with the emulator is a temporary workaround.

longer version:

Googling TSC frequency mismatch gave no ideas as to what might cause the issue. Disabling HW acceleration was one possible fix, but the result is a slow emulation. I gave it some rest but then I figured this should be a kernel related issue, since it was KVM that seemed to cause the issue. I tried disabling intel microcode driver (no help) and a kernel update (no help), but after the latter, at least I got little less cryptic error messages like:

21:31   Emulator: libGL error: unable to load driver: i965_dri.so
21:31   Emulator: libGL error: driver pointer missing
21:31   Emulator: libGL error: failed to load driver: i965
21:31   Emulator: libGL error: unable to load driver: i965_dri.so
21:31   Emulator: libGL error: driver pointer missing
21:31   Emulator: libGL error: failed to load driver: i965
21:31   Emulator: libGL error: unable to load driver: swrast_dri.so
21:31   Emulator: libGL error: failed to load driver: swrast
21:31   Emulator: X Error of failed request:  BadValue (integer parameter out of range for operation)
21:31   Emulator: Major opcode of failed request:  155 (GLX)
21:31   Emulator: Minor opcode of failed request:  24 (X_GLXCreateNewContext)
21:31   Emulator: Value in failed request:  0x0
21:31   Emulator: Serial number of failed request:  64
21:31   Emulator: Current serial number in output stream:  65
21:31   Emulator: Process finished with exit code 1

So this must be a driver issue! Googling the first error message gave me this hit, using -use-system-libs with the emulator. It's working now! But, how to make it permanent? This page also pointed me to the right direction: use a wrapper script to launch the emulator. Now everything works like a charm.

So, step-by-step solution:

  1. in terminal: /home/$user/Android/Sdk/emulator/emulator -list-avds to find your AVD-s - the names might differ from those apparent in Android Studio. Find the name of the AVD you have trouble with. Note that the emulator path might differ as well, based on the path you have specified during AStudio installation.
  2. test if the following works for you as a manual workaround: /home/$user/Android/Sdk/emulator/emulator -avd your_emulator_name_here -use-system-libs
  3. if (2) works for you, rename the original emulator file and launch it from a shell script for permanent option flag launch (your path and text editor might differ):

    $ cd /home/$user/Android/Sdk/emulator/ $ mv emulator emulator.0 $ touch emulator $ chmod +x emulator $ kate emulator

insert the following and save:

#!/bin/sh
set -ex
$0.0 $@ -use-system-libs

Now every time the emulator is called it is done so with the system libs through the shell script named emulator, and it should give no errors from now on.

Solution 3:

Go to AVD Manager, click the AVD that is causing this issue, and select Wipe Data from the options.