Here are some notes on how to use a serial console with illumos running as a guest in VirtualBox. As suggested by the VirtualBox support site, I use the
Build and install the "socat" program
Make sure you have readline installed
Normally, it should already be there. You can check with:
I found it Here
Configure and build socat
I did it like this:
If you're paranoid, do it like this:
and then look at what that prints, and do that by hand as
If you're more trusting, you can just:
Make a script, i.e socat-pipe
Mine contains the following: (improvements welcome!)
trap line restores your terminal's settings to defaults when the script exits or is killed. (See below for other variants.)
Use the "socat-pipe" script to connect to your VM
In VirtualBox, open the "settings" for your guest VM, and get to the "Serial Ports" page, "Port 1" tab.
Check the box "Enable Serial Port", and set the "Port Number" to
COM1, the "Port Mode" to "
Host Pipe", check "Create Pipe", and fill in the "Port/File Path" string with something like:
Start your guest VM, then run "
socat-pipe" like this:
If you don't want to always use the serial console with your VM, you can press 'e' during the grub menu, then add
-B console=ttya to the kernel line only for those occasions when you want to use that.
(You probably also want to add '-k' to get
Disconnecting from socat
It is possible to define one of the 127 ASCII control codes as the escape character that closes
escape=0xXX to your
socat options, for example, I use
0x11) to close my
socat terminal, so I run:
Which means you can just replace the line in the script above with:
ctrl+q work as a way to close
For a full table see http://www.cs.tut.fi/~jkorpela/chars/c0.html
Alternative script for socat-1.6.x, socat-1.7.0
I am using an expanded version of Gordon's script to loop executions of
socat for my VMs. This way, if the VM reboots (closing the pipe), there is soon a new
socat spawned to reattach to the console.
The script also includes a command-line option
-s to kill an existing script looping
socats, as a workaround to the lack of a tilde-escape.
stty were picked for my desktop (
twm in VNC): fall back to "
sane" settings and redefine the backspace character; YMMV.
Note for users of vboxsvc (the SMF wrapper project): as of the vboxsvc release 0.17, the
Hope this helps,
socat version 1.7.1, which allows me to wrap the raw serial connection presented by the pipe with a
I'm just learning
socat, but this appears necessary to provide terminal emulation on the console.