KVM - 在 Debian Lenny 64 位主机上安装 Windows 2003 客户机时出现问题

KVM - 在 Debian Lenny 64 位主机上安装 Windows 2003 客户机时出现问题

我有一台 Debian Lenny 64 位主机,安装了 kvm,windows 2003 运行正常,但我注意到标准软件包中的 kvm 版本太旧了,所以我决定使用 debian backports 进行更新,以获取更多最新软件包。所以我使用

apt-get -t lenny-backports 安装 kvm libvirt-bin virtinst

所以现在我有

debian:~# virsh version
Compiled against library: libvir 0.8.3
Using library: libvir 0.8.3
Using API: QEMU 0.8.3
Running hypervisor: QEMU 0.9.1

因此,现在我尝试设置一位新客人:

debian:/tmp# virt-install --connect qemu:///system -n win2k3 -r 2048 -c /home/win2k3.iso -f /home/win2k3.img -s 20 --nonetworks --noautoconsole --vnc --os-type=windows --os-variant=win2k3 --hvm --accelerate --debug
Sat, 04 Dec 2010 17:20:24 DEBUG    Launched with command line:
/usr/bin/virt-install --connect qemu:///system -n win2k3 -r 2048 -c /home/win2k3.iso -f /home/win2k3.img -s 20 --nonetworks --noautoconsole --vnc --os-type=windows --os-variant=win2k3 --hvm --accelerate --debug
Sat, 04 Dec 2010 17:20:24 DEBUG    Requesting libvirt URI qemu:///system
Sat, 04 Dec 2010 17:20:24 DEBUG    Received libvirt URI qemu:///system
Sat, 04 Dec 2010 17:20:24 DEBUG    Requesting virt method 'hvm', hv type 'default'.
Sat, 04 Dec 2010 17:20:24 DEBUG    Received virt method 'hvm'
Sat, 04 Dec 2010 17:20:24 DEBUG    Hypervisor name is 'kvm'
Sat, 04 Dec 2010 17:20:24 DEBUG    Could not open "/etc/sysconfig/keyboard" [Errno 2] No such file or directory: '/etc/sysconfig/keyboard'
Sat, 04 Dec 2010 17:20:24 DEBUG    Could not open "/etc/X11/xorg.conf": [Errno 2] No such file or directory: '/etc/X11/xorg.conf' 
Sat, 04 Dec 2010 17:20:24 DEBUG    Could not open "/etc/default/keyboard": [Errno 2] No such file or directory: '/etc/default/keyboard' 
Sat, 04 Dec 2010 17:20:24 DEBUG    Did not parse any usable keymapping.
Sat, 04 Dec 2010 17:20:24 DEBUG    DistroInstaller location is a local file/path: /home/win2k3.iso


Starting install...
Creating storage file win 100% |=========================|  20 GB    00:00     
Sat, 04 Dec 2010 17:20:24 DEBUG    Generated install XML: 
<domain type='kvm'>
  <name>win2k3</name>
  <currentMemory>2097152</currentMemory>
  <memory>2097152</memory>
  <uuid>d0bd8a0f-af7f-1647-4662-f4e3f86ef524</uuid>
  <os>
    <type arch='x86_64'>hvm</type>
    <boot dev='cdrom'/>
  </os>
  <features>
    <acpi/><apic/><pae/>
  </features>
  <clock offset="localtime"/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>destroy</on_reboot>
  <on_crash>destroy</on_crash>
  <vcpu>1</vcpu>
  <devices>
    <emulator>/usr/bin/kvm</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw'/>
      <source file='/home/win2k3.img'/>
      <target dev='hda' bus='ide'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu'/>
      <source file='/home/win2k3.iso'/>
      <target dev='hdc' bus='ide'/>
      <readonly/>
    </disk>
    <input type='tablet' bus='usb'/>
    <graphics type='vnc' port='-1' keymap='en-us'/>
    <console type='pty'/>
    <video>
      <model type='vga'/>
    </video>
  </devices>
</domain>

Creating domain...                                                 0 B 00:00 
Sat, 04 Dec 2010 17:20:24 DEBUG    Started guest, looking to see if it is running
Sat, 04 Dec 2010 17:20:24 DEBUG    Generated boot XML: 
<domain type='kvm'>
  <name>win2k3</name>
  <currentMemory>2097152</currentMemory>
  <memory>2097152</memory>
  <uuid>d0bd8a0f-af7f-1647-4662-f4e3f86ef524</uuid>
  <os>
    <type arch='x86_64'>hvm</type>
    <boot dev='hd'/>
  </os>
  <features>
    <acpi/><apic/><pae/>
  </features>
  <clock offset="localtime"/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <vcpu>1</vcpu>
  <devices>
    <emulator>/usr/bin/kvm</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw'/>
      <source file='/home/win2k3.img'/>
      <target dev='hda' bus='ide'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu'/>
      <source file='/home/win2k3.iso'/>
      <target dev='hdc' bus='ide'/>
      <readonly/>
    </disk>
    <input type='tablet' bus='usb'/>
    <graphics type='vnc' port='-1' keymap='en-us'/>
    <console type='pty'/>
    <video>
      <model type='vga'/>
    </video>
  </devices>
</domain>

Domain installation does not appear to have been
 successful.  If it was, you can restart your domain
 by running 'virsh start win2k3'; otherwise, please
 restart your installation.

显示错误,但我不明白为什么所以我尝试

debian:/tmp# virsh start win2k3
Domain win2k3 started

