Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Processing boot partitionUnsupported type = 9 #10

Open
turb1te opened this issue Aug 30, 2020 · 17 comments
Open

Processing boot partitionUnsupported type = 9 #10

turb1te opened this issue Aug 30, 2020 · 17 comments

Comments

@turb1te
Copy link

turb1te commented Aug 30, 2020

Hi, @vm03! :)

Is there a solution to this problem? Only boot.img didn't succeed. I have Nokia 4.2

Thanks!

Log:

(.py) PS D:\Downloads\1> python payload_dumper.py --diff payload.bin
Processing aboot partition......Done
Processing dtbo partition......Done
Processing vbmeta partition.Done
Processing mdtp partition.................................................................................................................Done
Processing modem partition.....................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................Done
Processing sbl1 partition.............Done
Processing rpm partition...........Done
Processing tz partition..............Done
Processing devcfg partition...Done
Processing dsp partition.........................Done
Processing cmnlib partition...Done
Processing cmnlib64 partition...Done
Processing keymaster partition.......Done
Processing boot partitionUnsupported type = 9

@turb1te
Copy link
Author

turb1te commented Aug 30, 2020

Log from https://github.com/vm03/update_payload_extractor:

D:\Downloads\2>python extract.py payload.bin --partitions boot --output_dir output --old_dir old
Extracting boot
Traceback (most recent call last):
File "extract.py", line 67, in
extract(args.payload, args.output_dir, args.old_dir, args.partitions)
File "extract.py", line 43, in extract
part.new_partition_info, old_file, part.old_partition_info)
File "D:\Downloads\2\update_payload\applier.py", line 597, in _ApplyToPartition
raise PayloadError("Unknown minor version: %d" % self.minor_version)
update_payload.error.PayloadError: Unknown minor version: 6

turb1te referenced this issue in vm03/update_payload_extractor Aug 30, 2020
 Put images to "old" dir for apply delta OTA
@icjuego
Copy link

icjuego commented Oct 4, 2020

I ran into this too and did a little looking. Type 9 is PUFFDIFF, defined here:
https://chromium.googlesource.com/aosp/platform/system/update_engine/+/HEAD/update_metadata.proto

Puffdiffs are produced by a tool called puffin, which comes with an operation called "puffpatch" we could use to apply them:
https://android.googlesource.com/platform/external/puffin/+/master

There's no python library for puffin so we're probably best just building that.

Here's how we'd invoke it (search for puffpatch_cmd):
https://chromium.googlesource.com/aosp/platform/system/update_engine/+/HEAD/scripts/update_payload/applier.py

I might get around to implementing this eventually but it's not super important to me. But the information is all here if someone else wants to!

@bluehomewu
Copy link

Try to unpack Android 11 Stock ROM....And I face same question.

u0_a184@build-rom:~/ZS630KL/payload_dumper$ python3 payload_dumper.py --diff payload.bin
Processing abl partition....Done
Processing aop partition...Done
Processing asusfw partition........Done
Processing bluetooth partition..........................Done
Processing boot partition..........................................Unsupported type = 9

@i5lee8bit
Copy link

Same here, trying to pull boot.img and system.img from the HTC U12+ (US Unlocked) incremental OTA 2.51.617.4 (now very rare for HTC to release any updates) that just dropped. I put the previous version's (2.51.617.1) images in the \old\ directory, but it errors out immediately on system.img. Sadly I really only need the boot.img, but can't test if that would work either. Doesn't seem you can use the --partitions argument when using the --diff flag.

C:\Users\HTPC\AppData\Local\Programs\Python\Python37>python payload_dumper.py --diff payload.bin
Processing system partition..........................................................................................................................................................................................................................................................................Unsupported type = 9

C:\Users\HTPC\AppData\Local\Programs\Python\Python37>

@vm03
Copy link
Owner

vm03 commented Nov 8, 2020

I ran into this too and did a little looking. Type 9 is PUFFDIFF, defined here:
https://chromium.googlesource.com/aosp/platform/system/update_engine/+/HEAD/update_metadata.proto

Puffdiffs are produced by a tool called puffin, which comes with an operation called "puffpatch" we could use to apply them:
https://android.googlesource.com/platform/external/puffin/+/master

There's no python library for puffin so we're probably best just building that.

I can't do PUFFDIFF library for python. If anyone do it, it can help for continued development of this project.

Here's how we'd invoke it (search for puffpatch_cmd):
https://chromium.googlesource.com/aosp/platform/system/update_engine/+/HEAD/scripts/update_payload/applier.py

