pixincreate / PixeneOS

GrapheneOS with additionals
https://pixincreate.github.io/PixeneOS/
MIT License
7 stars 2 forks source link

[REFACTOR] Throw an error if the download is not `ota_update` #10

Closed 0cwa closed 3 months ago

0cwa commented 3 months ago

Install type zip isn't supported, but it's not supported by avbroot anyways, right?

Full logs

``` GrapheneOS OTA target: `bramble-install-2024080600` GrapheneOS OTA URL: https://releases.grapheneos.org/bramble-install-2024080600.zip `avbroot.zip` file already exists in `.tmp/modules`. Constructing URL for `afsr` as `afsr` is non-existent at `.tmp`... URL for `afsr`: https://github.com/chenxiaolong/afsr/releases/download/v1.0.0/afsr-1.0.0-x86_64-unknown-linux-gnu.zip Downloading `afsr`... Extracting and granting permissions for `afsr`... replace .tmp/tools/afsr/afsr? [y]es, [n]o, [A]ll, [N]one, [r]ename: Cleaning up... `afsr` downloaded. Verifying `afsr`... Tool afsr is a directory in `.tmp`. Verified. `alterinstaller.zip` file already exists in `.tmp/modules`. `custota.zip` file already exists in `.tmp/modules`. Constructing URL for `custota-tool` as `custota-tool` is non-existent at `.tmp`... URL for `custota-tool`: https://github.com/chenxiaolong/Custota/releases/download/v4.8/custota-tool-4.8-x86_64-unknown-linux-gnu.zip Downloading `custota-tool`... Extracting and granting permissions for `custota-tool`... replace .tmp/tools/custota-tool/custota-tool? [y]es, [n]o, [A]ll, [N]one, [r]ename: Cleaning up... `custota-tool` downloaded. Verifying `custota-tool`... Tool custota-tool is a directory in `.tmp`. Verified. `msd.zip` file already exists in `.tmp/modules`. `bcr.zip` file already exists in `.tmp/modules`. `oemunlockonboot.zip` file already exists in `.tmp/modules`. Constructing URL for `my-avbroot-setup` as `my-avbroot-setup` is non-existent at `.tmp`... URL for `my-avbroot-setup`: https://github.com/chenxiaolong/my-avbroot-setup Downloading `my-avbroot-setup`... fatal: destination path '.tmp/tools/my-avbroot-setup' already exists and is not an empty directory. `my-avbroot-setup` downloaded. Verifying `my-avbroot-setup`... Tool my-avbroot-setup is a directory in `.tmp`. Verified. Downloading `magisk`... ^C ➜ PixeneOS git:(main) ✗ rm -rf .tmp ➜ PixeneOS git:(main) ✗ src/main.sh GrapheneOS OTA target: `bramble-install-2024080600` GrapheneOS OTA URL: https://releases.grapheneos.org/bramble-install-2024080600.zip Constructing URL for `avbroot` as `avbroot` is non-existent at `.tmp`... URL for `avbroot`: https://github.com/chenxiaolong/avbroot/releases/download/v3.6.0/avbroot-3.6.0-x86_64-unknown-linux-gnu.zip Downloading `avbroot`... Extracting and granting permissions for `avbroot`... Cleaning up... `avbroot` downloaded. Verifying `avbroot`... Tool avbroot is a directory in `.tmp`. Verified. Constructing URL for `afsr` as `afsr` is non-existent at `.tmp`... URL for `afsr`: https://github.com/chenxiaolong/afsr/releases/download/v1.0.0/afsr-1.0.0-x86_64-unknown-linux-gnu.zip Downloading `afsr`... Extracting and granting permissions for `afsr`... Cleaning up... `afsr` downloaded. Verifying `afsr`... Tool afsr is a directory in `.tmp`. Verified. Constructing URL for `alterinstaller` as `alterinstaller` is non-existent at `.tmp`... URL for `alterinstaller`: https://github.com/chenxiaolong/alterinstaller/releases/download/v2.0/alterinstaller-2.0-release.zip Downloading `alterinstaller`... `alterinstaller` downloaded. Verifying `alterinstaller`... Tool `alterinstaller.zip` found and verified. Constructing URL for `custota` as `custota` is non-existent at `.tmp`... URL for `custota`: https://github.com/chenxiaolong/custota/releases/download/v4.8/custota-4.8-release.zip Downloading `custota`... `custota` downloaded. Verifying `custota`... Tool `custota.zip` found and verified. Constructing URL for `custota-tool` as `custota-tool` is non-existent at `.tmp`... URL for `custota-tool`: https://github.com/chenxiaolong/Custota/releases/download/v4.8/custota-tool-4.8-x86_64-unknown-linux-gnu.zip Downloading `custota-tool`... Extracting and granting permissions for `custota-tool`... Cleaning up... `custota-tool` downloaded. Verifying `custota-tool`... Tool custota-tool is a directory in `.tmp`. Verified. Constructing URL for `msd` as `msd` is non-existent at `.tmp`... URL for `msd`: https://github.com/chenxiaolong/msd/releases/download/v1.2/msd-1.2-release.zip Downloading `msd`... `msd` downloaded. Verifying `msd`... Tool `msd.zip` found and verified. Constructing URL for `bcr` as `bcr` is non-existent at `.tmp`... URL for `bcr`: https://github.com/chenxiaolong/bcr/releases/download/v1.69/bcr-1.69-release.zip Downloading `bcr`... `bcr` downloaded. Verifying `bcr`... Tool `bcr.zip` found and verified. Constructing URL for `oemunlockonboot` as `oemunlockonboot` is non-existent at `.tmp`... URL for `oemunlockonboot`: https://github.com/chenxiaolong/oemunlockonboot/releases/download/v1.1/oemunlockonboot-1.1-release.zip Downloading `oemunlockonboot`... `oemunlockonboot` downloaded. Verifying `oemunlockonboot`... Tool `oemunlockonboot.zip` found and verified. Constructing URL for `my-avbroot-setup` as `my-avbroot-setup` is non-existent at `.tmp`... URL for `my-avbroot-setup`: https://github.com/chenxiaolong/my-avbroot-setup Downloading `my-avbroot-setup`... Cloning into '.tmp/tools/my-avbroot-setup'... remote: Enumerating objects: 24, done. remote: Counting objects: 100% (24/24), done. remote: Compressing objects: 100% (17/17), done. remote: Total 24 (delta 16), reused 15 (delta 7), pack-reused 0 (from 0) Receiving objects: 100% (24/24), 25.07 KiB | 658.00 KiB/s, done. Resolving deltas: 100% (16/16), done. `my-avbroot-setup` downloaded. Verifying `my-avbroot-setup`... Tool my-avbroot-setup is a directory in `.tmp`. Verified. Downloading `magisk`... curl: option : blank argument where content is expected curl: try 'curl --help' for more information `magisk` downloaded. Verifying `magisk.apk`... Tool `magisk.apk` found and verified. GrapheneOS OTA target: `bramble-install-2024080600` GrapheneOS OTA URL: https://releases.grapheneos.org/bramble-install-2024080600.zip Downloading OTA from: https://releases.grapheneos.org/bramble-install-2024080600.zip... Please be patient while the download happens. OTA downloaded to: `.tmp/bramble-install-2024080600.zip` Magisk is enabled. Modifying the setup script... The script is not run from the `my-avbroot-setup` directory. Searching for the directory... Virtual environment not found in path ./.tmp/tools/my-avbroot-setup. Creating... [notice] A new release of pip is available: 23.3.2 -> 24.2 [notice] To update, run: pip install --upgrade pip Python module `tomlkit` is required to run this script. Installing... Collecting tomlkit Using cached tomlkit-0.13.2-py3-none-any.whl.metadata (2.7 kB) Using cached tomlkit-0.13.2-py3-none-any.whl (37 kB) Installing collected packages: tomlkit Successfully installed tomlkit-0.13.2 [notice] A new release of pip is available: 23.3.2 -> 24.2 [notice] To update, run: pip install --upgrade pip Decoding keys from base64... Error decoding base64 for AVB_BASE64 Error decoding base64 for CERT_OTA_BASE64 Error decoding base64 for OTA_BASE64 Decoded keys from base64. Extracting official keys... 0.000s ERROR Failed to open zip entry: payload.bin Caused by: specified file not found in archive 0.000s ERROR Failed to open AVB image for reading: ".tmp/extracted/extracts/vbmeta.img" Caused by: No such file or directory (os error 2) Archive: .tmp/bramble-install-2024080600.zip inflating: .tmp/extracted/ota/bramble-install-2024080600/bootloader-bramble-b5-0.6-10489838.img inflating: .tmp/extracted/ota/bramble-install-2024080600/radio-bramble-g7250-00264-230619-b-10346159.img inflating: .tmp/extracted/ota/bramble-install-2024080600/avb_pkmd.bin inflating: .tmp/extracted/ota/bramble-install-2024080600/android-info.txt inflating: .tmp/extracted/ota/bramble-install-2024080600/android-info.zip inflating: .tmp/extracted/ota/bramble-install-2024080600/boot.img inflating: .tmp/extracted/ota/bramble-install-2024080600/dtbo.img inflating: .tmp/extracted/ota/bramble-install-2024080600/vendor_boot.img inflating: .tmp/extracted/ota/bramble-install-2024080600/vbmeta.img inflating: .tmp/extracted/ota/bramble-install-2024080600/super_1.img inflating: .tmp/extracted/ota/bramble-install-2024080600/super_2.img inflating: .tmp/extracted/ota/bramble-install-2024080600/super_3.img inflating: .tmp/extracted/ota/bramble-install-2024080600/super_4.img inflating: .tmp/extracted/ota/bramble-install-2024080600/super_5.img inflating: .tmp/extracted/ota/bramble-install-2024080600/super_6.img inflating: .tmp/extracted/ota/bramble-install-2024080600/super_7.img inflating: .tmp/extracted/ota/bramble-install-2024080600/super_8.img inflating: .tmp/extracted/ota/bramble-install-2024080600/super_9.img inflating: .tmp/extracted/ota/bramble-install-2024080600/super_10.img inflating: .tmp/extracted/ota/bramble-install-2024080600/super_11.img inflating: .tmp/extracted/ota/bramble-install-2024080600/super_12.img inflating: .tmp/extracted/ota/bramble-install-2024080600/super_13.img inflating: .tmp/extracted/ota/bramble-install-2024080600/script.txt inflating: .tmp/extracted/ota/bramble-install-2024080600/flash-all.sh inflating: .tmp/extracted/ota/bramble-install-2024080600/flash-all.bat Patching OTA... [*] Verifying OTA: .tmp/bramble-install-2024080600.zip 0.000s INFO Verifying whole-file signature 0.000s ERROR Cannot find OTA signature footer magic Traceback (most recent call last): File "/home/user/PixeneOS/.tmp/tools/my-avbroot-setup/patch.py", line 1009, in main() File "/home/user/PixeneOS/.tmp/tools/my-avbroot-setup/patch.py", line 1000, in main run(args, Path(temp_dir)) File "/home/user/PixeneOS/.tmp/tools/my-avbroot-setup/patch.py", line 882, in run verify_ota(args.input, args.verify_public_key_avb, args.verify_cert_ota) File "/home/user/PixeneOS/.tmp/tools/my-avbroot-setup/patch.py", line 40, in verify_ota subprocess.check_call([ File "/usr/lib64/python3.12/subprocess.py", line 413, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['avbroot', 'ota', 'verify', '--input', PosixPath('.tmp/bramble-install-2024080600.zip'), '--public-key-avb', PosixPath('.tmp/extracted/avb_pkmd.bin'), '--cert-ota', PosixPath('.tmp/extracted/ota/META-INF/com/android/otacert')]' returned non-zero exit status 1. Cleanup is disabled. Exiting... ```

pixincreate commented 3 months ago
Error decoding base64 for AVB_BASE64
Error decoding base64 for CERT_OTA_BASE64
Error decoding base64 for OTA_BASE64

this i believe is expected as you're running this locally and passphrases are being interactively. will add a check for that.

are you able to find vbmeta.img in .tmp/extracted/extracts/?

you're downloading the wrong file btw. avbroot supports only ota and not factory images. ota_target is expected to be bramble-ota_update-2024080600 and not bramble-install-2024080600.

An example:

GrapheneOS OTA target: `bluejay-ota_update-2024082000`
GrapheneOS OTA URL: https://releases.grapheneos.org/bluejay-ota_update-2024082000.zip
0cwa commented 3 months ago

I just tried with factory image out of curiosity, since it was in declarations.sh and I was having issues getting root

0cwa commented 3 months ago

The only reason it wouldn't be ota_update is because it was changed in declarations.sh. I think the solution is just to remove any reference to setting it to install in the variable assignment in declarations.sh

pixincreate commented 3 months ago

Will be picking this up pretty soon and remove any references for factory images (which even I had initially thought would work). avbroot only support ota_update.