QEMU-KVM:VM 不会使用 virsh 启动,只能使用 qemu-system-x86_64 启动

QEMU-KVM:VM 不会使用 virsh 启动,只能使用 qemu-system-x86_64 启动

我有一个原始的 Arch Linux VM,磁盘为 qcow2 格式。我最近对其进行了升级,但它停止工作了。每次运行时$ virsh start Arch我都会得到:

Starting version 243.78-2-arch
ERROR: device 'UUID=<ID>' not found. Skipping fsck
mount: new_root: can't find UUID=<ID>.
You are now being dropped into an emergency shell.
sh: can't access tty; job control turned off.
[rootfs ]#

我使用了一个 Live CD 并在其中进行了 chroot,我检查fstab发现我的/dev/sda1正在被挂载到 /,其 UUID 与错误消息中指示的相同。我重新运行了grub-mkconfigmkinitcpio但错误消息仍然存在。

然后,我尝试创建一个新的虚拟机并使用以下命令保留我的驱动器:

$ sudo virt-install -n archlinux --description "Arch installation because of failure of Arch VM" --os-type=archlinux --ram=1024 --vcpu=1 --disk path='/var/lib/libvirt/images/Arch.qcow2',bus=virtio --network bridge:virbr0 --check path_in_use=off --import

但也没用。我最终决定在外部启动这个磁盘virsh,令我惊讶的是,下面的命令可以很好地启动我的虚拟机:

$ sudo qemu-system-x86_64 -drive file=/var/lib/libvirt/images/Arch.qcow2,format=qcow2 -m 1G

那么,我的 virsh 配置中的什么可能导致了这个问题?

这是该虚拟机的 dumpxml:

$ virsh dumpxml Arch
<domain type='kvm' id='20'>
  <name>Arch</name>
  <uuid>e8fa46c2-7b5e-42a5-87ae-f9eaccc13529</uuid>
  <description>Arch Linux</description>
  <memory unit='KiB'>2097152</memory>
  <currentMemory unit='KiB'>2097152</currentMemory>
  <vcpu placement='static'>1</vcpu>
  <resource>
    <partition>/machine</partition>
  </resource>
  <os>
    <type arch='x86_64' machine='pc-i440fx-4.1'>hvm</type>
    <boot dev='hd'/>
  </os>
  <features>
    <acpi/>
    <apic/>
  </features>
  <cpu mode='host-passthrough' check='none'/>
  <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='/var/lib/libvirt/images/Arch.qcow2'/>
      <backingStore/>
      <target dev='vda' bus='virtio'/>
      <alias name='virtio-disk0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu'/>
      <target dev='hda' bus='ide'/>
      <readonly/>
      <alias name='ide0-0-0'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
    <controller type='usb' index='0' model='ich9-ehci1'>
      <alias name='usb'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' 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='0x05' 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='0x05' 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='0x05' 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='bridge'>
      <mac address='52:54:00:7e:e5:69'/>
      <source bridge='virbr0'/>
      <target dev='vnet1'/>
      <model type='virtio'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
    <serial type='pty'>
      <source path='/dev/pts/8'/>
      <target type='isa-serial' port='0'>
        <model name='isa-serial'/>
      </target>
      <alias name='serial0'/>
    </serial>
    <console type='pty' tty='/dev/pts/8'>
      <source path='/dev/pts/8'/>
      <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>
    <graphics type='vnc' port='5901' autoport='yes' listen='127.0.0.1'>
      <listen type='address' address='127.0.0.1'/>
    </graphics>
    <video>
      <model type='cirrus' vram='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='0x06' function='0x0'/>
    </memballoon>
  </devices>
  <seclabel type='dynamic' model='dac' relabel='yes'>
    <label>+65534:+992</label>
    <imagelabel>+65534:+992</imagelabel>
  </seclabel>
</domain>

相关内容