{"id":574,"date":"2012-06-10T21:12:57","date_gmt":"2012-06-10T13:12:57","guid":{"rendered":"http:\/\/ykyi.net\/?p=574"},"modified":"2012-06-10T21:12:57","modified_gmt":"2012-06-10T13:12:57","slug":"kvm%e4%bd%a0%e9%97%ae%e6%88%91%e7%ad%94-faq-%e4%b8%89","status":"publish","type":"post","link":"https:\/\/ykyi.net\/?p=574","title":{"rendered":"KVM\u4f60\u95ee\u6211\u7b54 FAQ (\u4e09)"},"content":{"rendered":"<h3 dir=\"ltr\">\u6211\u5728\u4f7f\u7528QEMU\uff0c\u5982\u4f55\u77e5\u9053\u6211\u6709\u6ca1\u6709\u542f\u7528KVM\u7684\u786c\u4ef6\u52a0\u901f\u529f\u80fd?<\/h3>\n<p>\u5982\u679c\u4f60\u6000\u7591\u4f60\u6ca1\u6709\u542f\u7528KVM\u63d0\u4f9b\u7684\u786c\u4ef6\u52a0\u901f\u529f\u80fd\u3002\u4f60\u53ef\u4ee5\u6309\u7167\u4e0b\u9762\u7684\u6b65\u9aa4\u505a\u68c0\u67e5\u3002\u9996\u5148\uff0c\u770b\u770b\u4f60\u6709\u6ca1\u6709\u5f97\u5230\u4e0b\u9762\u7684\u63d0\u793a\u4fe1\u606f\uff1a<\/p>\n<p>qemu-system-x86_64 -hda myvm.qcow2<br \/>\n\topen \/dev\/kvm: No such file or directory<br \/>\n\tCould not initialize KVM, will disable KVM support<\/p>\n<p>\u5982\u679c\u662f\u8fd9\u79cd\u60c5\u51b5\uff0c\u8bf7\u518d\u68c0\u67e5\uff1a<br \/>\n\t1. kvm\u6a21\u5757\u88ab\u6b63\u786e\u8f7d\u5165\u4e86\u5417\uff1f lsmod | grep kvm.<br \/>\n\t2. \u67e5\u770b dmesg \u7684\u8f93\u51fa\uff0c\u4fdd\u8bc1\u6ca1\u6709\u8fd9\u4e2a\u63d0\u793a\u4fe1\u606f\uff1a &ldquo;KVM, disabled by BIOS&rdquo;.<br \/>\n\t3. \u8bf7\u786e\u4fdd\/dev\/kvm \u786e\u5b9e\u5b58\u5728\uff0c\u800c\u4e14\u4f60\u6709\u6743\u9650\u4f7f\u7528\u5b83\u3002<\/p>\n<p>\u5176\u5b83\u8bca\u65ad\u65b9\u5f0f\uff1a<br \/>\n\t1. \u5982\u679c\u4f60\u80fd\u4f7f\u7528 QEMU monitor ( ctrl-alt-2, \u518d ctrl-alt-1 \u56de\u5230 VM \u7684\u663e\u793a\u5c4f )\uff0c\u6572\u5165 info kvm \u547d\u4ee4\u3002\u5982\u679c\u6b63\u5e38\u7684\u8bdd\uff0c\u5e94\u8be5\u6709&ldquo;KVM support: enabled&rdquo;\u8fd9\u6761\u4fe1\u606f\u8f93\u51fa\u3002<br \/>\n\t2. \u5728host\u673a\u4e0a\u6572 lsmod | grep kvm \u547d\u4ee4\uff0c\u770b\u770b\u8f93\u51fa\u7684\u6700\u53f3\u680f\u3002\u5982\u679ckvm\u5728\u6b63\u5e38\u8fd0\u884c\u7684\u8bdd\uff0c\u8fd9\u4e2a\u6570\u5b57\u4e0d\u80fd\u662f0\u3002\u8fd9\u884c\u7684\u6570\u5b57\u4e0e\u67b6\u6784\u76f8\u5173\u7684\u6a21\u5757(\u4e00\u822c\u6307\u7684\u662fkvm_intel,\u6216kvm_amd)\u6709\u8054\u7cfb\uff0c\u5b83\u663e\u793a\u4e86\u6709\u591a\u5c11\u4e2aVM\u6b63\u5728\u4f7f\u7528\u8fd9\u4e2a\u6a21\u5757\u3002\u4e3e\u4f8b\u8bf4\u660e\uff0c\u5982\u679c\u4f60\u6709\u4e24\u4e2a\u865a\u62df\u673a\u6b63\u5728\u4f7f\u7528KVM\u6a21\u5757\uff0chost\u673a\u7684CPU\u4f7f\u7528\u7684\u662fvt\u6280\u672f\uff0c\u90a3\u4e48\u5c31\u4f1a\u5f97\u5230\uff1a<\/p>\n<p># lsmod | grep kvm<br \/>\n\tkvm_intel &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;44896 &nbsp;2<br \/>\n\tkvm &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;159656 &nbsp;1 kvm_intel<\/p>\n<p>&nbsp;<\/p>\n<h3 dir=\"ltr\">\u4f7f\u7528VNC\u663e\u793a\u7ec8\u7aef\u65f6\u51fa\u73b0&ldquo;rect too big&rdquo;\u662f\u600e\u4e48\u56de\u4e8b<\/h3>\n<p>\u5f53\u8fde\u63a5VNC\u7ec8\u7aef\u7684\u65f6\u5019\uff0c\u51fa\u73b0&ldquo;rect too big&rdquo;\u63d0\u793a\u4fe1\u606f\uff0c\u8fd9\u65f6VNC\u7684\u4f1a\u8bdd\u4e5f\u7ed3\u675f\u4e86\u3002<\/p>\n<p>\u8fd9\u662f\u56e0\u4e3a\u5f53\u524dVNC\u534f\u8bae\u7684\u4e00\u4e2a\u7f3a\u9677\uff0c\u5728\u5904\u7406\u5373\u65f6\u8c61\u7d20\u683c\u5f0f\u53d8\u5316\u65f6\u51fa\u73b0\uff0c\u53ef\u53c2\u770b <a href=\"http:\/\/www.mail-archive.com\/qemu-devel@nongnu.org\/msg04879.html\">\u8fd9\u4e2a\u8d34\u5b50<\/a>\u3002\u5982\u679c\u4f60\u5728\u4f7f\u7528TigerVNC\uff0c\u901a\u8fc7\u7981\u7528\u5373\u65f6\u8c61\u7d20\u7f16\u7801\u9009\u9879\uff0cvncviewer\u7684\u547d\u4ee4\u884c\u9009\u9879\u9009\u5b9a\u4e3a-AutoSelect=0\uff0c\u4f60\u5c31\u53ef\u4ee5\u907f\u514d\u8fd9\u4e2a\u95ee\u9898\u3002\u4f60\u8fd8\u53ef\u4ee5\u67e5\u9605vncviewer\u7684man\u5e2e\u52a9\uff0c\u6839\u636e\u8fde\u63a5\u901f\u5ea6\u7981\u7528\u81ea\u52a8\u9009\u62e9\u7f16\u7801\u65b9\u5f0f\u3002<\/p>\n<hr \/>\n<p>&nbsp;<\/p>\n<h3 dir=\"ltr\">\u5982\u679c\u6211\u7684\u5ba2\u6237\u673a\u662f\u4ece\u8fdc\u7a0b\u8bbf\u95ee\u7684\u4f60\u8be5\u5982\u4f55\u8bbe\u7f6e\u6211\u7684\u7f51\u7edc\u5462\uff1f\u4ee5\u53ca\uff1a\u6211\u7684\u5ba2\u6237\u673a\u7f51\u7edc\u51fa\u95ee\u9898\u4e86\u6211\u8be5\u600e\u4e48\u529e\uff1f<\/h3>\n<p>KVM\u4f7f\u7528QEMU\u4f5c\u4e3a\u8bbe\u5907\u7684\u6a21\u62df\u5668\u3002\u8bf7\u53c2\u770bQEMU\u7684\u7f51\u7edc\u76f8\u5173wiki (<a href=\"http:\/\/qemu-buch.de\/cgi-bin\/moin.cgi\/QemuNetwork\">QEMU network wiki page<\/a>)\u3002<br \/>\n\t\u4f60\u5e94\u8be5\u4f1a\u5bf9Root Networking Mode\u548c\u7f51\u7edc\u6865\u63a5\u611f\u5174\u8da3\u3002\u5ba2\u6237\u673a\u7aef\u7684\u7f51\u7edc\u9501\u5b9a\u6709\u53ef\u80fd\u4f1a\u56e0\u4e3atun\/tap\u6865\u63a5host\u673a\u7aef\u914d\u7f6e\u7684\u51fa\u9519\u7684MAC\u5730\u5740\u65f6\u53d1\u751f\u3002\u53c2\u770bRHEL bug #571991\u3002<\/p>\n<p>&nbsp;<\/p>\n<hr \/>\n<p>&nbsp;<\/p>\n<h3 dir=\"ltr\">\u6211\u7684VM\u5ba2\u6237\u673a\u7684\u65f6\u95f4\u603b\u51fa\u9519\uff0c\u600e\u4e48\u529e\uff1f<\/h3>\n<p>\u8fd9\u5e38\u5e38\u53d1\u751f\u5728\u4f7f\u7528\u7f51\u7edc\u7cfb\u7edf\u7684\u65f6\u5019\uff0c\u6bd4\u5982\u900f\u8fc7NFS\u6216Samba\u3002 \u4e0d\u7ba1\u662f\u7cfb\u7edf\u65f6\u949f\u8fd8\u662fRTC\uff0c\u4fdd\u8bc1\u7a33\u5b9a\u53ef\u9760\u7684\u65f6\u673a\u975e\u5e38\u91cd\u8981\u3002Tell-tale signs of related trouble in VMs (apparently qemu\/KVM\/VMWare etc. are all affected) are e.g. &quot;make[2]: Warning: File `XXXXX\/cmakelists_rebuilder.stamp&#39; has modification time 0.37 s in the future&quot; &quot;Clock skew detected. Your build may be incomplete.&quot;<br \/>\n\t<a href=\"http:\/\/maemovmware.garage.maemo.org\/2nd_edition\/requirements_documentation.html\">Maemo docs<\/a> state that it&#39;s important to disable UTC and set the correct time zone, however I don&#39;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 &quot;foreign&quot; 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 &quot;sources -v&quot;, &quot;tracking&quot; (&quot;System time&quot; row) commands.<br \/>\n\tAfter having applied this very tight NTP coupling, this seems to finally have gotten rid of make&#39;s time drift warnings.<br \/>\n\tPerhaps qemu&#39;s -tdf (timing drift fix) option magically manages to help in your case, too.<br \/>\n\tSee also <a href=\"https:\/\/espace.cern.ch\/it-faqs\/Lists\/faqs\/DispForm.aspx?ID=368\">Faqs: I received a message about &quot;clock skew&quot;<\/a>.<\/p>\n<hr \/>\n<p>&nbsp;<\/p>\n<h3 dir=\"ltr\">\u51fa\u73b0&ldquo;rtc interrupts lost&rdquo;\u51fa\u9519\u4fe1\u606f\uff0c\u800c\u4e14\u5ba2\u6237\u673a\u5e94\u8be5\u6162\uff0c\u600e\u4e48\u529e\uff1f<\/h3>\n<p>\u4f60\u53ef\u4ee5\u8bd5\u8bd5\u628ahost\u673a\u7684.config\u6587\u4ef6\u4e2d\u7684 CONFIG_HPET_EMULATE_RTC \u9009\u9879\u8bbe\u6210y\u3002\u5373 CONFIG_HPET_EMULATE_RTC=y<\/p>\n<hr \/>\n<p><strong>&nbsp;\u4eceIntel\u4e3b\u673a\u4e0a\u542f\u52a8\u865a\u62df\u5ba2\u6237\u673a\u65f6\u51fa\u73b0&ldquo;Exception 13&rdquo; \u6216 &ldquo;Exception 12&rdquo;\u51fa\u9519\u4fe1\u606f,\u600e\u4e48\u529e\uff1f<\/strong><\/p>\n<p>\u8bf7\u53c2 <a href=\"http:\/\/www.linux-kvm.org\/wiki\/index.php?title=Intel_Real_Mode_Emulation_Problems&amp;action=edit\">\u6a21\u62dfIntel\u7684\u5b9e\u6a21\u5f0f\u7684\u95ee\u9898<\/a> \u3002<\/p>\n<hr \/>\n<p>&nbsp;<\/p>\n<h3 dir=\"ltr\">\u6211\u8fd8\u5b89\u88c5\u4e86VMware\/Paralles\/VirtualBox\uff0c\u5f53\u6211\u6267\u884cmodprobe KVM\u65f6\uff0c\u7cfb\u7edf\u6b7b\u673a\u4e86\u3002<\/h3>\n<p>Intel VT\u548cAMD-V\u90fd\u6ca1\u6709\u63d0\u4f9b\u4e00\u4e2a\u5224\u65ad\u5f53\u524d\u6709\u6ca1\u6709\u8f6f\u4ef6\u5728\u4f7f\u7528\u786c\u4ef6\u865a\u62df\u6269\u5c55\u7684\u673a\u5236\u3002\u8fd9\u5c31\u610f\u5473\u7740\uff0c\u5982\u679c\u6709\u4e24\u4e2a\u5185\u6838\u6a21\u5757\u540c\u65f6\u5c1d\u8bd5\u4f7f\u7528\u786c\u4ef6\u865a\u62df\u6269\u5c55\u529f\u80fd\uff0c\u975e\u5e38\u60b2\u60e8\u7684\u4e8b\u60c5\u5c31\u53d1\u751f\u4e86\u3002\u5982\u679c\u6b7b\u673a\u60c5\u51b5\u53d1\u751f\u5728\u4f60\u540c\u65f6\u4f7f\u7528\u53e6\u4e00\u79cd\u865a\u62df\u673a\u7684\u65f6\u5019\uff0c\u4f60\u8981\u786e\u4fdd\u53e6\u4e00\u79cd\u865a\u62df\u673a\u6ca1\u6709\u4f7f\u7528\u786c\u4ef6\u865a\u62df\u6269\u5c55\uff0c\u4f60\u518d\u62a5\u544abug\u7ed9KVM\u5f00\u53d1\u7ec4\u3002<\/p>\n<hr \/>\n<p>&nbsp;<\/p>\n<h3 dir=\"ltr\"><strong>QEMU\/KVM\u5c4f\u5e55\u4e0a\u4ec0\u4e48\u90fd\u6ca1\u6709\uff0c\u4f46\u662f\u7cfb\u7edf\u6ca1\u6709\u6b7b\u673a\u3002\u6211\u6b63\u51c6\u5907\u5728\u5ba2\u6237\u673a\u4e0a\u5b89\u88c5Kubuntu\u3002\u600e\u4e48\u56de\u4e8b\uff1f<\/strong><\/h3>\n<pre dir=\"ltr\">\u8bd5\u8bd5\u7528 -std-vga \u9009\u9879\u52a0\u8f7dkvm\u3002\u5982\u679c\u5ba2\u6237\u64cd\u4f5c\u7cfb\u7edf\u4f7f\u7528framebuffer\u6a21\u5f0f\uff0c\u6bd4\u5982Kubuntu\/Ubuntu\u3002<\/pre>\n<hr \/>\n<p>&nbsp;<\/p>\n<h3 dir=\"ltr\">\u5f53\u6211\u70b9\u51fb\u5ba2\u6237\u64cd\u4f5c\u7cfb\u7edf\u7684\u7a97\u53e3\u65f6\uff0c\u9f20\u7968\u5c31\u50cf\u88ab\u593a\u8d70\u4e00\u6837\u3002\u600e\u4e48\u505a\u624d\u80fd\u907f\u514d\u8fd9\u79cd\u60c5\u51b5\uff1f\u6709\u65f6\u9f20\u6807\u5728\u5ba2\u6237\u64cd\u4f5c\u7cfb\u7edf\u4e2d\u4e0d\u663e\u793a\uff0c\u6216\u8005\u4e0d\u52a8\uff0c\u600e\u4e48\u529e\uff1f<\/h3>\n<p><strong id=\"internal-source-marker_0.09804500546306372\">\u8bd5\u8bd5\u4f7f\u7528\u9009\u9879 -usb -usbdevice tablet \u542f\u52a8 kvm\/qemu\u3002\u5982\u679c\u8fd8\u4e0d\u884c\uff0c\u5728\u542f\u52a8\u524d\u8bbe\u5b9a\u73af\u5883\u53d8\u91cfSDL_VIDEO_X11_DGAMOUSE\u4e3a0\u3002\u5982\uff1a<\/strong><\/p>\n<p>$ export SDL_VIDEO_X11_DGAMOUSE=0<\/p>\n<p>\u53ef\u53c2\u770b <a href=\"http:\/\/wiki.clug.org.za\/wiki\/QEMU_mouse_not_working\">http:\/\/wiki.clug.org.za\/wiki\/QEMU_mouse_not_working<\/a> \u3002<\/p>\n<p><strong>\u7ffb\u8bd1\u4e0d\u6613\uff0c\u8f6c\u8f7d\u8bf7\u6ce8\u660e\u51fa\u5904<a href=\"http:\/\/ykyi.net\"> ykyi.net<\/a><\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6211\u5728\u4f7f\u7528QEMU\uff0c\u5982\u4f55\u77e5\u9053\u6211\u6709\u6ca1\u6709\u542f\u7528KVM\u7684\u786c\u4ef6\u52a0\u901f\u529f\u80fd? \u5982\u679c\u4f60\u6000\u7591\u4f60\u6ca1\u6709\u542f\u7528KVM\u63d0\u4f9b\u7684\u786c\u4ef6\u52a0\u901f\u529f\u80fd\u3002\u4f60\u53ef\u4ee5\u6309\u7167\u4e0b\u9762\u7684\u6b65\u9aa4\u505a\u68c0\u67e5\u3002\u9996\u5148\uff0c\u770b\u770b\u4f60\u6709\u6ca1\u6709\u5f97\u5230\u4e0b\u9762\u7684\u63d0\u793a\u4fe1\u606f\uff1a qemu-system-x86_64 -hda myvm.qcow2 open \/dev\/kvm: No such file or directory Could not initialize KVM, will disable KVM support \u5982\u679c\u662f\u8fd9\u79cd\u60c5\u51b5\uff0c\u8bf7\u518d\u68c0\u67e5\uff1a 1. kvm\u6a21\u5757\u88ab\u6b63\u786e\u8f7d\u5165\u4e86\u5417\uff1f lsmod | grep kvm. 2. \u67e5\u770b dmesg \u7684\u8f93\u51fa\uff0c\u4fdd\u8bc1\u6ca1\u6709\u8fd9\u4e2a\u63d0\u793a\u4fe1\u606f\uff1a &ldquo;KVM, disabled by BIOS&rdquo;. 3. \u8bf7\u786e\u4fdd\/dev\/kvm \u786e\u5b9e\u5b58\u5728\uff0c\u800c\u4e14\u4f60\u6709\u6743\u9650\u4f7f\u7528\u5b83\u3002 \u5176\u5b83\u8bca\u65ad\u65b9\u5f0f\uff1a 1. \u5982\u679c\u4f60\u80fd\u4f7f\u7528 QEMU monitor ( ctrl-alt-2, \u518d ctrl-alt-1 \u56de\u5230 VM \u7684\u663e\u793a\u5c4f )\uff0c\u6572\u5165 info kvm \u547d\u4ee4\u3002\u5982\u679c\u6b63\u5e38\u7684\u8bdd\uff0c\u5e94\u8be5\u6709&ldquo;KVM support: &hellip; <a href=\"https:\/\/ykyi.net\/?p=574\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;KVM\u4f60\u95ee\u6211\u7b54 FAQ (\u4e09)&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6,7,8],"tags":[48,51,52,68,122],"class_list":["post-574","post","type-post","status-publish","format-standard","hentry","category-tech_articles","category-unix_linux","category-virtualization","tag-kvm","tag-linux-2","tag-linux-kernel","tag-qemu","tag--virtulization"],"_links":{"self":[{"href":"https:\/\/ykyi.net\/index.php?rest_route=\/wp\/v2\/posts\/574","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ykyi.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ykyi.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ykyi.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ykyi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=574"}],"version-history":[{"count":0,"href":"https:\/\/ykyi.net\/index.php?rest_route=\/wp\/v2\/posts\/574\/revisions"}],"wp:attachment":[{"href":"https:\/\/ykyi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=574"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ykyi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=574"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ykyi.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=574"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}