我在使用 libvirt 的虚拟机中有一个 ubuntu。我配置我的 guest 创建管道和 unix channel 用于 trace-virtio 目的:
<channel type='unix'>
<source mode='connect' path='path/to/socket'/>
<target type='virtio' name='unix-name'/>
<address type='virtio-serial' controller='0' bus='0' port='1'/>
</channel>
<channel type='pipe'>
<source path='path/to/pipe'/>
<target type='virtio' name='pipe-name'/>
<address type='virtio-serial' controller='0' bus='0' port='2'/>
</channel>
在我的 guest 中一切正常,我在我的虚拟机中的/dev 中有我的 channel ,我可以使用这些 channel 将数据发送到主机。但是当我编译内核并将其安装在我的虚拟机中并从 grub 中选择它时,这些 channel 就会消失。当我重新启动并选择原始内核时,它具有 channel 并且可以正常工作。我如何告诉 kvm 在我的虚拟机内的已编译内核中创建 channel ?
最佳答案
确保您为客人构建的内核具有与工作内核相同的配置选项。
你可以从 /proc/kconfig
得到这些(如果你幸运并且内核已经编译了)或者从与内核一起分发的 config
(通常在/boot
目录。
相关的很可能是描述的guest kvm选项here .尤其要确保 VIRTIO
选项处于打开状态。我的猜测是您缺少 VIRTIO_CONSOLE
(实际上是字符设备)。
关于linux - kvm 编译内核中缺少 channel ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31097645/