Skip to contentSkip to conversation

Log Console Output to File

Qemu-devel [email protected] 5 participants 10 messages Nov 11, 2010 – Nov 13, 2010

lore
Share & tools
lore
#0 lore raw

Hi,

Is there a way to log / copy the console output (like the Linux boot info, if booting QEMU to Linux) to a file?

Thanks!

#1 lore raw
Quoted 3 lines · On Thu, Nov 11, 2010 at 12:50, <[email protected]> wrote:

Hi,

Is there a way to log / copy the console output (like the Linux boot info, if booting QEMU to Linux) to a file?

I think you could consider booting Linux in serial console...then start Qemu with -nographic. From there, everything will be spilled right in your standart output. Then you can use your favourite method to save the output...let's say using "script" command.

Signature · 7 lines
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com
#2 lore raw
Quoted 10 lines · Mulyadi Santosa
Quoted 3 lines · On Thu, Nov 11, 2010 at 12:50, <[email protected]> wrote:

Hi,

Is there a way to log / copy the console output (like the Linux boot info, if booting QEMU to Linux) to a file?

I think you could consider booting Linux in serial console...then start Qemu with -nographic. From there, everything will be spilled right in your standart output. Then you can use your favourite method to save the output...let's say using "script" command.

I use 'screen' and its logging capability (Ctrl-a H). Launch the VM with '-serial stdio -nographic' and have the guest console directed to ttyS0 (console=ttyS0 kernel arg).

David

#3 lore raw

Hi,

Thanks for the pointer! I tried this, but I get an error message, as follows ...

chardev: opening backent "stdio" failed

qemu: could not open serial device 'stdio': Inappropriate ioctl for device.

Thoughts?

Thanks again!

Quoted 1 line · David S. Ahern
Quoted 17 lines · Mulyadi Santosa
Quoted 10 lines · On Thu, Nov 11, 2010 at 12:50, <[email protected]> wrote:
Quoted 3 lines

Hi,

Is there a way to log / copy the console output (like the Linux boot info, if booting QEMU to Linux) to a file?

I think you could consider booting Linux in serial console...then start Qemu with -nographic. From there, everything will be spilled right in your standart output. Then you can use your favourite method to save the output...let's say using "script" command.

I use 'screen' and its logging capability (Ctrl-a H). Launch the VM with '-serial stdio -nographic' and have the guest console directed to ttyS0 (console=ttyS0 kernel arg).

David

#4 lore raw
Quoted 11 lines · Russell Morris

Hi,

Thanks for the pointer! I tried this, but I get an error message, as follows ...

*chardev: opening backent "stdio" failed*

*qemu: could not open serial device 'stdio': Inappropriate ioctl for device.*

qemu command line?

David

Quoted 32 lines

Thoughts?

Thanks again!

On Thu, Nov 11, 2010 11:22 AM, "David S. Ahern" <[email protected]> wrote:

On 11/11/10 09:57, Mulyadi Santosa wrote:
> On Thu, Nov 11, 2010 at 12:50, <[email protected] <mailto:[email protected]>> wrote:
>> Hi,
>>
>> Is there a way to log / copy the console output (like the Linux boot info, if booting QEMU to Linux) to a file?
>
> I think you could consider booting Linux in serial console...then > start Qemu with -nographic. From there, everything will be spilled > right in your standart output. Then you can use your favourite method > to save the output...let's say using "script" command.
>

I use 'screen' and its logging capability (Ctrl-a H). Launch the VM with '-serial stdio -nographic' and have the guest console directed to ttyS0 (console=ttyS0 kernel arg).

David

#5 lore raw

Here you go ...
qemu-system-arm -serial stdio -nographic -M versatilepb -kernel zImage-2.6.34-r4-qemuarm.bin -hda minimal-console-image-eglibc-ipk-dev-snapshot-20101110-qemuarm.rootfs.ext3 -append "root=/dev/sda"

And the output ...
chardev: opening backend "stdio" failed
qemu: could not open serial device 'stdio': Inappropriate ioctl for device

Thoughts?

Thanks!

Quoted 50 lines · David S. Ahern
Quoted 11 lines · Russell Morris

Hi,

Thanks for the pointer! I tried this, but I get an error message, as follows ...

*chardev: opening backent "stdio" failed*

*qemu: could not open serial device 'stdio': Inappropriate ioctl for device.*

qemu command line?

David

Quoted 32 lines

Thoughts?

Thanks again!

On Thu, Nov 11, 2010 11:22 AM, "David S. Ahern" <[email protected]> wrote:

On 11/11/10 09:57, Mulyadi Santosa wrote:
> On Thu, Nov 11, 2010 at 12:50, <[email protected] <[email protected]>> wrote:
>> Hi,
>>
>> Is there a way to log / copy the console output (like the Linux boot info, if booting QEMU to Linux) to a file?
>
> I think you could consider booting Linux in serial console...then > start Qemu with -nographic. From there, everything will be spilled > right in your standart output. Then you can use your favourite method > to save the output...let's say using "script" command.
>

