Extracting files from a corrupt wim file

2014-03-13
2014-03-24
  • I am trying to extract a WIM file I think is corrupted. I get the following error:

    $ imagex extract XPImage.wim 1
    [ERROR] An inconsistent hard link group that cannot be corrected has been detected
    [ERROR] The dentries are located at the following paths:
    ...
    ERROR: Exiting with error code 21:
    The metadata resource is invalid.

    Is there anything that can be done with this file? I was hoping for something like the -kb functionality in unrar.

     
  • Eric Biggers
    Eric Biggers
    2014-03-13

    I don't think the file is "corrupted" --- if so, there would have been a checksum mismatch. Instead it looks like the file contains nonsense metadata and was invalid ever since it was created. Where did you get this file from?

     
    • Someone made a backup before migrating the system from XP to Win7. Meanwhile I managed to mount the image with dism. Not sure why it works with dism and not with wimlib.

       
  • Eric Biggers
    Eric Biggers
    2014-03-14

    Hi,

    This may be related to a known bug in non-current versions of Microsoft's software that I'm already attempting to work around. But for your archive, the bug is such that the metadata is ambiguous and it is impossible for wimlib to know how to interpret the archive. The only circumstances under which I could "fix" this would be if I could examine a copy of your archive (or else reproduce an equivalent archive, which I haven't yet been able to do) and if I were able to empirically replicate the undocumented behavior of the Microsoft implementation. However, note that the Microsoft implementation has a good chance of NOT interpreting the archive as desired, since this is a bug on their end and the metadata is ambiguous.

    For now you'll just have to extract your archive with Microsoft's buggy software and hope that it doesn't corrupt your data.

    Eric

     
  • Eric Biggers
    Eric Biggers
    2014-03-14

    I've also made just one change that I think is reasonably safe to make when interpreting invalid metadata. You can try v1.6.2-BETA (downloads posted in the testing/ directory on the Files page) and see if it makes a difference. Even if it doesn't work, let me know what the error message says because I added an extra detail. Thanks!

     
  • I apologize for my slow response. I have two .wim files that have this issue.

    $ imagex --version
    wimlib-imagex (wimlib) 1.6.2-BETA

    $ imagex mount XPImage.wim 1 /tmp/mnt/
    [ERROR] Security ID mismatch: 110 != 221
    [ERROR] An inconsistent hard link group that cannot be corrected has been detected
    [ERROR] The dentries are located at the following paths:
    <snip>
    ERROR: Failed to mount image 1 from "XPImage.wim" on "/tmp/mnt/"
    ERROR: Exiting with error code 21:
    The metadata resource is invalid.

    and the other one gives:

    $ imagex mount XPImage.wim 1 /tmp/mnt/
    [ERROR] Security ID mismatch: 198 != 209
    [ERROR] An inconsistent hard link group that cannot be corrected has been detected
    [ERROR] The dentries are located at the following paths:
    <snip>
    ERROR: Failed to mount image 1 from "XPImage.wim" on "/tmp/mnt/"
    ERROR: Exiting with error code 21:
    The metadata resource is invalid.

    Hope this helps.

     
  • Eric Biggers
    Eric Biggers
    2014-03-21

    Hi,

    I posted a new v1.6.2-BETA with a change that arbitrarily chooses a possible interpretation of the image. If you like, you can try extracting or mounting the image and seeing what warning messages are printed and whether the data seems to be interpreted correctly or not. Note that the issue is in the mapping of names to files, so it may appear that some files are incorrectly associated with the data of some other file. Also, do you have any idea of what version of Microsoft's software was used to create the image? Thanks.

     
  • I tried mounting and I get a number of the following errors:

    [WARNING] Security ID mismatch: 198 != 209
    [WARNING] An inconsistent hard link group that cannot be corrected has been detected
    [WARNING] The dentries are located at the following paths:

    And the final message is:

    [WARNING] The WIM image contains invalid hard links. Fixing.

    But it does eventually mount. Thanks for that!

    Not sure if it helps, but the majority of the errors are generated by .lck files.

     
  • Eric Biggers
    Eric Biggers
    2014-03-24

    Hi,

    Unfortunately just because the image mounted doesn't mean that the data is provided in its original form, since as I've mentioned it is ambiguous. (For that matter I could make it mount and show the full text of Moby Dick for every file but it wouldn't be correct!)

    Is there any chance you can provide the metadata for the WIM file so I can take a look at it? Replace your libwim-9.dll file with the one attached to this post, then run 'wimlib-imagex extract WIMFILE IMAGE x' (where WIMFILE is the path to the WIM file and IMAGE is the image number). It will say that the file "x" can't be found and also produce a file "metadata.bin" in the current working directory. Compress the "metadata.bin" file and send it to my email address noted at the bottom of the README.txt file. I won't be able to see what your files contain, or even what they are called since I changed the code to only report a cryptographic checksum of each filename.

     
    Attachments