VMware Communities
veganjustice
Contributor
Contributor
Jump to solution

Not a Valid Virtual Machine Configuration...

Okay, I thas been probably about 3 days since I started VMWare Fusion up and ran Windows. I go to run it this morning, after shutting it down properly the last time I used it, and when I pick my Vista VM and hit run, I get a warning up saying...

"/Users/my name/Documents/Virtual Machines.localized/Windows Vista.vmwarevm/Windows Vista.vmx" is not a valid virtual machine configuration file

and I have the option of hitting OK, and then nothing happens.

This happened to me on a past install of XP on Parallels, and other problems, that is why I came to VMWare, and everything has been great, my XP install and my bootcamp install, but this Vista install isn't valid anymore. Is there a way to fix this? Or do I have to reinstall?

Thanks

Jordan

Reply
0 Kudos
119 Replies
admin
Immortal
Immortal
Jump to solution

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

Message was edited by: etung to correct formatting from a site upgrade.

Reply
0 Kudos
WoodyZ
Immortal
Immortal
Jump to solution

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! Smiley Happy

Thanks for doing it Eric.

Reply
0 Kudos
WoodyZ
Immortal
Immortal
Jump to solution

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. Smiley Happy

Message was edited by: WoodyZ

Reply
0 Kudos
admin
Immortal
Immortal
Jump to solution

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 Smiley Happy

Reply
0 Kudos
WoodyZ
Immortal
Immortal
Jump to solution

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

Reply
0 Kudos
admin
Immortal
Immortal
Jump to solution

No, I'm not getting the extra newlines. Maybe try

s/^([^=]*=) (.*)$/$1 "$2"/;

Reply
0 Kudos
WoodyZ
Immortal
Immortal
Jump to solution

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

Reply
0 Kudos
admin
Immortal
Immortal
Jump to solution

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//;

Reply
0 Kudos
WoodyZ
Immortal
Immortal
Jump to solution

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.

Reply
0 Kudos
ilww
Contributor
Contributor
Jump to solution

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

Reply
0 Kudos
admin
Immortal
Immortal
Jump to solution

We need the actual log files to recover the .vmx, not a picture of them.

Reply
0 Kudos
davvv
Contributor
Contributor
Jump to solution

We could use a bit of your magic, WoodyZ. My friend Chuck called in a panic. He's trying to close his books -- runs Fusion and XP on a MacBook. He's also getting the "...not a valid virtual machine configuration file" msg, referring to a .vmx file. That file is zero in size.

I looked at the logs and other files in the pkg, and backed them up, but I am not talented enough to follow your instructions with a hex editor as mentioned in a similar thread. Can you help?

Or! Could I go to a backup of his Virtual Machines (I think) folder and use a pre-corrupted .vmx file?

cheers,

david

Reply
0 Kudos
WoodyZ
Immortal
Immortal
Jump to solution

We could use a bit of your magic, WoodyZ. My friend Chuck called in a panic. He's trying to close his books -- runs Fusion and XP on a MacBook. He's also getting the "...not a valid virtual machine configuration file" msg, referring to a .vmx file. That file is zero in size.

I looked at the logs and other files in the pkg, and backed them up, but I am not talented enough to follow your instructions with a hex editor as mentioned in a similar thread. Can you help?

If his .vmx configuration file is zero length you do not need to use a hex editor to fix the problem. You can use the program Eric (etung) wrote further down the thread to extract the .vmc configuration out of the vmware.log file or just zip up the vmware.log files from the Virtual Machines Package and attach here and I do it for you.

Reply
0 Kudos
davvv
Contributor
Contributor
Jump to solution

WoodyZ:

Log files et all attached.

cheers,

David

Reply
0 Kudos
WoodyZ
Immortal
Immortal
Jump to solution

Log files et all attached.

The attached "Windows XP Home Edition.vmx" file was created from the vmware.log file from within the schaapVMware.zip file.

Reply
0 Kudos
davvv
Contributor
Contributor
Jump to solution

Bingo. Thanks, Mr Z.

Idle thought: This happened on a laptop. I wonder if the other incidences were laptops. Apple laptops have a history of tiny weirdnesses involving Sleep.

Also, did I really write "et all"? I feel stupid, dumb, et al.

cheers,

David

Reply
0 Kudos
Webalistic
Contributor
Contributor
Jump to solution

Hi WoodyZ, can you help me out as well?

My .vmx is completely missing.. Smiley Sad, maybe disconnecting the power of the comlete 19" rack wasn't a very good idea...

Attached are the last 2 logfiles, can't see where the .vmx ends, hope you can help me out.

vmware.log is the last file (I see the log catches the missing .vmx)

vmware-4.log is the one from a day before.

Reply
0 Kudos
WoodyZ
Immortal
Immortal
Jump to solution

Attached are the last 2 logfiles

There are no log files attached.

Reply
0 Kudos
Webalistic
Contributor
Contributor
Jump to solution

Sorry, blocked i guess, here's a zip.

Reply
0 Kudos
Webalistic
Contributor
Contributor
Jump to solution

The strange thing is I also miss the .vmsd and .vmxf file :S, they're gone....

attached my trial to extract from logfile, but is is not recognized in ESXi (at least I cannot choose 'Add to Inventory')

Reply
0 Kudos