Kvm

kvm Spice 圖形錯誤:get_drawable 失敗

  • May 31, 2018

我在 Ubuntu 伺服器 16.04 上執行 KVM。我正在嘗試更改執行桌面環境的虛擬機的解析度。為此,我使用遠端的virt-viewer連接到虛擬機:

virt-viewer --connect qemu+ssh://user@host/system myvm  

從那裡我使用xrandr更改解析度:

xrandr --output Virtual-0 --mode 1920x1200

然後 UI 凍結,我無法鍵入或點擊任何內容。

從主機我可以從日誌中看到這一點

((null):3347): SpiceWorker-Warning **: red_worker.c:163:rendering_incorrect: rendering incorrect from now on: failed to get_drawable

重複多次。

我已經在 vm 上安裝了 ssh-server,雖然 virt-viewer 似乎已經死了,但我的 ssh 連接很好,我可以從終端做一些事情。也許其他可以提供幫助的東西。這個設置曾經在我執行桌面環境時工作,哦主機,而現在它只是伺服器。

這是來自 vm的dumpxml

<domain type='kvm' id='3'>
 <name>myvm</name>
 <uuid>1a3e678f-9e8c-457f-9089-f5a0781307d7</uuid>
 <memory unit='KiB'>2097152</memory>
 <currentMemory unit='KiB'>2097152</currentMemory>
 <vcpu placement='static'>2</vcpu>
 <resource>
   <partition>/machine</partition>
 </resource>
 <os>
   <type arch='x86_64' machine='pc-i440fx-xenial'>hvm</type>
   <boot dev='hd'/>
 </os>
 <features>
   <acpi/>
   <apic/>
 </features>
 <cpu mode='host-model'>
   <model fallback='allow'/>
 </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/kvm-spice</emulator>
   <disk type='file' device='disk'>
     <driver name='qemu' type='qcow2'/>
     <source file='/var/lib/libvirt/images/myvm.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' type='raw'/>
     <backingStore/>
     <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:ba:17:fd'/>
     <source bridge='br0'/>
     <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/2'/>
     <target port='0'/>
     <alias name='serial0'/>
   </serial>
   <console type='pty' tty='/dev/pts/2'>
     <source path='/dev/pts/2'/>
     <target type='serial' port='0'/>
     <alias name='serial0'/>
   </console>
   <input type='mouse' bus='ps2'/>
   <input type='keyboard' bus='ps2'/>
   <graphics type='vnc' port='5901' autoport='yes' listen='0.0.0.0'>
     <listen type='address' address='0.0.0.0'/>
   </graphics>
   <video>
     <model type='qxl' ram='262144' vram='131072' vgamem='131072' heads='1'>
       <acceleration accel3d='yes' accel2d='yes'/>
     </model>
     <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='apparmor' relabel='yes'>
   <label>libvirt-1a3e678f-9e8c-457f-9089-f5a0781307d7</label>
   <imagelabel>libvirt-1a3e678f-9e8c-457f-9089-f5a0781307d7</imagelabel>
 </seclabel>
</domain>

原來問題不Spice在於 Hypervisor 或 Hypervisor。將客戶核心升級到 4.16 後,更改解析度沒有問題。

引用自:https://unix.stackexchange.com/questions/445200