qemu-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-discuss] How to redirect QEMU -serial output to both a file an


From: Jakob Bohm
Subject: Re: [Qemu-discuss] How to redirect QEMU -serial output to both a file and the terminal or a port?
Date: Mon, 12 Nov 2018 23:52:23 +0100
User-agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1

On 11/11/2018 11:57, Ciro Santilli wrote:
https://superuser.com/questions/1373226/how-to-redirect-qemu-serial-output-to-both-a-file-and-the-terminal-or-a-port

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

Try using the socat and tee commands to set up a pty that writes
to file and your I/O, then tell qemu to connect the serial port
to your pty.  This even works for multiple virtual serial ports,
each with their own terminal window or ssh session.

I'm not completely sure, but something like

In process/shell connected to terminal window:

  socat PTY:link=/run/yourpath/vm1serial,wait-slave - | tee file

In process/shell not necessarily connected to terminal window:

  qemu-system-x86_64 -serial /run/yourpath/vm1serial

Where "yourpath" and "file" is up to you

There is also the "-serial pty" option to qemu, but my copy of
the qemu 2.8.0 manpage leaves it basically undocumented (it says
it creates a pty, but not what it does with it).

Enjoy

Jakob
--
Jakob Bohm, CIO, Partner, WiseMo A/S.  https://www.wisemo.com
Transformervej 29, 2860 Søborg, Denmark.  Direct +45 31 13 16 10
This public discussion message is non-binding and may contain errors.
WiseMo - Remote Service Management for PCs, Phones and Embedded




reply via email to

[Prev in Thread] Current Thread [Next in Thread]