With binary puffin preferred use https://github.com/vm03/update_payload_extractor . I currently use it, but it works only on Linux. But this extractor python only and can run on another platforms, otherwise update_payload_extractor better now.

@dmascord
Copy link

Hi,

I am trying to use update_payload_extractor with the PUFFDIFF type, but for some reason the resultant system hash turns out incorrect:

Full OTA - https://android.googleapis.com/packages/ota-api/package/527908825994628c8999525e8175425019018ab2.zip
Incremental OTA - https://android.googleapis.com/packages/ota-api/package/7743e8aa32596369cc8017acb164ceb71ed10389.zip

The extraction for the Full OTA works fine:

tusker@n550jv:~/dev/update_payload_extractor
$ LD_LIBRARY_PATH=./lib64/ ./extract.py --output_dir output/ payload.bin
Extracting xbl
Extracting rpm
Extracting tz
Extracting hyp
Extracting pmic
Extracting modem
Extracting abl
Extracting boot
Extracting cmnlib
Extracting cmnlib64
Extracting system
Extracting bluetooth
Extracting vendor
Extracting devcfg
Extracting keymaster
Extracting dtbo
Extracting vbmeta

But, the incremental fails:
$ LD_LIBRARY_PATH=./lib64/ ./extract.py --output_dir output/ --old_dir old/ ~/Downloads/payload.bin
Extracting xbl
Extracting rpm
Extracting tz
Extracting hyp
Extracting pmic
Extracting modem
Extracting abl
Extracting boot
Extracting cmnlib
Extracting cmnlib64
Extracting system
Traceback (most recent call last):
File "./extract.py", line 67, in
extract(args.payload, args.output_dir, args.old_dir, args.partitions)
File "./extract.py", line 43, in extract
part.new_partition_info, old_file, part.old_partition_info)
File "/home/tusker/dev/update_payload_extractor/update_payload/applier.py", line 569, in _ApplyToPartition
'new ' + part_name, length=new_part_info.size)
File "/home/tusker/dev/update_payload_extractor/update_payload/applier.py", line 92, in _VerifySha256
common.FormatSha256(expected_hash)))
update_payload.error.PayloadError: new system hash (mTCplc+XLXJgjyts4fB/qL35mkdfxz9/NF36C+smuMo=) not as expected (oGywQfHR3oEsOUyXvybw84aE1EMLxjdl6OusvPm+HKU=)

Any idea on this one ?

@xstefen
Copy link

xstefen commented Jan 12, 2021

Hi,

I am trying to use update_payload_extractor with the PUFFDIFF type, but for some reason the resultant system hash turns out incorrect:

Full OTA - https://android.googleapis.com/packages/ota-api/package/527908825994628c8999525e8175425019018ab2.zip
Incremental OTA - https://android.googleapis.com/packages/ota-api/package/7743e8aa32596369cc8017acb164ceb71ed10389.zip

The extraction for the Full OTA works fine:

tusker@n550jv:~/dev/update_payload_extractor
$ LD_LIBRARY_PATH=./lib64/ ./extract.py --output_dir output/ payload.bin
Extracting xbl
Extracting rpm
Extracting tz
Extracting hyp
Extracting pmic
Extracting modem
Extracting abl
Extracting boot
Extracting cmnlib
Extracting cmnlib64
Extracting system
Extracting bluetooth
Extracting vendor
Extracting devcfg
Extracting keymaster
Extracting dtbo
Extracting vbmeta

But, the incremental fails:
$ LD_LIBRARY_PATH=./lib64/ ./extract.py --output_dir output/ --old_dir old/ ~/Downloads/payload.bin
Extracting xbl
Extracting rpm
Extracting tz
Extracting hyp
Extracting pmic
Extracting modem
Extracting abl
Extracting boot
Extracting cmnlib
Extracting cmnlib64
Extracting system
Traceback (most recent call last):
File "./extract.py", line 67, in
extract(args.payload, args.output_dir, args.old_dir, args.partitions)
File "./extract.py", line 43, in extract
part.new_partition_info, old_file, part.old_partition_info)
File "/home/tusker/dev/update_payload_extractor/update_payload/applier.py", line 569, in _ApplyToPartition
'new ' + part_name, length=new_part_info.size)
File "/home/tusker/dev/update_payload_extractor/update_payload/applier.py", line 92, in _VerifySha256
common.FormatSha256(expected_hash)))
update_payload.error.PayloadError: new system hash (mTCplc+XLXJgjyts4fB/qL35mkdfxz9/NF36C+smuMo=) not as expected (oGywQfHR3oEsOUyXvybw84aE1EMLxjdl6OusvPm+HKU=)

