blino's website

Free software developer and more

While trying to reproduce and debug UnionFS bugs with VirtualBox, I needed to extract a copy of the call traces.

Screenshots are not easily usable, so I tried the "serial ports" feature of VirtualBox.

An "Host Pipe" mode is available, to redirect serial port output to a pipe. But it didn't work by using a named pipe, created with mkfifo. Actually, if set to create the pipe, VirtualBox will create a UNIX local domain socket.

$ file /tmp/vbox-pipe 
/tmp/vbox-pipe: socket

The "pipe" name is a bit ambiguous, it's easy to understand it as a fifo, not a socket (and actually, the Windows implementation uses a named pipe in VirtualBox...)

This is all explained in VirtualBox's manual (PDF) (section 3.7.9: Serial ports), which even mentions the nice socat utility.

So, to get serial output to stdout, one can use:

socat /tmp/vbox-pipe -

Or to keep serial output in a log file:

socat -u /tmp/vbox-pipe GOPEN:vbox.log
tail -f vbox.log

Sometimes, the connection to the socket fails with ECONNREFUSED, so it can be better to create it with socat, before starting the virtual machine:

socat unix-listen:/tmp/vbox-pipe -

Or this way not to close the pipe everytime the virtual host is shut down:

socat unix-listen:/tmp/vbox-pipe,reuseaddr,fork -

Now, I just need to add console=ttyS0 as kernel command line option when booting my live system, and I have no excuse not to report the bugs. I could even try to fix them.



Comments are closed for this story.

Trackbacks are closed for this story.

blosxom Optimised for standards.
Olivier Blin (2005)