如何在远程 Ubuntu/Debian Linux 服务器上运行无 libvirt 的 headless qemu?

nbs*_*020 0 ubuntu debian qemu headless debian-based

我已经尝试过什么?

qemu-system-x86_64 -hda hdd.img -m 1G -net nic, macaddr=MACADDR -net bridge,br=BRIDGE -enable-kvm -nographic -daemonize

qemu-system-x86_64 -hda hdd.img -m 1G -net nic, macaddr=MACADDR -net bridge,br=BRIDGE -enable-kvm -display none -daemonize

qemu-system-x86_64 -hda hdd.img -m 1G -net nic, macaddr=MACADDR -net bridge,br=BRIDGE -enable-kvm -nographic -serial mon:stdio -append 'console=ttyS0'
Run Code Online (Sandbox Code Playgroud)

MACADDR 和 BRIDGE 在我的系统中定义。

我使用过-display none -daemonize,但失败并出现错误

qemu-system-x86_64: -nographic cannot be used with -daemonize

我也尝试过-nographic -serial mon:stdio -append 'console=ttyS0',但也失败并出现错误:

Failed to initialize module: /usr/lib/x86_64-linux-gnu/qemu/block-iscsi.so
Note: only modules from the same build can be loaded.
Failed to initialize module: /usr/lib/x86_64-linux-gnu/qemu/block-curl.so
Note: only modules from the same build can be loaded.
Failed to initialize module: /usr/lib/x86_64-linux-gnu/qemu/block-rbd.so
Note: only modules from the same build can be loaded.
Failed to initialize module: /usr/lib/x86_64-linux-gnu/qemu/block-dmg.so
Note: only modules from the same build can be loaded.
Run Code Online (Sandbox Code Playgroud)

所以我的问题是

如何libvirt在没有远程 Linux 服务器的情况下运行 headless qemu?

提前致谢。

Pet*_*ell 5

这不是您问题的完整答案,但我可以看到一些可能引导您走向正确方向的事情。

首先,尝试运行 QEMU,但不使其无头且不对其进行守护进程。“无法初始化模块”问题表明 qemu-system-x86_64 二进制文件与其尝试加载的动态加载模块之间不匹配。这与无头运行无关,因此您可以单独修复它。

其次,您应该停止尝试使用“-ngraphic”。这是一个“方便”的选项,可以同时完成很多事情:它将串行端口和监视器放在控制台上,禁用显示输出,不为客户提供图形设备,等等。您最好使用多个单独的选项来完成您想要的单独操作。(例如,“-display none”表示“不显示 GUI 窗口”)。

第三,您应该弄清楚您希望控制台输出到哪里:“-serial mon:stdio”意味着您想要将串行端口发送到您的终端,但“-daemonize”意味着您不想将任何内容发送到您的终端。终端。如果您两者都做,QEMU 不会抱怨,但它们在一起并没有真正的意义。