然后什么都没有启动并且日志显示

LC_ALL=C PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin HOME=/root USER=root LOGNAME=root QEMU_AUDIO_DRV=none /usr/bin/kvm -S -M pc-0.12 -enable-kvm -m 2048 -smp 1,sockets=1,cores=1,threads=1 -name win2k3 -uuid faaa37da-7eb3-d5ab-e36a-c7f782c5a657 -nodefaults -chardev socket,id=monitor,path=/var/lib/libvirt/qemu/win2k3.monitor,server,nowait -mon chardev=monitor,mode=readline -rtc base=localtime -boot c -drive file=/home/win2k3.img,if=none,id=drive-ide0-0-0,boot=on,format=raw -device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 -drive file=/home/win2k3.iso,if=none,media=cdrom,id=drive-ide0-1-0,readonly=on,format=raw -device ide-drive,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0 -chardev pty,id=serial0 -device isa-serial,chardev=serial0 -usb -device usb-tablet,id=input0 -vnc 127.0.0.1:0 -k en-us -vga std -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 
char device redirected to /dev/pts/6
exception 13 (0)
rax 0000000000000010 rbx 000000000000c000 rcx 0000000000006e36 rdx 00000000c0000000
rsi 0000000000000003 rdi 0000000000000000 rsp 0000000000006e2c rbp 0000000000000008
r8  0000000000000000 r9  0000000000000000 r10 0000000000000000 r11 0000000000000000
r12 0000000000000000 r13 0000000000000000 r14 0000000000000000 r15 0000000000000000
rip 00000000000fec3c rflags 00033002
cs 0000 (00000000/0000ffff p 1 dpl 3 db 0 s 1 type 3 l 0 g 0 avl 0)
ds 0000 (00000000/0000ffff p 1 dpl 3 db 0 s 1 type 3 l 0 g 0 avl 0)
es 0000 (00000000/0000ffff p 1 dpl 3 db 0 s 1 type 3 l 0 g 0 avl 0)
ss 0000 (00000000/0000ffff p 1 dpl 3 db 0 s 1 type 3 l 0 g 0 avl 0)
fs 0000 (00000000/0000ffff p 1 dpl 3 db 0 s 1 type 3 l 0 g 0 avl 0)
gs 0000 (00000000/0000ffff p 1 dpl 3 db 0 s 1 type 3 l 0 g 0 avl 0)
tr 0000 (feffd000/00002088 p 1 dpl 0 db 0 s 0 type b l 0 g 0 avl 0)
ldt 0000 (00000000/0000ffff p 1 dpl 0 db 0 s 0 type 2 l 0 g 0 avl 0)
gdt f7a30/37
idt f8ab0/0
cr0 10 cr2 0 cr3 0 cr4 0 cr8 0 efer 0
code: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 --> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

我只是不知道该去哪里。任何帮助都很好。

谢谢

答案1

因此在阅读更多内容后http://www.linux-kvm.org/page/Code#Debian他们说“使用较新的内核很重要 - 2.6.26 与 kvm 配合不佳”

所以我运行了下面的程序因为我有 64 位(linux-image-2.6-686 适用于 32 位)

apt-get -t lenny-backports 安装 linux-image-2.6-amd64

然后重新启动并尝试再次创建我的虚拟机并且它成功了!

debian:~# virt-install --connect qemu:///system -n win2k3 -r 2048 -c /home/win2k3.iso -f /home/win2k3.img -s 20 --nonetworks --noautoconsole --vnc --os-type=windows --os-variant=win2k3 --hvm --accelerate


Starting install...
Creating storage file win 100% |=========================|  20 GB    00:00     
Creating domain...                                                 0 B 00:00 
Domain installation still in progress. Waiting for installation to complete.

我希望这可以帮助任何可能在这里遇到困难的人。

答案2

--nonetworks关于@Brandon 的回答:Windows Server 2003(适用于小型企业),如果您从(2016 年:)开始,则会卡在安装的最后--network none,显示一条错误消息,提示您需要安装支持 TCP/IP 的网络适配器。

更好的策略是安装用户模式(本地 LAN)网络,然后通过iptables禁用该机器的互联网访问。

我通常这样开始: sudo virt-install \ --connect qemu:///system \ --name=win2k3-br1 \ --ram=1024 \ --vcpus=2 \ --os-type=windows --os-variant=win2k3 \ --virt-type=kvm \ --hvm \ --graphics vnc,port=5951 \ --cdrom=/var/lib/libvirt/boot/w2003cd1.iso \ --disk path=/var/lib/libvirt/images/win2k3-br1.img,size=10 \ --disk path=/var/lib/libvirt/boot/virtio-win_x86.vfd,device=floppy \ --network=network:default,model=virtio

要将“监视器”连接到您的机器,我使用 vnc 和 ssh 端口转发:

ssh user@[IP of KVM master] -L 5951:127.0.0.1:5951 then start a vnc client (I use vinagre) locally and connect to 127.0.0.1:5951

不要忘记下载 Windows 2003 SCSI 驱动程序(virtio-win_x86.vfd),并F6在安装开始前按下,然后手动添加它(真正的挑战是启动 vnc 客户端并按 F6),否则安装将无限期地停留在剩余 33 分钟。

一个小注释(在 ubuntu 16.04.1,2016 年 10 月),如果我使用 qcow2 磁盘映像格式(--disk path=/var/lib/libvirt/images/win2k3.qcow2,size=40,bus=virtio,format=qcow2),安装也会卡住。

相关内容