Any idea on this one ?

Just got same extracting the OOS 11.0.5.6->11.0.6.8 incremental

@xstefen .../android/kebab/update_payload_extractor (master) $ LD_LIBRARY_PATH=./lib64/ ./extract.py --output_dir output/ --old_dir old/ payload.bin 
Extracting abl
Extracting boot
Extracting dtbo
Extracting logo
Extracting odm
Traceback (most recent call last):
  File "/mnt/files/android/kebab/update_payload_extractor/./extract.py", line 67, in <module>
    extract(args.payload, args.output_dir, args.old_dir, args.partitions)
  File "/mnt/files/android/kebab/update_payload_extractor/./extract.py", line 40, in extract
    helper._ApplyToPartition(
  File "/mnt/files/android/kebab/update_payload_extractor/update_payload/applier.py", line 568, in _ApplyToPartition
    _VerifySha256(new_part_file, new_part_info.hash,
  File "/mnt/files/android/kebab/update_payload_extractor/update_payload/applier.py", line 90, in _VerifySha256
    raise PayloadError('%s hash (%s) not as expected (%s)' %
update_payload.error.PayloadError: new odm hash (vWrzKQstilwtxXz/xklsvibJKXBDSkM4WCc2paRu9rU=) not as expected (CMEOgE98THG0vY3YpIT2bm/QtCmsNdfjt334k9i+rDY=)

@turb1te
Copy link
Author

turb1te commented Jan 12, 2021

update_payload.error.PayloadError: new system hash (mTCplc+XLXJgjyts4fB/qL35mkdfxz9/NF36C+smuMo=) not as expected (oGywQfHR3oEsOUyXvybw84aE1EMLxjdl6OusvPm+HKU=)

What if we remove the hash check? Isn't it normal for the hash of the new file to be different when we add files to the full OTA file?
@vm03, what do you think?

@vm03
Copy link
Owner

vm03 commented Jan 22, 2021

update_payload.error.PayloadError: new system hash (mTCplc+XLXJgjyts4fB/qL35mkdfxz9/NF36C+smuMo=) not as expected (oGywQfHR3oEsOUyXvybw84aE1EMLxjdl6OusvPm+HKU=)

What if we remove the hash check? Isn't it normal for the hash of the new file to be different when we add files to the full OTA file?
@vm03, what do you think?

I think, we can try add option for skip check. Need create issue in update_payload repo :)

@L8Kak
Copy link

L8Kak commented Nov 4, 2021

After having a need and poking around. I found this fork https://github.com/CaptainThrowback/update_payload_extractor of https://github.com/vm03/update_payload_extractor which adds an option --skip_hash to skip the hash on differential ota.

I don't know how to (or can't) create an issue on vm03/update_payload_extractor so I'm making a comment here in case anyone else arrives here with the same problem.

In my case skipping the hash didn't solve my problem but if it works for others I suspect my problem lies in my payload files; going from 10 -> 11 with an incremental patch. At least 1 person solved their problem (OP8T, I assume 11 -> 11) by skipping the hash. I received this error instead:

Extracting boot
[1104/143609.557461:ERROR:huffman_table.cc(243)] br->CacheBits(14) failed.
[1104/143609.557626:ERROR:puffer.cc(125)] dyn_ht_->BuildDynamicHuffmanTable( br, &pd.block_metadata[1], &pd.length) failed.
[1104/143609.557645:ERROR:puffin_stream.cc(290)] puffer_->PuffDeflate(&bit_reader, &puff_writer, nullptr) failed.
ERROR 11-04 14:36:09 external/bsdiff/bspatch.cc:308: Error reading from input file.: Success
[1104/143609.558615:ERROR:puffpatch.cc(174)] 0 == bspatch(reader, writer, &patch[bsdiff_patch_offset], bsdiff_patch_size) failed.
[1104/143609.559528:ERROR:main.cc(380)] puffin::PuffPatch( std::move(src_stream), std::move(dst_stream), puffdiff_delta.data(), puffdiff_delta.size(), FLAGS_cache_size) failed.
Traceback (most recent call last):
File "./extract.py", line 82, in
extract(args.payload, args.output_dir, args.old_dir, args.partitions, args.skip_hash)
File "./extract.py", line 49, in extract
part.old_partition_info, skip_hash)
File "/home/chrx/Downloads/update_payload_extractor-master-CaptainThrowback/update_payload/applier.py", line 557, in _ApplyToPartition
new_part_file, new_part_info.size)
File "/home/chrx/Downloads/update_payload_extractor-master-CaptainThrowback/update_payload/applier.py", line 513, in _ApplyOperations
new_part_file)
File "/home/chrx/Downloads/update_payload_extractor-master-CaptainThrowback/update_payload/applier.py", line 423, in _ApplyDiffOperation
subprocess.check_call(puffpatch_cmd, close_fds=False)
File "/usr/lib/python3.6/subprocess.py", line 311, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['./puffin', '--operation=puffpatch', '--src_file=old/boot', '--dst_file=output/boot', '--patch_file=/tmp/tmppyj4ger3', '--src_extents=4096:19333120', '--dst_extents=4096:17219584']' returned non-zero exit status 1.

