Error: Can not open file as archive

Help
Maelvon
2011-11-04
2013-09-24
1 2 > >> (Page 1 of 2)
  • Maelvon

    Maelvon - 2011-11-04

    On a Mac with Fink, I've :

    7-Zip 4.44 beta  Copyright (c) 1999-2007 Igor Pavlov  2007-01-20
    p7zip Version 4.44 (locale=C,Utf16=off,HugeFiles=on,8 CPUs)
    

    I've done a multipart archive with:

     /sw/bin/7z -v4290m -mx9 a ./TheBackup.7z /FolderToBackup
    

    That give me some TheBackup.7z.001, TheBackup.7z.002…TheBackup.7z.031

    And when I try to deflate:

    /sw/bin/7z e TheBackup.7z.001
    

    It create a file "TheBackup.7z", that return:

    /sw/bin/7z e TheBackup.7z
    7-Zip 4.44 beta  Copyright (c) 1999-2007 Igor Pavlov  2007-01-20
    p7zip Version 4.44 (locale=C,Utf16=off,HugeFiles=on,8 CPUs)
    Processing archive: TheBackup.7z
    Error: Can not open file as archive
    

    What I'm doing wrong? This is a bug?

    Maelvon

     
  • Igor Pavlov

    Igor Pavlov - 2011-11-04

    1) try to get new version of p7zip
    2) copy all volumes to one folder.
    3) check that you have all volumes, and all volumes (except of last volume) have same size.

     
  • Maelvon

    Maelvon - 2011-11-04

    1) Tested on an other machine with "7-Zip 9.04 beta" & "7-Zip (A) 9.20"
    2) Copied in a specific folder.
    3) Each volume seems to have the correct size, except the last one, as expected:

    # ls -la TheBackup*
    136741167256 Aug  8 13:16 TheBackup.7z
    4498391040 Aug  8 13:16 TheBackup.7z.001
    4498391040 Aug  7 04:00 TheBackup.7z.002
    4498391040 Aug  7 04:00 TheBackup.7z.003
    4498391040 Aug  7 04:00 TheBackup.7z.004
    4498391040 Aug  7 04:00 TheBackup.7z.005
    4498391040 Aug  7 04:00 TheBackup.7z.006
    4498391040 Aug  7 04:00 TheBackup.7z.007
    4498391040 Aug  7 04:00 TheBackup.7z.008
    4498391040 Aug  7 04:00 TheBackup.7z.009
    4498391040 Aug  7 04:00 TheBackup.7z.010
    4498391040 Aug  7 04:00 TheBackup.7z.011
    4498391040 Aug  7 04:00 TheBackup.7z.012
    4498391040 Aug  7 04:00 TheBackup.7z.013
    4498391040 Aug  7 04:00 TheBackup.7z.014
    4498391040 Aug  7 04:00 TheBackup.7z.015
    4498391040 Aug  7 04:00 TheBackup.7z.016
    4498391040 Aug  7 04:00 TheBackup.7z.017
    4498391040 Aug  7 04:00 TheBackup.7z.018
    4498391040 Aug  7 04:00 TheBackup.7z.019
    4498391040 Aug  7 04:00 TheBackup.7z.020
    4498391040 Aug  7 04:00 TheBackup.7z.021
    4498391040 Aug  7 04:00 TheBackup.7z.022
    4498391040 Aug  7 04:00 TheBackup.7z.023
    4498391040 Aug  7 04:00 TheBackup.7z.024
    4498391040 Aug  7 04:00 TheBackup.7z.025
    4498391040 Aug  7 04:00 TheBackup.7z.026
    4498391040 Aug  7 04:00 TheBackup.7z.027
    4498391040 Aug  7 04:00 TheBackup.7z.028
    4498391040 Aug  8 13:16 TheBackup.7z.029
    4498391040 Aug  8 13:16 TheBackup.7z.030
    1789436056 Aug  8 13:16 TheBackup.7z.031
    

    Then:

    # 7za e TheBackup.7z.001
    7-Zip (A) 9.20  Copyright (c) 1999-2010 Igor Pavlov  2010-11-18
    p7zip Version 9.20 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,4 CPUs)
    Processing archive: TheBackup.7z.001
    Extracting  TheBackup.7z
    Everything is Ok
    Size:       136741167256
    Compressed: 4498391040
    
    # 7z e TheBackup.7z
    7-Zip 9.04 beta  Copyright (c) 1999-2009 Igor Pavlov  2009-05-30
    p7zip Version 9.04 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,4 CPUs)
    Can't load './7z.dll' (./7z.so: cannot open shared object file: No such file or directory)
    Error:
    7-Zip cannot find the code that works with archives.
    
    # 7za e TheBackup.7z
    7-Zip (A) 9.20  Copyright (c) 1999-2010 Igor Pavlov  2010-11-18
    p7zip Version 9.20 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,4 CPUs)
    Processing archive: TheBackup.7z
    Error: Can not open file as archive
    

    Same error! Did you see anything strange here? How can I deflate this .7z file?

    Maelvon

     
  • Igor Pavlov

    Igor Pavlov - 2011-11-04

    1) Show first 48 bytes of TheBackup.7z.001 in hex.
    2) Show last 128 bytes of TheBackup.7z.031 in hex.

     
  • Maelvon

    Maelvon - 2011-11-05

    Done, but I don't known if I've used the correct "dd" command.

    # dd if=theBackup.7z.001 of=1.txt bs=1 count=48
    48+0 records in
    48+0 records out
    
    # hexdump 1.txt
    0000000 7a37 afbc 1c27 0200 57a2 6493 5ca4 d63e
    0000010 001f 0000 002a 0000 0000 0000 eb1e ac0f
    0000020 1e00 cb0f 1187 ced8 9166 830f ca1e 7bfd
    0000030
    
    # dd if=theBackup.7z.031 of=31.txt bs=1 count=128
    128+0 records in
    128+0 records out
    
    hexdump 31.txt
    0000000 0164 94d6 e2e8 ee13 ebae cc5d 0def 696b
    0000010 d25c 074d c818 31cd fea3 225d 61d5 9a51
    0000020 302f 607f 3647 fb95 6ca7 f87b 29df 2257
    0000030 2586 ac90 46d0 b063 a789 da5c f1a6 921c
    0000040 622e df1d 9d24 6f73 c640 732b 5719 bf3b
    0000050 ccd4 3f51 8efb e670 3683 34ae 6353 dcb9
    0000060 d496 d8cd 6bcb 5da2 55eb bbf9 582c ffc8
    0000070 ca67 32bb 38ed 78d7 618c 4668 28f4 338e
    0000080
    
     
  • Igor Pavlov

    Igor Pavlov - 2011-11-05

    It looks like your .7z file is about 2 MB longer than size referenced in header (I don't know why).
    Try to find "footer" at the end of archive (probably in theBackup.7z.031).
    Try to find "lzma" signature in hex:
    03 01 01 05 5D 00

     
  • Igor Pavlov

    Igor Pavlov - 2011-11-05

    Also you can try to reproduce error with smaller files (or smaller volumes).
    It will be simpler to work with them.
    Maybe It was bug of old version of p7zip. Maybe it was bug with 64-bit file offsets or something else.

     
  • Maelvon

    Maelvon - 2011-11-07

    Thanks for the help ipavlov!

    At the end of in theBackup.7z.031, I've found the 03 01 01 05 5D 00

    6AA8A080    01 23 03 01 01 05 5D 00 00 10 00 0C E1 5D F5 1F
    6AA8A080    0A 01 ED AB 92 B4 00 00
    
     
  • Igor Pavlov

    Igor Pavlov - 2011-11-07

    so in your previous posts you didn't show last bytes of last volume.
    So again:
    1) show last 128 bytes of theBackup.7z.031
    2) last 128 bytes of theBackup.7z
    They must be the same.
    Show with offset (in hex) like that "6AA8A080  ….. )".

     
  • Maelvon

    Maelvon - 2011-11-07

    But I don't understand if "03 01 01 05 5D 00" is "lzma" or "footer"? And the next step is?

    As I've deleted the backuped files, I hope I can retrieve the data :.)

     
  • Maelvon

    Maelvon - 2011-11-07

    1) The end of Backup.7z.031

    6AA8A010  BD 03 A0 F4 68 EF 23 F7 72 FE F3 BB 2E 35 BE 08
    6AA8A020  7D 67 77 F5 D6 82 4C A6 08 91 C1 A4 B0 D8 A7 A7
    6AA8A030  96 AA 01 88 50 69 FC 39 6D AD C7 4F 85 D1 CA CC
    6AA8A040  38 6A 39 2D 11 FC 4C BF D6 EC B0 F0 ED 1A 17 39
    6AA8A050  FD 28 A7 E4 2E 7E 5A 4C B8 B0 F0 B5 CE 66 65 03
    6AA8A060  F3 DD 10 A3 77 90 70 25 A7 BA 69 00 00 00 17 06
    6AA8A070  F8 07 A2 35 D6 1F 01 09 C8 9D BA 00 07 0B 01 00
    6AA8A080  01 23 03 01 01 05 5D 00 00 10 00 0C E1 5D F5 1F
    6AA8A090  0A 01 ED AB 92 B4 00 00
    

    2) The end of Backup.7z

    1FD668A010  BD 03 A0 F4 68 EF 23 F7 72 FE F3 BB 2E 35 BE 08
    1FD668A020  7D 67 77 F5 D6 82 4C A6 08 91 C1 A4 B0 D8 A7 A7
    1FD668A030  96 AA 01 88 50 69 FC 39 6D AD C7 4F 85 D1 CA CC
    1FD668A040  38 6A 39 2D 11 FC 4C BF D6 EC B0 F0 ED 1A 17 39
    1FD668A050  FD 28 A7 E4 2E 7E 5A 4C B8 B0 F0 B5 CE 66 65 03
    1FD668A060  F3 DD 10 A3 77 90 70 25 A7 BA 69 00 00 00 17 06
    1FD668A070  F8 07 A2 35 D6 1F 01 09 C8 9D BA 00 07 0B 01 00
    1FD668A080  01 23 03 01 01 05 5D 00 00 10 00 0C E1 5D F5 1F
    1FD668A090  0A 01 ED AB 92 B4 00 00
    

    They seems identical!

     
  • Maelvon

    Maelvon - 2011-11-07

    And the first lines of Backup.7z.00 are :

    000000000  37 7A BC AF 27 1C 00 02 A2 57 93 64 A4 5C 3E D6
    000000010  1F 00 00 00 2A 00 00 00 00 00 00 00 1E EB 0F AC
    000000020  00 1E 0F CB 87 11 D8 CE 66 91 0F 83 1E CA FD 7B
    000000030  33 D4 7F E9 B7 DA 28 31 76 25 66 20 4D 2A 09 6D
    

    It seems the dd+hexdump does not return the same as the Hxd Editor I'm using now, sorry.

     
  • Maelvon

    Maelvon - 2011-11-07

    /Backup.7z.00/Backup.7z.001/

     
  • Igor Pavlov

    Igor Pavlov - 2011-11-07

    1FD668A06E - start of footer in curruptred
    1fd63e5ca4 - offset of footer in header.
    1FD63E5CC4 - real offset (1fd63e5ca4 + 0x20) of footer in correct archive

    1FD668A06E - 1FD63E5CC4 = 2A43AA (2769834 in decimal)

    So you must remove 2769834 bytes from theBackup.7z.031.
    Copy theBackup.7z.031 volume for recovery purposes.
    Split theBackup.7z.031 into two parts:
    first 2769834 bytes - first.bin
    other bytes -  to tail.bin

    rename tail.bin to theBackup.7z.031.
    And try to open theBackup.7z.001 again.
    If you see theBackup.7z - something is wrong (check my calculations).
    If you see files - header and footer are correct now.

     
  • Maelvon

    Maelvon - 2011-11-07

    Done:

    dd bs=2769834 skip=1 if=theBackup.7z.031 of=tail.bin
    645+1 records in
    645+1 records out
    

    Wahhou! And the files are extracting, I see them!

    Thanks a lot ipavlov!

    I need to understand you're process to find the 2769834 bytes to remove from the last part. As I have other backups done with this probably buggy version of 7z (7-Zip 4.44 beta). You tell me, what an idea to do backup with an so old version. But I've discovered that when I wrote here.

     
  • Igor Pavlov

    Igor Pavlov - 2011-11-07

    1) note that probably you will heve error at some file.
    If error at the end of archive, maybe you must remove 2769834 bytes from the end of .031 (but you must keep some MBytes at the end before footer, where .7z contains headers with filenames).
    2) If it's possible try to reproduce error case but with smaller files.
    We must check that new version doesn't produce bad files. And I want to know exact reason about these bad archives.
    So you can use old and new version with different file sizes and similar modes (multivolume). If you can't open archive, reduce file size and so on.
    Maybe it's OK to use fast mode (-mx1).

     
  • highjack

    highjack - 2012-09-12

    The problem does not depend on splitted volumes.
    I have compressed a single file with the command "7za a archive.7z -v50m afile" and without splitting "7za a archive.7z afile". Both are equal (if joined with cat).

     
  • highjack

    highjack - 2012-09-12

    I my case the error occure, while compressing file on an ssh gvfs mount.
    I am using 7-Zip (A) 9.04 beta  Copyright (C) 1999-2009 Igor Pavlov  2009-05-30

     
  • Igor Pavlov

    Igor Pavlov - 2012-09-13

    highjack:
    Please describe your error with more details.

     
  • highjack

    highjack - 2012-09-13

    It's the same error as described before.

    > Error: Can not open file as archive

    I my case it's caused by saving the files directly to a gvfs mount point. Compressing to a local file system does not cause this error. My testcase is just one 1MiB file.

    Here the complete corrupted file compressed on a gvfs mount point.

    00000000  37 7a bc af 27 1c 00 03  3a 9d 86 75 da 00 00 00  |7z..'…:..u….|
    00000010  00 00 00 00 55 00 00 00  00 00 00 00 f2 08 94 00  |….U………..|
    00000020  f9 ee e4 1e 82 d3 2f c5  3a 3c 01 4b b1 7e c9 8a  |……/.:<.K.~..|
    00000030  8a 4d 2f a3 0d d9 7f a6  e3 8c 23 11 53 e0 59 18  |.M/…….#.S.Y.|
    00000040  c5 75 8a e2 77 f8 b6 94  7f 0c 6a c0 de 74 49 64  |.u..w…..j..tId|
    00000050  e2 e9 5c 53 b2 04 d8 f7  44 0c ab 5f 0d 6d 46 e9  |..\S….D.._.mF.|
    00000060  e5 c3 76 88 b7 96 57 ac  b6 4d e1 69 1d 6f fb 4b  |..v…W..M.i.o.K|
    00000070  88 10 6c 42 cb 88 3f 5c  00 8f d0 4e af 26 28 94  |..lB..?\…N.&(.|
    00000080  71 1f 3d 8f 24 e1 70 9e  a7 23 5f ec 28 cb 85 d1  |q.=.$.p..#_.(…|
    00000090  95 98 8a 7e 2a 91 f2 27  75 f7 19 c0 06 98 4d 98  |…~*..'u…..M.|
    000000a0  fd d8 af d5 90 0f c4 25  53 f8 f5 91 36 31 05 a5  |…….%S…61..|
    000000b0  b0 ee 6f c1 70 4d 47 0c  d1 91 11 aa ad 60 1d ba  |..o.pMG……`..|
    000000c0  ce b1 27 18 5c 59 86 e9  66 52 58 be e9 76 ac 59  |..'.\Y..fRX..v.Y|
    000000d0  e4 e5 5b 05 08 f9 c7 da  ad fc fb 52 2a f7 e4 95  |..[……..R*…|
    000000e0  25 00 01 04 06 00 01 09  80 da 00 07 0b 01 00 01  |%……………|
    000000f0  23 03 01 01 05 5d 00 00  10 00 0c d0 00 00 00 08  |#….]……….|
    00000100  0a 01 1c ea 38 a7 00 00  05 01 11 15 00 74 00 65  |….8……..t.e|
    00000110  00 73 00 74 00 2d 00 66  00 69 00 6c 00 65 00 00  |.s.t.-.f.i.l.e..|
    00000120  00 14 0a 01 00 00 33 79  88 83 91 cd 01 15 06 01  |……3y……..|
    00000130  00 20 80 80 81 00 00                              |. …..|

    And the correct file compressed on a local filesystem.

    00000000  37 7a bc af 27 1c 00 03  3a 9d 86 75 da 00 00 00  |7z..'…:..u….|
    00000010  00 00 00 00 55 00 00 00  00 00 00 00 f2 08 94 00  |….U………..|
    00000020  00 00 6f fd ff ff a3 b7  ff 47 3e 48 15 72 39 61  |..o……G>H.r9a|
    00000030  51 b8 92 28 e6 a3 86 07  f9 ee e4 1e 82 d3 2f c5  |Q..(………./.|
    00000040  3a 3c 01 4b b1 7e c9 8a  8a 4d 2f a3 0d d9 7f a6  |:<.K.~…M/…..|
    00000050  e3 8c 23 11 53 e0 59 18  c5 75 8a e2 77 f8 b6 94  |..#.S.Y..u..w…|
    00000060  7f 0c 6a c0 de 74 49 64  e2 e9 5c 53 b2 04 d8 f7  |..j..tId..\S….|
    00000070  44 0c ab 5f 0d 6d 46 e9  e5 c3 76 88 b7 96 57 ac  |D.._.mF…v…W.|
    00000080  b6 4d e1 69 1d 6f fb 4b  88 10 6c 42 cb 88 3f 5c  |.M.i.o.K..lB..?\|
    00000090  00 8f d0 4e af 26 28 94  71 1f 3d 8f 24 e1 70 9e  |…N.&(.q.=.$.p.|
    000000a0  a7 23 5f ec 28 cb 85 d1  95 98 8a 7e 2a 91 f2 27  |.#_.(……~*..'|
    000000b0  75 f7 19 c0 06 98 4d 98  fd d8 af d5 90 0f c4 25  |u…..M……..%|
    000000c0  53 f8 f5 91 36 31 05 a5  b0 ee 6f c1 70 4d 47 0c  |S…61….o.pMG.|
    000000d0  d1 91 11 aa ad 60 1d ba  ce b1 27 18 5c 59 86 e9  |…..`….'.\Y..|
    000000e0  66 52 58 be e9 76 ac 59  e4 e5 5b 05 08 f9 c7 da  |fRX..v.Y..[…..|
    000000f0  ad fc fb 52 2a f7 e4 95  25 00 01 04 06 00 01 09  |…R*…%…….|
    00000100  80 da 00 07 0b 01 00 01  23 03 01 01 05 5d 00 00  |……..#….]..|
    00000110  10 00 0c d0 00 00 00 08  0a 01 1c ea 38 a7 00 00  |…………8…|
    00000120  05 01 11 15 00 74 00 65  00 73 00 74 00 2d 00 66  |…..t.e.s.t.-.f|
    00000130  00 69 00 6c 00 65 00 00  00 14 0a 01 00 00 33 79  |.i.l.e……..3y|
    00000140  88 83 91 cd 01 15 06 01  00 20 80 80 81 00 00     |……… …..|

     
  • Igor Pavlov

    Igor Pavlov - 2012-09-13

    highjack:
    Yes, now I see some problem.

    7-Zip creates 7z archives so:
    1) writes 8 bytes (signature)
    2) moves file pointer to position 32.
    3) writes compressed data
    4) moves file pointer to position 8
    5) writes strart header (24 bytes).

    And you have problem with step 2 (it moves file pointer to position 32, when file size is just 8 bytes only).

    In Windows for SetFilePointer function (MSDN):
    It is not an error to set a file pointer to a position beyond the end of the file.

    Or IStream::Seek method:
    It is not, however, an error to seek past the end of the stream. Seeking past the end of the stream is useful for subsequent write operations, as the stream byte range will be extended to the new seek position immediately before the write is complete.

    Or for lseek function in posix:
    The lseek() function allows the file offset to be set beyond the end of the file (but this does not change the size of the file). If data is later written at this point, subsequent reads of the data in the gap (a "hole") return null bytes (aq\0aq) until data is actually written into the gap.

    Maybe there is some problem with that feature for gvfs driver.

    In any case I'll fix my 7-Zip's code
    I'll write 24 zero bytes, instead of Change_File_Pointer operation.

    Maybe I must fix it in other places too.

    Thanks!!!

     
  • highjack

    highjack - 2012-09-13

    Thanks for the detailed answer. It's a "nice" pitfall and it's good to know. I have checked it with cifs mounts and gvfs samba mounts. I get different files as on my local file systems, but they are not corrupt. The corruption only happens on gvfs ssh mounts. I will file a bug report in the gvfs project.

     
  • Constantin Zankl

    I have a similar problem here with a Backup in 7z Format. Unfortunaly I encrypted the whole archive using '-p -mhe=on'.

    And now am not able to extract the Data. I get this when I try to extract:

    7z x 1.7z
    7-Zip 9.04 beta  Copyright (C) 1999-2009 Igor Pavlov  2009-05-30
    p7zip Version 9.04 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,4 CPUs)

    Processing archive: 1.7z

    Error: Can not open file as archive

    Here are the first 48 byte of this single file:

    hexdump head
    0000000 7a37 afbc 1c27 0300 83e2 87d3 1a60 1b29
    0000010 0000 0000 003d 0000 0000 0000 99de e297
    0000020 fc18 3ffe 696b 18f6 0b74 7214 b618 3648
    0000030

    The End of the file looks like this:

    1b4ca6f0 8b0e 2de8 8aa3 c714 37eb d945 950a d4ca
    1b4ca700 e459 9a1b b8bc df51 6a6c 1a3a a251 1d3c
    1b4ca710 5497 9b8b fda3 82a7 09fa b8cd 7770 1868
    1b4ca720 7f3b 344b 1852 4554 b302 d64f 7fc8 aa9d
    1b4ca730 1454 c39f 78c5 cf59 100b 68c7 3b09 bfd9
    1b4ca740 8311 65e1 287e 5d24 0ea0 f015 1483 859a
    1b4ca750 cffa 3b92 3184 2b4e 50f1 34c9 ba01 ac3b
    1b4ca760 80eb e8a6 f27b 423c bcc1 1fa9 01bd 7ca1
    1b4ca770 59e3 32f8 00c1                        
    1b4ca775

    Because of the fact that the Error occures before the password promt my first guess was, that there must be some Problem in the Header / Length information. But im not sure about this and to be honest I have no Idea how to fix it. Does someone here does see what the problem is maybe ipavlov?

    Thanks for

     
  • Constantin Zankl

    Sorry for bad Formating here a bit better to read:

    Here are the first 48 byte of this single file:

    hexdump head 
    0000000 7a37 afbc 1c27 0300 83e2 87d3 1a60 1b29
    0000010 0000 0000 003d 0000 0000 0000 99de e297
    0000020 fc18 3ffe 696b 18f6 0b74 7214 b618 3648
    0000030
    

    The End of the file looks like this:

    1b4ca6f0 8b0e 2de8 8aa3 c714 37eb d945 950a d4ca
    1b4ca700 e459 9a1b b8bc df51 6a6c 1a3a a251 1d3c
    1b4ca710 5497 9b8b fda3 82a7 09fa b8cd 7770 1868
    1b4ca720 7f3b 344b 1852 4554 b302 d64f 7fc8 aa9d
    1b4ca730 1454 c39f 78c5 cf59 100b 68c7 3b09 bfd9
    1b4ca740 8311 65e1 287e 5d24 0ea0 f015 1483 859a
    1b4ca750 cffa 3b92 3184 2b4e 50f1 34c9 ba01 ac3b
    1b4ca760 80eb e8a6 f27b 423c bcc1 1fa9 01bd 7ca1
    1b4ca770 59e3 32f8 00c1                         
    1b4ca775
    
     
  • Igor Pavlov

    Igor Pavlov - 2012-10-13

    1) use byte (8-bit) representation instead of 16-bit representation.
    2) length of archive is incorrect.
    3) try to find 7zAES signnature in your file:
    06 F1 07 01
    It must be at the end of archive.
    You can create some new 7z archive with some password and search that signature to check that you search correctly.

    You  can use FAR Manager to search in hex.

     
1 2 > >> (Page 1 of 2)

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks