VMware Communities
Edoardo
Contributor
Contributor

Start a VM (6) in background mode on a Linux Host?

I found a post with a vbs hack for windows hosts.

I only run vmware 6 on a linux host - and would find the background start very useful

Can anyone provide a linux workaround while I'll wait for the promised update with the noguio option for vmrun ?

0 Kudos
7 Replies
KevinG
Immortal
Immortal

The VIX API runs on the Microsoft Windows and Linux platforms. This release supports clients written in C, Perl, and COM.

To use the VIX API you msut have Workstation 6. You could write a Perl script on a Linux host using the VIX API

http://pubs.vmware.com/vix-api/ReferenceGuide/

0 Kudos
Edoardo
Contributor
Contributor

Thanks for the pointer

but I'd hoped some vmperson Smiley Happy could post such a perl script that could be the rough equivalent of the promised nogui option ...

cheers

0 Kudos
Edoardo
Contributor
Contributor

actually the vix docs have a good example of using VMPowerOn

but I just can't run it because

perl vmrunnogui.pl

Can't locate VMWare/Vix/Simple.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.8.8 /usr/local/share/perl/5.8.8 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.8 /usr/share/perl/5.8 /usr/local/lib/site_perl .) at vmrunnogui.pl line 1.

BEGIN failed--compilation aborted at vmrunnogui.pl line 1.

so I serached for vix perl installation instructions,

found this post

http://www.vmware.com/community/thread.jspa?messageID=656036&#656036

but I cannot even successfully execute make in the vix-perl directory

cc -c -I. -D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DDEBIAN -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -DVERSION

=\"0.01\" -DXS_VERSION=\"0.01\" -fPIC "-I/usr/lib/perl/5.8/CORE" -Dbool=char -DHAS_BOOL VixBinding.c

In file included from VixBinding.xs:8:

/usr/lib/perl/5.8/CORE/perl.h:420:24: error: sys/types.h: No such file or directory

/usr/lib/perl/5.8/CORE/perl.h:451:19: error: ctype.h: No such file or directory

/usr/lib/perl/5.8/CORE/perl.h:463:23: error: locale.h: No such file or directory

/usr/lib/perl/5.8/CORE/perl.h:480:20: error: setjmp.h: No such file or directory

/usr/lib/perl/5.8/CORE/perl.h:486:26: error: sys/param.h: No such file or directory

/usr/lib/perl/5.8/CORE/perl.h:491:23: error: stdlib.h: No such file or directory

/usr/lib/perl/5.8/CORE/perl.h:496:23: error: unistd.h: No such file or directory

/usr/lib/perl/5.8/CORE/perl.h:776:23: error: string.h: No such file or directory

/usr/lib/perl/5.8/CORE/perl.h:925:27: error: netinet/in.h: No such file or directory

/usr/lib/perl/5.8/CORE/perl.h:929:26: error: arpa/inet.h: No such file or directory

/usr/lib/perl/5.8/CORE/perl.h:939:25: error: sys/stat.h: No such file or directory

/usr/lib/perl/5.8/CORE/perl.h:961:21: error: time.h: No such file or directory

/usr/lib/perl/5.8/CORE/perl.h:968:25: error: sys/time.h: No such file or directory

/usr/lib/perl/5.8/CORE/perl.h:975:27: error: sys/times.h: No such file or directory

/usr/lib/perl/5.8/CORE/perl.h:982:19: error: errno.h: No such file or directory

/usr/lib/perl/5.8/CORE/perl.h:997:25: error: sys/socket.h: No such file or directory

/usr/lib/perl/5.8/CORE/perl.h:1024:21: error: netdb.h: No such file or directory

/usr/lib/perl/5.8/CORE/perl.h:1127:24: error: sys/ioctl.h: No such file or directory

/usr/lib/perl/5.8/CORE/perl.h:1156:23: error: dirent.h: No such file or directory

In file included from /usr/lib/gcc/i486-linux-gnu/4.1.2/include/syslimits.h:7,

from /usr/lib/gcc/i486-linux-gnu/4.1.2/include/limits.h:11,

from /usr/lib/perl/5.8/CORE/perl.h:1510,

from VixBinding.xs:8:

I am unsure what I am missing (ubuntu 7.04 is my host).

0 Kudos
ter_roshak
Enthusiast
Enthusiast

The build error indicates that either your environment is not setup properly, or you dont have glibc-headers installed. glibc-headers provides most of the missing files..

Message was edited by:

ter_roshak

0 Kudos
Edoardo
Contributor
Contributor

thanks I installed libstdc++6-4.1-dev

and its deps and make completed succesfully.

when I try to run my perl script vmrunnogui.pl however

$ perl -I/usr/lib/vmware/vmware-vix/api/vix-perl/lib -I/usr/lib/vmware/vmware-vix/api/vix-perl/lib/API vmrunnogui.pl

Can't locate VMWare/Vix/Simple.pm in @INC (@INC contains: /usr/lib/vmware/vmware-vix/api/vix-perl/lib /usr/lib/vmware/vmware-vix/api/vix-perl/lib/API /etc/perl /usr/local/lib/perl/5.8.8 /usr/local/share/perl/5.8.8 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.8 /usr/share/perl/5.8 /usr/local/lib/site_perl .) at vmrunnogui.pl line 1.

BEGIN failed--compilation aborted at vmrunnogui.pl line 1.

the directory /usr/lib/vmware/vmware-vix/api/vix-perl/lib is where make left Simple.pm

the

0 Kudos
ter_roshak
Enthusiast
Enthusiast

I would recommend that you try logging out/in or spawning a new shell so that your environment gets updated and see if that fixes the module not found error.

0 Kudos
Edoardo
Contributor
Contributor

OK I found the problem.

I copied and pasted the VMPowerOn() example.

it contains a capitalization mistake in the uses.

the first use should be 'VMware' not 'VMWare'

as the make install places the perl modules in

/usr/local/lib/perl/5.8.8/VMware

once that was fixed, I had to fix the LD_LIBRARY_PATH :

$export LD_LIBRARY_PATH=/usr/lib/vmware/vmware-vix/api/vix-perl

then I could run my perl script (without any additional -I)

but the VMPowerOn function opens a GUI even if for its powerOnOptions I used

VIX_VMPOWEROP_NORMAL rather than VIX_VMPOWEROP_LAUNCH_GUI

$err = VMPowerOn($vmHandle,

VIX_VMPOWEROP_NORMAL, # powerOnOptions

VIX_INVALID_HANDLE); # propertyListHandle

0 Kudos