Olive (JunOS) and serial port in VMWare Fusion

From MyWiki

Jump to: navigation, search

The below is based on this and this links.

Here is what I ended up with to have a virtual serial port to my Olive image.

In the VM's .vmx file I added the following lines (close VMWare just to make sure that you don't mess things up):

serial0.present = "TRUE"
serial0.fileType = "pipe"
serial0.yieldOnMsrRead = "TRUE"
serial0.startConnected = "TRUE"
serial0.fileName = "serial0"

Then I installed socat from MacPorts:

$ sudo port install socat

And when I run the VM image, VMWare creates serial0 file in the VM's directory. So, I can point socat towards it to create a serial device file for me:

$ socat -d -d ~/vmware_images/JunOS\ CF\ 256/JunOS/serial0 PTY
2010/04/12 23:43:48 socat[18322] N opening connection to LEN=58 AF=1 "/Users/amarkelo/vmware_images/JunOS CF 256/JunOS/serial0"
2010/04/12 23:43:48 socat[18322] N successfully connected from local address LEN=16 AF=1 ""
2010/04/12 23:43:48 socat[18322] N successfully connected via 
2010/04/12 23:43:48 socat[18322] N PTY is /dev/ttys002
2010/04/12 23:43:48 socat[18322] N starting data transfer loop with FDs [3,3] and [4,4]

As you can see, it created /dev/ttys002, which I can now use to connect to the VM via this serial port:

 $ cu -l /dev/ttys002 -s 115200

And now I can see the boot messages comming:

Consoles: serial port  
BIOS drive A: is disk0
BIOS drive C: is disk1
BIOS drive D: is disk2
BIOS 638kB/1046464kB available memory

FreeBSD/i386 bootstrap loader, Revision 1.1
(builder@elliath.juniper.net, Wed Dec 17 23:00:37 UTC 2008)
Loading /boot/defaults/loader.conf 
/kernel text=0x98362c data=0x4f648+0x7b460 syms=[0x4+0x93cc0+0x4+0x9f8e1]


Hit [Enter] to boot immediately, or space bar for command prompt.
Booting [/kernel]...               

One thing I didn't like about it is that you can't point cu towards the serial device prior to firing up the VM as the file serial0 is not there yet. Hence you may miss good few lines during the boot sequence if you are as slow as I am :-). But I can leave with that.

Also, the poster in VMWare community forums used /tmp directory for the pipe, but I think the VM's directory is a better place for it. First, because security matters and second, because it's easier to handle more than one JunOS VM that way.

Personal tools