我刚刚发现,如果使用来运行QEMU -monitor telnet::45454,server,nowait -nographic,那么Ctrl-C会杀死QEMU VM而不是在来宾上生成SIGINT:使用-nographic运行qemu时如何将Ctrl-C传递给来宾?| Unix和Linux堆栈交换
但是,我不想删除-monitor它,因为它使监视命令自动化非常方便,例如,它允许我创建一个执行以下操作的帮助程序脚本:
echo 'savevm my_snap_id' | telnet localhost 45454
Run Code Online (Sandbox Code Playgroud)
有没有办法让我Ctrl-C和我保持-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
Run Code Online (Sandbox Code Playgroud)
在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 \
Run Code Online (Sandbox Code Playgroud)
如果我添加:
-chardev stdio,id=s1,signal=off \
-serial none -device isa-serial,chardev=s1
Run Code Online (Sandbox Code Playgroud)
然后Ctrl+C根据需要开始工作,但Ctrl+A X不能退出QEMU,这有时很烦人:我可以使用telnetto quit,但是它需要更多的键入/自动化操作。
http://lists.nongnu.org/archive/html/qemu-discuss/2018-04/msg00006.html
qemu ×1