Discussion:
Log Console Output to File
q***@rkmorris.us
2010-11-11 05:50:32 UTC
Permalink
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!
Mulyadi Santosa
2010-11-11 16:57:57 UTC
Permalink
Post by q***@rkmorris.us
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.
--
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com
David S. Ahern
2010-11-11 17:22:46 UTC
Permalink
Post by Mulyadi Santosa
Post by q***@rkmorris.us
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
Russell Morris
2010-11-11 20:37:25 UTC
Permalink
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!
Post by David S. Ahern
Post by Mulyadi Santosa
Post by q***@rkmorris.us
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
David S. Ahern
2010-11-11 20:43:25 UTC
Permalink
Post by 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
Post by Russell Morris
Thoughts?
Thanks again!
Post by Mulyadi Santosa
Post by q***@rkmorris.us
Hi,
Is there a way to log / copy the console output (like the Linux
boot info, if booting QEMU to Linux) to a file?
Post by Mulyadi Santosa
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
q***@rkmorris.us
2010-11-12 03:40:50 UTC
Permalink
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!
Post by David S. Ahern
Post by 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
Post by Russell Morris
Thoughts?
Thanks again!
Post by Mulyadi Santosa
Post by q***@rkmorris.us
Hi,
Is there a way to log / copy the console output (like the Linux
boot info, if booting QEMU to Linux) to a file?
Post by Mulyadi Santosa
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
Stefan Weil
2010-11-11 21:17:41 UTC
Permalink
Post by 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.*
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
David S. Ahern
2010-11-11 21:57:41 UTC
Permalink
Post by Stefan Weil
Post by 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.*
Thoughts?
Hi,
qemu -serial stdio -nographic ...
chardev: opening backend "stdio" failed
qemu: could not open serial device 'stdio': No such file or directory
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,
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
q***@rkmorris.us
2010-11-12 03:42:36 UTC
Permalink
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!
Post by Stefan Weil
Post by 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.*
Thoughts?
Hi,
qemu -serial stdio -nographic ...
chardev: opening backend "stdio" failed
qemu: could not open serial device 'stdio': No such file or directory
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,
qemu -nographic ... | tee log.txt
Regards
Stefan Weil
q***@rkmorris.us
2010-11-13 14:39:50 UTC
Permalink
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!
Post by Stefan Weil
Post by 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.*
Thoughts?
Hi,
qemu -serial stdio -nographic ...
chardev: opening backend "stdio" failed
qemu: could not open serial device 'stdio': No such file or directory
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,
qemu -nographic ... | tee log.txt
Regards
Stefan Weil
Loading...