Virtualbox getting serial port to work
###############################
In here the notation “Port number” explains the port that will be used on the guest host, the notation is that of windows so you pick anything from COM1 to COM5 or whatever and if your guest is a linux box then they get the matching device so like COM1 is eqaul to /dev/ttyS0, more are below
The notation for “Port File/Path” this is the way windows or your HOST understands this, I say windows because I am using windows as my host for the virtual box program. In windows the syntax for these is of the form: \\.\pipe\ANYTHING, then when connecting with putty you have to connect to serial mode with the address \\.\pipe\ANYTHING. Replacing ANYTHING witha  logical name like COM1 or something. If you have a COM1 in your system thats taken then obviously dont use COM1.
HERE IS A WORKING CONFIG:
So you have a virtualbox running some VM.
SETUP: Windows VirtualBox running Debian VM
In this example my guest is a DEBIAN box
My host is a Windows 7 box. (the one where virtualbox is installed)
1. I have gone to the Serial Port Setting in VirtualBox.
2. Enabled Serial Port is checked.
3. Port Number : COM1  <—- this is the serial port on the guest so if its linux host then its /dev/ttyS0 maps to com1
4. Port mode is : Host Pipe
5. Make sure”Create Pipe” is checked – or If that option is missing, make sure “Connect to existing pipe/socket” is unchecked, which is the same option. Different versions of virtual box do it differently.
6. Port File/Path: \\.\pipe\COM1 (note that the part after pipe\ can be anything so you can put \\.\pipe\debian, the name is trivial. note that COM1 here didnt have to be named COM1 in accordance with step 3’s Port Number of COM1, I just did so that the mapping makes sense – the pipe name i pick is trivial).
CONNET: In Putty I connected like so:
7. I started Putty.
8. Choose Serial Mode
9. In Serial line : \\.\pipe\COM1 (or I could put \\.\pipe\debian if I named it that)
10. In Speed: I tried 9600 (or whatever baud rate you configured your /dev/ttyS0, com1 port on the debian system)
11. Connects right up

HOW THE GUEST PORT TRANSLATES BETWEEN WINDOWS AND LINUX NAMES:
This is about the step #3 setting “Port Number” where you set the guest serial port
Name Under Windows Name Under Linux IO Address Interrupt Request (IRQ)
COM 1 /dev/ttyS0 0x3F8 4
COM 2 /dev/ttyS1 0x2F8 3
COM 3 /dev/ttyS2 0x3E8 4
COM 4 /dev/ttyS3 0x2E8 3

ANOTHER SETTING THAT WORKED FOR THE CURIOUS:
Port Number : COM1  <—- this is the serial number on the guest so if its linux com1 means /dev/ttyS0
(Create Pipe) is checked.
Port File/Path: \\.\pipe\COM3
In putty just open a serial connection to \\.\pipe\COM3
analysis: Any “Port File/Path” works as long as it is a logical name. Note the debian box was not aware of this Port File/Path name, its only aware of the fact that I picked its serial port to be COM1 or in linux language /dev/ttyS0
ANOTHER SETTING THAT WORKED FOR THE CURIOUS:
Port Number : COM1  <—- this is the serial number on the guest so if its linux com1 means /dev/ttyS0
(Create Pipe) is checked.
Port File/Path: \\.\pipe\fred
In putty just open a serial connection to \\.\pipe\fred
analysis: Any “Port File/Path” works as long as it is a logical name. Note the debian box was not aware of this Port File/Path name of \\.\pipe\fred, its only aware of the fact that I picked its serial port to be COM1 or in linux language /dev/ttyS0
THIS DIDNT WORK:
Port Number : COM3  <—- the com port on the linux box equates to something like /dev/ttyS2
(Create Pipe) is checked.
Port File/Path: \\.\pipe\COM3
In putty just open a serial connection to \\.\pipe\COM3
analysis: The linux box, the guest, wasnt prepared for the COM3 or  /dev/ttyS2, it was programmed for /dev/ttyS0. it wasnt a typical debian box that I was emulating on my windows running virtualbox program. So this means leave the “Port number” at COM1 always as every system is programmed, or most at least, for COM1 (/dev/ttyS0)
 
THIS DIDNT WORK:
Port Number : COM3
(Create Pipe) is checked.
Port File/Path: \\.\pipe\COM1
In putty just open a serial connection to \\.\pipe\COM1
analysis: It still doenst work, the Port File/Path doesnt matter, it could be set to anything, whats making this fail is the fact that the Port Number is still set to COM3 and like I said above the debian box I am emulating is not programmed for COM3 or /dev/ttyS2

Leave a Reply

Your email address will not be published. Required fields are marked *