VMware

This Question is Answered

1 2 3 4 Previous Next 50 Replies Last post: May 21, 2009 3:06 PM by Webalistic   Go to original post

Re: Not a Valid Virtual Machine Configuration...

15. Jul 26, 2008 11:31 AM in response to: WoodyZ
Click to view Sonicar's profile Novice 3 posts since
Mar 29, 2008

Thanks a lot Woody, it worked like a champ!

Because I've seen this problem twice in less than 2 months, I'm pretty confident that it will reoccur. So could you please describe the procedure on how to recover the .vmx file?

Thanks,

Sonicar

Re: Not a Valid Virtual Machine Configuration...

16. Jul 27, 2008 2:41 PM in response to: Sonicar
Click to view etung's profile Guru 11,086 posts since
Oct 15, 2006
In this example, vmware.log and Windows XP Professional 2.vmx are both zero length, so no good. The next newest log is vmware-0.log. Let's open it in TextEdit. Looking through the file, we come to a section that begins:
Jul 21 17:08:58.446: vmx| DICT --- CONFIGURATION
Jul 21 17:08:58.446: vmx| DICT            config.version = 8
Jul 21 17:08:58.446: vmx| DICT         virtualHW.version = 6
Jul 21 17:08:58.446: vmx| DICT             scsi0.present = TRUE
Jul 21 17:08:58.446: vmx| DICT                   memsize = 512


An equivalent section of the .vmx would look like:
config.version = "8"
virtualHW.version = "6"
scsi0.present = "TRUE"
memsize = "512"


You remove the timestamp, label, and leading whitespace, and add quotes around the value. Continue doing this for the entire configuration section (look at a working .vmx file to get a sense for what one looks like). Save the .vmx file (be sure to use plain text, not rich text).

Re: Not a Valid Virtual Machine Configuration...

17. Jul 29, 2008 4:52 PM in response to: WoodyZ
Click to view dude1974's profile Novice 2 posts since
Jul 29, 2008
Hi Friends,

Can some one help me, I am unable to run my vmware. Please find the attachment for the error msg and the vmware log file.

Thanks in advance.
Arun
Attachments:

Re: Not a Valid Virtual Machine Configuration...

18. Jul 29, 2008 6:23 PM in response to: dude1974
Click to view etung's profile Guru 11,086 posts since
Oct 15, 2006
Looks like a script would be helpful. Oh well, I always wanted an excuse to try perl...
Attachments:

Re: Not a Valid Virtual Machine Configuration...

19. Jul 29, 2008 8:14 PM in response to: etung
Click to view dude1974's profile Novice 2 posts since
Jul 29, 2008
Thanks a lot it is working now.

Re: Not a Valid Virtual Machine Configuration...

20. Aug 21, 2008 2:35 PM in response to: etung
Click to view etung's profile Guru 11,086 posts since
Oct 15, 2006
Finally got a few minutes. Disclaimer: not a perl expert, in fact, this is the first bit I've written.

TODO: test escaping (e.g. does it happen to work correctly at all)

#!/usr/bin/perl
use strict;
use warnings;

if ($#ARGV != 0) {
   print "Recovers .vmx files from .log files. Usage:\n";
   print "$0 logfile > vmxfile\n\n";
   exit;
}

while (<>) {
   # Scan until we reach the config section
   if (/: vmx\| DICT --- CONFIGURATION/) { last; }
}

while (<>) {
   if (/: vmx\| DICT --- \S/) { last; } # Keep going until the next section
   s/^.*: vmx\| DICT\s*//;    # Strip off the leading timestamp and other stuff
   s/\r//;                    # Get rid of any \r's that may have somehow snuck in
   s/([^=]*=) (.*)/$1 "$2"/;  # Quote the value
   print;
}


Message was edited by: etung to fix errors
Attachments:

Re: Not a Valid Virtual Machine Configuration...

21. Aug 21, 2008 3:56 AM in response to: etung
Click to view WoodyZ's profile Guru 10,128 posts since
Apr 22, 2004
etung wrote: Finally got a few minutes. Disclaimer: not a perl expert, in fact, this is the first bit I've written.

TODO: test escaping (e.g. does it happen to work correctly at all)

#!/usr/bin/perl
use strict;
use warnings;
 
if ($#ARGV != 0) {
   print "Recovers .vmx files from .log files."
   print "Usage:\n$0 logfile > vmxfile\n";
   exit;
}
 
while () {
   if (/: vmx\| DICT --- CONFIGURATION/) { last; }
}
 
while () {
   if (/: vmx\| DICT --- USER DEFAULTS/) { last; }
   s/.*: vmx\| DICT[ ]*//;
   s/(^[^=]*=) (.*$)/$1 "$2"/;
   print;
}

As expected I had to chmod the vmxRecover.pl script after downloading to make it executable although if the script is set executable and archived before uploading it should be executable after unzipping and would be easier to use.

However the script still needs a little work as it has some errors and the output needed a little clean up.

Executing without arguments creates error...

