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 socat program.
Build and install the "socat" program
Make sure you have readline installed
Normally, it should already be there. You can check with:
Download socat-1.6.0.1
I found it Here
Configure and build socat.
I did it like this:
Install socat
If you're paranoid, do it like this:
and then look at what that prints, and do that by hand as root.
If you're more trusting, you can just:
Make a script, i.e socat-pipe
Mine contains the following: (improvements welcome!)
The 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 kmdb.)
Future work, bugs, etc.
I've never figured out how to enable a special "disconnect" sequence, i.e. the way tilde (~) gets you out of ssh.
So once you run socat-pipe in some terminal window, the only way to make it quit is either to kill it from some other window, or stop the VM so the pipe closes.
If someone can figure out how to enable a disconnect sequence in socat, please let me know.
Thanks,
Gordon
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.
Exit-options for 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,
//Jim Klimov
Alternatives.
I'm using socat version 1.7.1, which allows me to wrap the raw serial connection presented by the pipe with a PTY:
I'm just learning socat, but this appears necessary to provide terminal emulation on the console.
Cheers,
Bayard