VMware Communities
oberreiter
Contributor
Contributor

vmrun in a script at startup

I have a script to start up my Virtual Machines:

#!/bin/bash

/usr/bin/vmrun start /vm/path/vmName.vmx nogui

It works fine when I start it remote or local in a Terminal session.

Put During Startup invoked by init.d it crashes with:

"Error: Command failed: Unknown error"

Any Suggestions?

I use Suse Linux Enterprise Server 10 SP1 (x86_64) on Host and Client

Regards

Andreas

Tags (4)
0 Kudos
6 Replies
Liz
Virtuoso
Virtuoso

As it as part of the /etc/rc.d stuff, it could be a number of reasons.

Firstly are you sure vmware server has started fully by the time your script runs?

Second, it is possible as your running as root without running roots login script that the paths arent in place you could try running it as a specific username and password with the vmrun command.

0 Kudos
oberreiter
Contributor
Contributor

ad First: Yes, I am sure. I tried even to run it with delay by an "at now + 5 minutes".

ad Second: In my script I submit full path names. I gess the user name and password parameter of vmrun belong to the client OS?

Regards Andreas

0 Kudos
Liz
Virtuoso
Virtuoso

At this point there should still be entries into the vmware log files, with at least some part of an explaination..

oberreiter
Contributor
Contributor

I can See tow Problems in the log file.

1.) "Failed to detect host topology, using defaults for width and height"

2.) "[http://msg.License.no_valid_license2|http://msg.License.no_valid_license2] Cannot find a serial number to unlock this version of vmrun."

"Please enter a valid serial number by ..."

I have a valid Serial number.

When I start the vm after startup with the same script the logfile says. "LICENSE using: '/root/.vmware/license.ws.6.0.200610" and ther is no problem with the host topology.

Regards

Andreas

0 Kudos
yanfali
Contributor
Contributor

The problem is init.d scripts run from /. Your license is installed under username/.vmware. Softlink the directory for your license to /. e.g. ln -fs /root/.vmware / and now your vm should startup from the init.d script. Your post gave me the hint as to what was happening.

0 Kudos
ctompkins
Contributor
Contributor

I couldn't get the soft linking to work.

However, I did write and init.d script that worked using the 'env' command.

root@HOSTBOx:~# cat /etc/init.d/vmXPstart

#! /bin/sh

PATH=/sbin:/bin:/usr/sbin:/usr/bin:/

env HOME=/root \

vmrun start /home/vmadmin/vmware/Win_XP/Win_XP.vmx nogui

exit 0

I think a valid feature request would be to have a vmrun option to point to a license file.

Ubuntu 8.04

2.6.24-19-server

VMware Workstation 6.0.4 build-93057

0 Kudos