syntax error at vmxRecover.pl line 7, near "print"

Executing with proper arguments still caused errors with...

syntax error at vmxRecover.pl line 7, near "print"

After commenting out the "if ($#ARGV != 0) {" block and executing with proper arguments it still caused errors with the output,the trailing quote on all parameter values was returned to the next line, however the output was easily cleaned up and certainly faster then manually processing the log file.

So for a first attempt at perl not to bad! :)

Thanks for doing it Eric.

Re: Not a Valid Virtual Machine Configuration...

22. Aug 21, 2008 8:57 AM in response to: etung
Click to view WoodyZ's profile Guru 10,128 posts since
Apr 22, 2004
Eric here is my suggested code if executed without any arguments and also eliminates the error around this code when used with valid arguments.

if ($#ARGV != 0) {
   print "\nRecovers .vmx files from .log files.\n";
   print "Usage: $0 logfile > vmxfile\n\n";
   exit;
 }


Still looking at the rest but I have to say that Quotes and Interpolation along with Search and Replace Functions are new to me as well as Pearl is not one of my Languages of choice. Although what you've written certainly encourages me to delve deeper into using Perl. :)

Message was edited by: WoodyZ

Re: Not a Valid Virtual Machine Configuration...

23. Aug 21, 2008 10:18 AM in response to: WoodyZ
Click to view etung's profile Guru 11,086 posts since
Oct 15, 2006
Yeah, that's what I get for testing it, adding a little more documentation, then not testing. Good tip on zipping, thanks.

This only scratches the surface of what Perl can do :)

Re: Not a Valid Virtual Machine Configuration...

24. Aug 21, 2008 10:44 AM in response to: etung
Click to view WoodyZ's profile Guru 10,128 posts since
Apr 22, 2004
Eric the following is an example of the output I'm getting is the the same for you?

config.version = "8
"
virtualHW.version = "4
"
scsi0.present = "TRUE
"
scsi0.virtualDev = "buslogic
"
memsize = "112
"
scsi0:0.present = "TRUE

Re: Not a Valid Virtual Machine Configuration...

25. Aug 21, 2008 11:35 AM in response to: WoodyZ
Click to view etung's profile Guru 11,086 posts since
Oct 15, 2006
No, I'm not getting the extra newlines. Maybe try
s/^([^=]*=) (.*)$/$1 "$2"/;

Re: Not a Valid Virtual Machine Configuration...

26. Aug 21, 2008 12:09 PM in response to: etung
Click to view WoodyZ's profile Guru 10,128 posts since
Apr 22, 2004
It not just the newlines its also the trailing enclosing quote is being placed on a new line and this variation on the code didn't make any differance. Maybe it's my system I'll try another one later. Thanks!

Also, (I know your intent is to redirect output to a file.) if this helps any to know, if I output to the Terminal vs redirecting into a file the output looks like...

"onfig.version = "8
"irtualHW.version = "4
"csi0.present = "TRUE
"csi0.virtualDev = "buslogic
"emsize = "112
"csi0:0.present = "TRUE

Re: Not a Valid Virtual Machine Configuration...

27. Aug 21, 2008 2:26 PM in response to: WoodyZ
Click to view etung's profile Guru 11,086 posts since
Oct 15, 2006
The newlines/trailing enclosing quote is the same issue. Your Terminal output makes it look like be extra \r's in your files (and I see the same output if I manually add them to a log file). Edited the post to add the following:
s/\r//;

Re: Not a Valid Virtual Machine Configuration...

28. Aug 21, 2008 3:19 PM in response to: etung
Click to view WoodyZ's profile Guru 10,128 posts since
Apr 22, 2004
etung wrote: The newlines/trailing enclosing quote is the same issue. Your Terminal output makes it look like be extra \r's in your files (and I see the same output if I manually add them to a log file)

I figured as much and just wanted to be know for sure what the output for me was.


Edited the post to add the following:
s/\r//;

I just tested the latest version of your script and it worked perfect on my system now. Thanks for taking the time to do this and although I've never needed it on my own system it's one less thing I'll have to do manually for someone who needs it and can't figure out how to do it or how to use the script.

Re: Not a Valid Virtual Machine Configuration...

29. Sep 10, 2008 9:32 AM in response to: etung
Click to view ilww's profile Lurker 1 posts since
Mar 12, 2008
Hi,
I also has the same problem to open up my Windows XP. The snapshot is attached below. Please help me to fix this problem. Thank you very much
Attachments:

VMware Developer

SDKs, APIs, Videos, Learn and much more in the Developer community.

Learn More

Developer Sample Code

Increase your developer productivity with VMware API sample code.

Learn More

VMworld Sessions & Labs

Online access to the latest VMworld Sessions & Labs and online services.

Learn more

Purchase PSO Credits Online

Purchase credits to redeem training and consulting services online.

Buy Now

Community Hardware Software

View reported configurations or report your own.

Learn More

VMware vSphere

Come witness the next giant leap in virtualization.

Register Today

Communities