我刚刚发现如果你运行 QEMU-monitor telnet::45454,server,nowait -nographic
,然后 Ctrl-C 终止 QEMU VM,而不是在来宾上生成 SIGINT:使用 -ngraphic 运行 qemu 时如何将 Ctrl-C 传递给来宾? | Unix 和 Linux 堆栈交换
但是,我不想删除-monitor
因为自动化监控命令很方便,例如它允许我创建一个帮助程序脚本,它可以执行以下操作:
echo 'savevm my_snap_id' | telnet localhost 45454
有没有办法既保留我的Ctrl-C
and -monitor
与...一起工作-nographic
?
完整的 QEMU 命令:
qemu-system-x86_64 -append 'root=/dev/vda console=ttyS0' -kernel 'bzImage' -drive file='rootfs.ext2.qcow2,if=virtio,format=qcow2' -nographic -monitor telnet::45454,server,nowait
在 QEMU 2.10.1、Ubuntu 17.10 上,完整的 QEMU 命令:
./x86_64-softmmu/qemu-system-x86_64 \
-append "root=/dev/sda console=ttyS0 nokaslr printk.time=y" \
-drive file="${dir}/out/x86_64/buildroot/images/rootfs.ext2.qcow2,format=qcow2" \
-kernel "${dir}/out/x86_64/buildroot/images/bzImage" \
-nographic \
如果我添加:
-chardev stdio,id=s1,signal=off \
-serial none -device isa-serial,chardev=s1
then Ctrl+C
开始按预期工作,但是Ctrl+A X
退出 QEMU 不起作用,这有时很烦人:我可以使用telnet
to quit
,但它需要更多的打字/自动化。
http://lists.nongnu.org/archive/html/qemu-discuss/2018-04/msg00006.html