VMware Cloud Community
RickJasper
Contributor
Contributor

Defining serial port Without the GUI

I need access to my deployed virtual machine's serial console, not through a GUI window, but through ssh or telnet. I finally found how to define a serial console so that I can telnet in, which is perfect, but now I'd like to automate the defining of that serial device without using the vSphere Client GUI.

I can define my serial port from the vSphere Client GUI after deploying my VM by powering off the VM, Edit Settings -> Add a Serial Port, check "Connect via Network" -> Network Backing -> Server (VM listens for connections), Port URI = telnet://10.36.0.85:7001, where 10.36.0.85 is my ESXi 4.1 server's IP address and 7001 is a random port. When I power on my VM, I can telnet 10.36.0.85 7001 from a remote system and viola, I have serial console/terminal access.

In the vmx file, I can see

serial0.present = "TRUE"

serial0.yieldOnMsrRead = "TRUE"

serial0.fileType = "network"

serial0.fileName = "telnet://10.36.0.85:7001"

The question is, how can I define the above either in the ovf file before I deploy, as I deploy (I'm using ovftool from a remote system), or via a remote command afterwards, e.g. a vSphere CLI command? When I try exporting the ovf template from the vSphere client, I get "Device 'Serial port 1' cannot be exported."

Tags (2)
Reply
0 Kudos
6 Replies
admin
Immortal
Immortal

We don't support the serial console in OVF.

With that said you should try using ExtraConfig to setup the missing devices but I cannot promise that it will work on all VMware platforms etc.

eske

Reply
0 Kudos
RickJasper
Contributor
Contributor

ExtraConfig. Uh, ok. Sorry for being such an ignorant newbie, but isn't ExtraConfig part of PowerCLI, which is Windows only? I failed to mention I was hoping to accomplish this from a Linux system, so a Perl API or Linux command line ala vCLI solution is preferable. A Windows/PowerShell PowerCLI solution is out. Python or Java are also possible.

And all I care about is ESXi 4.1, not any other VMware platforms.

So how do I use ExtraConfig from Linux? I don't see it in the vSphere SDK for Perl Programming Guide, nor in any of the sample scripts, nor in the vCLI documentation.

Reply
0 Kudos
admin
Immortal
Immortal

sorry to be unclear. ExtraConfig in OVF is a way to express settings in the VMX file. Some values can be set and others cannot

try to take a look at http://communities.vmware.com/thread/228538

eske

Reply
0 Kudos
RickJasper
Contributor
Contributor

Yes, I found that thread yesterday before I posted my original question. The next-to-last entry in that thread says the OVF parser blacklists all the serial properties that I want to set, which jibes with the error message I got when I tried exporting the OVF template. It doesn't seem possible to define the serial port by adding <vmw:ExtraConfig vmw:key=serial0... lines to the OVF file directly.

I found addVMAdvParamOption.pl, but that tool doesn't seem to accomplish the task either, or if it can, I haven't figured it out yet.

I can see the VirtualSIOController and VirtualSerialPort devices in the virtual machine's configuration after using the VMware Perl Vim::find_entity_view API, and I can see they reference each other, but I still don't know how to define them without using the vSphere client GUI.

I thought I could power off the virtual machine, insert those 4 serial0* lines in the vmx file somehow, then power on the VM, but that didn't seem to work either and I would prefer a cleaner interface than hacking the vmx file directly.

Reply
0 Kudos
sfresher
Contributor
Contributor

Hi Rick,

I am trying to get a telnet access to the serial console of the VM.  However, as I completely follows your steps described in your post, I still cannot telnet to the VM (it says connection failed).  Is there any gotcha that I may miss?  or would you please share your story with more info?

Thanks!

Reply
0 Kudos
RickJasper
Contributor
Contributor

As far as I could gather, there is/was no easy way to do what I wanted to do.  That said, I was able to cobble together a solution.

First of all, VMware sells an additional license called the "Remote Virtual Serial Port Concentrator" license (for way too much money, IMO) per ESXi server, which is what allows one to pipe a virtual machine's serial port out to a telnet port, using a telnet daemon running on the ESXi server.  Paying the money and getting this license was the first step.  Thankfully, VMware's turnaround was quick enough after we paid the money, that we were able to install these permanent licenses before the temporary, evaluation licenses expired.

The next step was to dynamically configure this serial port for my virtual machines.  I could find no VMware-supplied API's, so I hacked my own perl script.  I've attached it in case others find it useful, warts and all.  I put in lots of comments since I was learning how to do this and I'm sure there's extra junk in there that's not needed, but it's working for me.  Use at your own risk.

Reply
0 Kudos