I use 'screen' and its logging capability (Ctrl-a H). Launch the VM with '-serial stdio -nographic' and have the guest console directed to ttyS0 (console=ttyS0 kernel arg).

David

#6 lore raw
In reply to Russell Morris

Am 11.11.2010 21:37, schrieb Russell Morris:

Quoted 7 lines

Hi,

Thanks for the pointer! I tried this, but I get an error message, as follows ... *chardev: opening backent "stdio" failed*
*qemu: could not open serial device 'stdio': Inappropriate ioctl for device.*

Thoughts?

Hi,

I assume that you tried this (as it was suggested by an earlier mail):

qemu -serial stdio -nographic ...

This results in an error message for me, too:

chardev: opening backend "stdio" failed
qemu: could not open serial device 'stdio': No such file or directory

Try this variant (which works for me):

qemu -nographic ...

It will redirect the serial output (first serial port) of your guest os to standard output, so you can write it to a file with the usual methods, for example this one:

qemu -nographic ... | tee log.txt

Regards

Stefan Weil

#7 lore raw
Quoted 30 lines · Stefan Weil

Am 11.11.2010 21:37, schrieb Russell Morris:

Quoted 9 lines

Hi,

Thanks for the pointer! I tried this, but I get an error message, as follows ...
*chardev: opening backent "stdio" failed*
*qemu: could not open serial device 'stdio': Inappropriate ioctl for device.*

Thoughts?

Hi,

I assume that you tried this (as it was suggested by an earlier mail):

qemu -serial stdio -nographic ...

This results in an error message for me, too:

chardev: opening backend "stdio" failed
qemu: could not open serial device 'stdio': No such file or directory

Try this variant (which works for me):

qemu -nographic ...

It will redirect the serial output (first serial port) of your guest os to standard output, so you can write it to a file with the usual methods, for example this one:

Quoted 6 lines

qemu -nographic ... | tee log.txt

Regards

Stefan Weil

On one host I am using qemu-kvm from qemu-system-x86-0.13.0-1.fc14.x86_64, and on another /usr/local/qemu-kvm.latest/bin/qemu-kvm where latest was qemu-kvm.git on Oct 11. Both work fine. I like this route (using screen and stdio -- no piping) so that I still have a usable console.

Maybe it's a difference between qemu and qemu-kvm.

David

#8 lore raw
In reply to Stefan Weil

Hi,

Yes, this works, as does adding in "-vnc :0" (and then connection to this via VNC) ... but in both cases I am not able to collect the console output that exists during the boot. Any thoughts on that?

Thanks!

Quoted 37 lines · Stefan Weil

Am 11.11.2010 21:37, schrieb Russell Morris:

Quoted 9 lines

Hi,

Thanks for the pointer! I tried this, but I get an error message, as follows ...
*chardev: opening backent "stdio" failed*
*qemu: could not open serial device 'stdio': Inappropriate ioctl for device.*

Thoughts?

Hi,

I assume that you tried this (as it was suggested by an earlier mail):

qemu -serial stdio -nographic ...

This results in an error message for me, too:

chardev: opening backend "stdio" failed
qemu: could not open serial device 'stdio': No such file or directory

Try this variant (which works for me):

qemu -nographic ...

It will redirect the serial output (first serial port) of your guest os to standard output, so you can write it to a file with the usual methods, for example this one:

qemu -nographic ... | tee log.txt

Regards

Stefan Weil

#9 lore raw
In reply to Stefan Weil

Hi,

A bit more on this - as I have been trying to get it working ... :-).

The command you provided did work if I use /dev/tty in place of stdio (i.e. -serial /dev/tty) ... except that it only "starts" to work once I have a login prompt in QEMU (and then also in my command window). I'm trying to capture all the Linux boot info / messages prior to that. Any idea how to get this info to show up in my console window (where I'm executing qemu from)?

Thanks!

Quoted 1 line · Stefan Weil

Am 11.11.2010 21:37, schrieb Russell Morris:

Quoted 36 lines
Quoted 9 lines

Hi,

Thanks for the pointer! I tried this, but I get an error message, as follows ...
*chardev: opening backent "stdio" failed*
*qemu: could not open serial device 'stdio': Inappropriate ioctl for device.*

Thoughts?

Hi,

I assume that you tried this (as it was suggested by an earlier mail):

qemu -serial stdio -nographic ...

This results in an error message for me, too:

chardev: opening backend "stdio" failed
qemu: could not open serial device 'stdio': No such file or directory

Try this variant (which works for me):

qemu -nographic ...

It will redirect the serial output (first serial port) of your guest os to standard output, so you can write it to a file with the usual methods, for example this one:

qemu -nographic ... | tee log.txt

Regards

Stefan Weil