1 2 3 4 Previous Next 119 Replies Latest reply on Nov 15, 2012 5:06 AM by WoodyZ Go to original post Branched to a new discussion.
      • 15. Re: Not a Valid Virtual Machine Configuration...
        Sonicar Novice

         

        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

         

         

        • 16. Re: Not a Valid Virtual Machine Configuration...
          Guru

          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).

          • 17. Re: Not a Valid Virtual Machine Configuration...
            dude1974 Novice

            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

            • 18. Re: Not a Valid Virtual Machine Configuration...
              Guru

              Looks like a script would be helpful. Oh well, I always wanted an excuse to try perl...

              • 19. Re: Not a Valid Virtual Machine Configuration...
                dude1974 Novice

                Thanks a lot it is working now.

                • 20. Re: Not a Valid Virtual Machine Configuration...
                  Guru

                  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.

                  • 21. Re: Not a Valid Virtual Machine Configuration...
                    WoodyZ Guru
                    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.

                    • 22. Re: Not a Valid Virtual Machine Configuration...
                      WoodyZ Guru

                      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

                      • 23. Re: Not a Valid Virtual Machine Configuration...
                        Guru

                        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

                        • 24. Re: Not a Valid Virtual Machine Configuration...
                          WoodyZ Guru

                          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

                          • 25. Re: Not a Valid Virtual Machine Configuration...
                            Guru

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

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

                             

                            • 26. Re: Not a Valid Virtual Machine Configuration...
                              WoodyZ Guru

                              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

                              • 27. Re: Not a Valid Virtual Machine Configuration...
                                Guru

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

                                 

                                • 28. Re: Not a Valid Virtual Machine Configuration...
                                  WoodyZ Guru
                                  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.

                                  • 29. Re: Not a Valid Virtual Machine Configuration...
                                    ilww Lurker

                                    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

                                    1 2 3 4 Previous Next