1

I would like to be able to both interact with the system via the command line, but also get the output to a file at the same time.

If I do:

qemu-sysem-x86_64 -serial stdio |& tee file

then it mostly works, but I would like to avoid any Bash operations and let QEMU do the heavy lifting for me. For example, I'm using Python, and it is not so simple to implement a reliable tee there.

If I do:

qemu-sysem-x86_64 -serial file:myfile

It redirects to the file and I can't give any input.

Is there a way to "combine" both file: and stdio to a single -serial?

Multiple -serial entries just create multiple serial ports instead of modifying a single one.

I'm also interested if it works with telnet as in:

-serial tcp::1234,server,nowait

http://lists.nongnu.org/archive/html/qemu-discuss/2018-11/msg00011.html

1

Recently, I ran into the exactly same problem and found a solution:

According to QEMU 3.1.0 documentation, you can use a chardev with options stdio and logfile and redirect your serial into it.

qemu-system-x86_64 -chardev stdio,id=char0,logfile=serial.log -serial chardev:char0

Moreover, if you use mux=on option within chardev, you can redirect a monitor (mon), another serial or other interfaces supporting chardev backend into it simultaneously:

qemu-system-x86_64 -chardev stdio,id=char0,mux=on,logfile=serial.log \
  -serial chardev:char0 -mon chardev=char0

See the example in the doc. link above.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.