我可以使用 Qemu 和 libvirt 在 gentoo linux 上完成 Windows 2016 server essentials 的初始安装。但在首次启动时,安装后的 VM 会在首次启动时出现 BSOD。
后续重启会弹出一个窗口,提示
“计算机意外重新启动或遇到意外错误。Windows 安装无法继续。要安装 Windows,请单击“确定”重新启动计算机,然后重新开始安装。”
除了我没有收到日志消息之外,本文具有我所遇到的确切行为。https://gist.github.com/jorritfolmer/d01194a00f440ad257bd56d51baddc2d
我创建了/etc/modprobe.d/kvm.conf
文件并添加了以下行:
options kvm ignore_msrs=1
但仍然不起作用。尝试重命名为 qemu.conf。还尝试添加kvm.conf
到/etc/libvirt/
和/etc/qemu/
(只是开玩笑)
已通过以下方式测试:
- Linux 4.10.13-aufs、qemu 2.9.0-r2、libvirt 3.3.0
- Linux 4.15.14-aufs、qemu-2.11.1-r2、libvirt 4.1.0
这是 xml
<domain type='kvm' id='1'>
<name>WinEss</name>
<uuid>3815d313-1a83-4f2c-9348-d5f8726ed05d</uuid>
<memory unit='KiB'>8388608</memory>
<currentMemory unit='KiB'>8388608</currentMemory>
<vcpu placement='static'>4</vcpu>
<resource>
<partition>/machine</partition>
</resource>
<os>
<type arch='x86_64' machine='pc-i440fx-2.4'>hvm</type>
<boot dev='cdrom'/>
<boot dev='hd'/>
</os>
<features>
<acpi/>
<apic/>
<vmport state='off'/>
</features>
<cpu mode='custom' match='exact' check='full'>
<model fallback='forbid'>Westmere</model>
<feature policy='require' name='vme'/>
<feature policy='require' name='pclmuldq'/>
<feature policy='require' name='x2apic'/>
<feature policy='require' name='hypervisor'/>
<feature policy='require' name='arat'/>
</cpu>
<clock offset='utc'>
<timer name='rtc' tickpolicy='catchup'/>
<timer name='pit' tickpolicy='delay'/>
<timer name='hpet' present='no'/>
</clock>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<pm>
<suspend-to-mem enabled='no'/>
<suspend-to-disk enabled='no'/>
</pm>
<devices>
<emulator>/usr/bin/qemu-system-x86_64</emulator>
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2'/>
<source file='/antlets/WinEss/Blank.qcow2'/>
<backingStore/>
<target dev='hda' bus='ide'/>
<alias name='ide0-0-0'/>
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
</disk>
<disk type='file' device='cdrom'>
<driver name='qemu' type='raw'/>
<source file='/antlets/WinEss/antsle:volumes/WinEss.iso'/>
<backingStore/>
<target dev='hdb' bus='ide'/>
<readonly/>
<alias name='ide0-0-1'/>
<address type='drive' controller='0' bus='0' target='0' unit='1'/>
</disk>
<controller type='usb' index='0' model='ich9-ehci1'>
<alias name='usb'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x7'/>
</controller>
<controller type='usb' index='0' model='ich9-uhci1'>
<alias name='usb'/>
<master startport='0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0' multifunction='on'/>
</controller>
<controller type='usb' index='0' model='ich9-uhci2'>
<alias name='usb'/>
<master startport='2'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x1'/>
</controller>
<controller type='usb' index='0' model='ich9-uhci3'>
<alias name='usb'/>
<master startport='4'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x2'/>
</controller>
<controller type='pci' index='0' model='pci-root'>
<alias name='pci.0'/>
</controller>
<controller type='ide' index='0'>
<alias name='ide'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
</controller>
<interface type='network'>
<mac address='b2:61:6e:73:6c:0f'/>
<source network='bblv' bridge='virbr1'/>
<target dev='vnet0'/>
<model type='e1000'/>
<alias name='net0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
<serial type='pty'>
<source path='/dev/pts/1'/>
<target port='0'/>
<alias name='serial0'/>
</serial>
<console type='pty' tty='/dev/pts/1'>
<source path='/dev/pts/1'/>
<target type='serial' port='0'/>
<alias name='serial0'/>
</console>
<input type='mouse' bus='ps2'>
<alias name='input0'/>
</input>
<input type='keyboard' bus='ps2'>
<alias name='input1'/>
</input>
<input type='tablet' bus='usb'>
<alias name='input2'/>
<address type='usb' bus='0' port='1'/>
</input>
<graphics type='vnc' port='5900' autoport='yes' listen='127.0.0.1'>
<listen type='address' address='127.0.0.1'/>
</graphics>
<sound model='ich6'>
<alias name='sound0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</sound>
<video>
<model type='qxl' ram='65536' vram='65536' vgamem='16384' heads='1' primary='yes'/>
<alias name='video0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</video>
<memballoon model='virtio'>
<alias name='balloon0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
</memballoon>
</devices>
<seclabel type='none' model='none'/>
<seclabel type='dynamic' model='dac' relabel='yes'>
<label>+77:+77</label>
<imagelabel>+77:+77</imagelabel>
</seclabel>
</domain>
更新 2018 年 8 月 10 日
我尝试将 cpu 类型更改为 core2duo 和 host-passthrough,并且 cpu_map.xml 中的所有 cpu 类型我都尝试了几种变体,并参考了 libvirt.org 文档中的一些示例
<cpu match='exact'>
<model fallback='allow'>core2duo</model>
<vendor>Intel</vendor>
<topology sockets='1' cores='2' threads='2'/>
<cache level='3' mode='emulate'/>
<feature policy='disable' name='lahf_lm'/>
</cpu>
我确实找到了另一篇推荐 host-passthrough 的文章,但我不确定我是否在 xml 中正确配置了它。再次使用带有和不带有“feature”、“cache”、“check”的几种变体... 信息来自 libvirt.org
<cpu mode='host-passthrough' check='none'>
<cache mode='passthrough'/>
</cpu>
<cpu mode='host-passthrough' check='none'>
<topology sockets='1' cores='1' threads='4'/>
<cache mode='passthrough'/>
<feature policy='disable' name='lahf_lm'/>
</cpu>
并且只是
<cpu>
<topology sockets='1' cores='1' threads='4'/>
</cpu>
答案1
使用 KVM 模块选项创建文件后必须重新启动。
options kvm ignore_msrs=1
其名称无所谓,只要它在/etc/modprobe.d
目录中并且以 结尾即可.conf
。
您还应该使用 Q35 机器类型创建机器(切勿使用 I440FX,尽管它是默认类型)。I440fx 是一款古老的 1996 年主板,现代 Windows 并不真正关心它。
此外,您还应将 CPU 设置为 core2duo 或 host-passthrough。使用任何其他 CPU 类型时,Windows 10 升级经常会失败。如果您打算在 VM 中运行 Hyper-V,或者您迫切需要每一点性能,请使用 host-passthrough;否则,请使用 core2duo。