使用 libvirtd 时,我在启动 debian 或 ubuntu 网络安装映像时遇到问题,我得到了菜单,但在选择安装菜单选项时只需得到这个:
加载 /install.amd/vmlinuz 失败:没有这样的文件或目录
我已经安装了 iso 并验证了 debian netinstall iso 在 install.amd 目录中有 vmlinuz 文件等。
这是我在失败时使用的域的 libvirtd xml:
<domain type='kvm'>
<name>myserver</name>
<uuid>d85a11d4-78d8-2425-527b-2adef6c952a9</uuid>
<memory unit='KiB'>18192</memory>
<currentMemory unit='KiB'>18192</currentMemory>
<vcpu placement='static'>1</vcpu>
<os>
<type arch='x86_64' machine='pc-i440fx-5.2'>hvm</type>
</os>
<features>
<acpi/>
<apic/>
<pae/>
</features>
<cpu mode='custom' match='exact' check='none'>
<model fallback='forbid'>qemu64</model>
</cpu>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<emulator>/usr/bin/qemu-system-x86_64</emulator>
<disk type='file' device='cdrom'>
<driver name='qemu' type='raw'/>
<source file="/var/lib/libvirt/boot/debian-11.3.0-amd64-netinst.iso"/>
<target dev='hda' bus='ide'/>
<readonly/>
<boot order='2'/>
</disk>
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2' cache='none'/>
<source file='/opt/storage/VMs/myserver.qcow2'/>
<target dev='vdb' bus='virtio'/>
<boot order='1'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
</disk>
<controller type='usb' index='0' model='piix3-uhci'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
</controller>
<controller type='pci' index='0' model='pci-root'/>
<controller type='scsi' index='0' model='lsilogic'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</controller>
<interface type='network'>
<mac address='52:54:00:4c:d1:73'/>
<source network='net-simplebridge'/>
<model type='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
<serial type='pty'>
<target type='isa-serial' port='0'>
<model name='isa-serial'/>
</target>
</serial>
<console type='pty'>
<target type='serial' port='0'/>
</console>
<input type='keyboard' bus='usb'>
<address type='usb' bus='0' port='1'/>
</input>
<input type='mouse' bus='ps2'/>
<input type='keyboard' bus='ps2'/>
<graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1'>
<listen type='address' address='127.0.0.1'/>
</graphics>
<video>
<model type='vga' vram='8192' heads='1' primary='yes'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</video>
<memballoon model='virtio'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
</memballoon>
<rng model='virtio'>
<backend model='random'>/dev/random</backend>
<address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
</rng>
</devices>
</domain>
上面的 xml 将在此结束:
/usr/bin/qemu-system-x86_64 -name guest=myserver,debug-threads=on -S -object secret,id=masterKey0,format=raw,file=/var/lib/libvirt/qemu/domain-1- myserver/master-key.aes -machine pc-i440fx-5.2,accel=kvm,usb=off,dump-guest-core=off,memory-backend=pc.ram -cpu qemu64 -m 18 -object memory-backend- ram,id=pc.ram,size=18874368 -overcommit mem-lock=off -smp 1,sockets=1,cores=1,threads=1 -uuid d85a11d4-78d8-2425-527b-2adef6c952a9 -no-user-config -nodefaults -chardev socket,id=charmonitor,fd=34,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc -no-shutdown -boot strict=on -device piix3-usb- uhci,id=usb,bus=pci.0,addr=0x1.0x2 -device lsi,id=scsi0,bus=pci.0,addr=0x4 -blockdev {"driver":"file","filename":" /var/lib/libvirt/boot/debian-11.3.0-amd64-netinst.iso","节点名":"libvirt-2-storage","auto-read-only":true,"discard":"unmap"} -blockdev {"node-name":"libvirt-2-format","read-only":true, "驱动程序":"raw","文件":"libvirt-2-storage"} -device ide-cd,bus=ide.0,unit=0,drive=libvirt-2-format,id=ide0-0- 0,bootindex=2 -blockdev {"driver":"file","filename":"/opt/storage/VMs/myserver.qcow2","node-name":"libvirt-1-storage","cache" :{"direct":true,"no-flush":false},"auto-read-only":true,"discard":"unmap"} -blockdev {"node-name":"libvirt-1-format ","read-only":false,"cache":{"direct":true,"no-flush":false},"driver":"qcow2","file":"libvirt-1-storage","backing":null} -device virtio-blk-pci,bus=pci.0,addr=0x5,drive=libvirt-1-format,id=virtio-disk1,bootindex =1,write-cache=on -netdev tap,fd=36,id=hostnet0,vhost=on,vhostfd=37 -device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00 :4c:d1:73,bus=pci.0,addr=0x3 -chardev pty,id=charserial0 -device isa-serial,chardev=charserial0,id=serial0 -device usb-kbd,id=input0,bus=usb。 0,port=1 -vnc 127.0.0.1:0 -device VGA,id=video0,vgamem_mb=8,bus=pci.0,addr=0x2 -device virtio-baid=charserial0 -device isa-serial,chardev=charserial0,id=serial0 -device usb-kbd,id=input0,bus=usb.0,port=1 -vnc 127.0.0.1:0 -device VGA,id=video0, vgamem_mb=8,bus=pci.0,addr=0x2 -device virtio-baid=charserial0 -device isa-serial,chardev=charserial0,id=serial0 -device usb-kbd,id=input0,bus=usb.0,port=1 -vnc 127.0.0.1:0 -device VGA,id=video0, vgamem_mb=8,bus=pci.0,addr=0x2 -device virtio-ba
手动执行此操作时,它可以在同一台机器上正常工作,并且可以让我进入安装过程:
qemu-system-x86_64 -vnc :0 -enable-kvm -serial stdio -curses -hda /opt/storage/VMs/myserver.qcow2 -m 2G -boot d -cdrom /var/lib/libvirt/boot/debian-11.3 .0-amd64-netinst.iso
是否可以使用 libvirtd xml 配置获取“-cdrom”标志?或任何其他建议?