KVM你问我答 FAQ (三)

我在使用QEMU,如何知道我有没有启用KVM的硬件加速功能?

如果你怀疑你没有启用KVM提供的硬件加速功能。你可以按照下面的步骤做检查。首先,看看你有没有得到下面的提示信息:

qemu-system-x86_64 -hda myvm.qcow2
open /dev/kvm: No such file or directory
Could not initialize KVM, will disable KVM support

如果是这种情况,请再检查:
1. kvm模块被正确载入了吗? lsmod | grep kvm.
2. 查看 dmesg 的输出,保证没有这个提示信息: “KVM, disabled by BIOS”.
3. 请确保/dev/kvm 确实存在,而且你有权限使用它。

其它诊断方式:
1. 如果你能使用 QEMU monitor ( ctrl-alt-2, 再 ctrl-alt-1 回到 VM 的显示屏 ),敲入 info kvm 命令。如果正常的话,应该有“KVM support: enabled”这条信息输出。
2. 在host机上敲 lsmod | grep kvm 命令,看看输出的最右栏。如果kvm在正常运行的话,这个数字不能是0。这行的数字与架构相关的模块(一般指的是kvm_intel,或kvm_amd)有联系,它显示了有多少个VM正在使用这个模块。举例说明,如果你有两个虚拟机正在使用KVM模块,host机的CPU使用的是vt技术,那么就会得到:

# lsmod | grep kvm
kvm_intel              44896  2
kvm                   159656  1 kvm_intel

 

使用VNC显示终端时出现“rect too big”是怎么回事

当连接VNC终端的时候,出现“rect too big”提示信息,这时VNC的会话也结束了。

这是因为当前VNC协议的一个缺陷,在处理即时象素格式变化时出现,可参看 这个贴子。如果你在使用TigerVNC,通过禁用即时象素编码选项,vncviewer的命令行选项选定为-AutoSelect=0,你就可以避免这个问题。你还可以查阅vncviewer的man帮助,根据连接速度禁用自动选择编码方式。


 

如果我的客户机是从远程访问的你该如何设置我的网络呢?以及:我的客户机网络出问题了我该怎么办?

KVM使用QEMU作为设备的模拟器。请参看QEMU的网络相关wiki (QEMU network wiki page)。
你应该会对Root Networking Mode和网络桥接感兴趣。客户机端的网络锁定有可能会因为tun/tap桥接host机端配置的出错的MAC地址时发生。参看RHEL bug #571991。

 


 

我的VM客户机的时间总出错,怎么办?

这常常发生在使用网络系统的时候,比如透过NFS或Samba。 不管是系统时钟还是RTC,保证稳定可靠的时机非常重要。Tell-tale signs of related trouble in VMs (apparently qemu/KVM/VMWare etc. are all affected) are e.g. "make[2]: Warning: File `XXXXX/cmakelists_rebuilder.stamp' has modification time 0.37 s in the future" "Clock skew detected. Your build may be incomplete."
Maemo docs state that it's important to disable UTC and set the correct time zone, however I don't really see how that would help in case of diverging host/guest clocks. IMHO much more useful and important is to configure properly working NTP server (chrony recommended, or ntpd) on both host and guest. The single most decisive trick IMHO is to specify the host NTP server as the main entry within guest VM instead of "foreign" NTP servers, to make sure to achieve the most precise coupling between these two related systems (timing drift vs. other systems does not matter nearly as much as a tight time precision for inner host/guest system interaction e.g. in the case of NFS/Samba shares etc.). For verification, see chronyc "sources -v", "tracking" ("System time" row) commands.
After having applied this very tight NTP coupling, this seems to finally have gotten rid of make's time drift warnings.
Perhaps qemu's -tdf (timing drift fix) option magically manages to help in your case, too.
See also Faqs: I received a message about "clock skew".


 

出现“rtc interrupts lost”出错信息,而且客户机应该慢,怎么办?

你可以试试把host机的.config文件中的 CONFIG_HPET_EMULATE_RTC 选项设成y。即 CONFIG_HPET_EMULATE_RTC=y


 从Intel主机上启动虚拟客户机时出现“Exception 13” 或 “Exception 12”出错信息,怎么办?

请参 模拟Intel的实模式的问题


 

我还安装了VMware/Paralles/VirtualBox,当我执行modprobe KVM时,系统死机了。

Intel VT和AMD-V都没有提供一个判断当前有没有软件在使用硬件虚拟扩展的机制。这就意味着,如果有两个内核模块同时尝试使用硬件虚拟扩展功能,非常悲惨的事情就发生了。如果死机情况发生在你同时使用另一种虚拟机的时候,你要确保另一种虚拟机没有使用硬件虚拟扩展,你再报告bug给KVM开发组。


 

QEMU/KVM屏幕上什么都没有,但是系统没有死机。我正准备在客户机上安装Kubuntu。怎么回事?

试试用 -std-vga 选项加载kvm。如果客户操作系统使用framebuffer模式,比如Kubuntu/Ubuntu。

 

当我点击客户操作系统的窗口时,鼠票就像被夺走一样。怎么做才能避免这种情况?有时鼠标在客户操作系统中不显示,或者不动,怎么办?

试试使用选项 -usb -usbdevice tablet 启动 kvm/qemu。如果还不行,在启动前设定环境变量SDL_VIDEO_X11_DGAMOUSE为0。如:

$ export SDL_VIDEO_X11_DGAMOUSE=0

可参看 http://wiki.clug.org.za/wiki/QEMU_mouse_not_working

翻译不易,转载请注明出处 ykyi.net

Leave a Reply

Your email address will not be published. Required fields are marked *