@xstefen
Copy link

xstefen commented Nov 6, 2021

The hash checks are the problem in doing incrementals with OP8T at least, i havent messed with it for a while bu this guy claims his works

https://github.com/mrslezak/update_payload_extractor, its a fork of vm03's other repo

@Gaojianli
Copy link

1104/143609.5574

same got this error, have you solved it?

@ultra-taco
Copy link

Same error. Any workaround? I am definitely using protobuf version 3.19.0

> python payload_dumper.py --diff payload.bin
Processing system partition.........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................Done
Processing system_ext partition......................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................Done
Processing product partition.......Unsupported type = 9

@joecool1029
Copy link

The hash checks are the problem in doing incrementals with OP8T at least, i havent messed with it for a while bu this guy claims his works

https://github.com/mrslezak/update_payload_extractor, its a fork of vm03's other repo

Ugly, but works for OP9 Pro on latest releases. Thanks for mentioning.

@griffinli
Copy link

Same error as @L8Kak and @Gaojianli. I'm getting the following:

Extracting abl
Extracting aop
Extracting bluetooth
Extracting boot
[0401/180521.413970:ERROR:puffer.cc(149)] br->CacheBits(max_bits) failed.
[0401/180521.414017:ERROR:puffin_stream.cc(290)] puffer_->PuffDeflate(&bit_reader, &puff_writer, nullptr) failed.
ERROR 04-01 18:05:21 external/bsdiff/bspatch.cc:308: Error reading from input file.: Success
[0401/180521.414134:ERROR:puffpatch.cc(174)] 0 == bspatch(reader, writer, &patch[bsdiff_patch_offset], bsdiff_patch_size) failed.
[0401/180521.414347:ERROR:main.cc(380)] puffin::PuffPatch( std::move(src_stream), std::move(dst_stream), puffdiff_delta.data(), puffdiff_delta.size(), FLAGS_cache_size) failed.
Traceback (most recent call last):
  File "/home/griffin/update_payload_extractor/./extract.py", line 67, in <module>
    extract(args.payload, args.output_dir, args.old_dir, args.partitions)
  File "/home/griffin/update_payload_extractor/./extract.py", line 40, in extract
    helper._ApplyToPartition(
  File "/home/griffin/update_payload_extractor/update_payload/applier.py", line 554, in _ApplyToPartition
    self._ApplyOperations(operations, base_name, old_part_file,
  File "/home/griffin/update_payload_extractor/update_payload/applier.py", line 513, in _ApplyOperations
    self._ApplyDiffOperation(op, op_name, data, old_part_file,
  File "/home/griffin/update_payload_extractor/update_payload/applier.py", line 424, in _ApplyDiffOperation
    subprocess.check_call(puffpatch_cmd, close_fds=False)
  File "/home/griffin/data/miniconda3/lib/python3.10/subprocess.py", line 369, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['./puffin', '--operation=puffpatch', '--src_file=old/boot', '--dst_file=output/boot', '--patch_file=/tmp/tmp1a27k9kt', '--src_extents=43065344:8982528', '--dst_extents=43511808:8536064']' returned non-zero exit status 1.

Any idea how to fix this?

@Talaxy009
Copy link

The hash checks are the problem in doing incrementals with OP8T at least, i havent messed with it for a while bu this guy claims his works

https://github.com/mrslezak/update_payload_extractor, its a fork of vm03's other repo

Works for moto S30Pro (ota from android 13 to 14). Thanks!

@OdinVex
Copy link

OdinVex commented Sep 28, 2024

I have a delta (incremental) OTA that has a puffin in it. Any way to --diff with this?

Edit: Using mrslezak's fork, seems to work for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests