Closed Rudd-O closed 6 years ago
Here is the full log. consoleText.txt
There is no verity_key file inside keys/marlin after the execution of generate_verity_key:
open("/lib64/libdl.so.2", O_RDONLY|O_CLOEXEC) = 3
open("keys/marlin/verity.x509.pem", O_RDONLY) = 3
open("keys/marlin/verity_key.pub", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 4
+++ exited with 0 +++
[user@buildslave-copperhead src]$ ls keys/marlin/
media.pk8 media.x509.pem platform.pk8 platform.x509.pem releasekey.pk8 releasekey.x509.pem shared.pk8 shared.x509.pem verity_key.pub verity.pk8 verity.x509.pem
Strace output shows that only verity_key.pub is created when generate_verity_key is run.
Build log that was successful a few months ago:
++++ system ++++
creating system.img...
Running: build_verity_tree -s 2147483648
16912384
Running: system/extras/verity/build_verity_metadata.py size 2147483648
32768
Running: fec -s 2164428800
17117184
Running: build_verity_tree -s 2130452480
16781312
Running: system/extras/verity/build_verity_metadata.py size 2130452480
32768
Running: fec -s 2147266560
16986112
Running: build_verity_tree -s 2121936896
16715776
Running: system/extras/verity/build_verity_metadata.py size 2121936896
32768
Running: fec -s 2138685440
16912384
Running: build_verity_tree -s 2117677056
16683008
Running: system/extras/verity/build_verity_metadata.py size 2117677056
32768
Running: fec -s 2134392832
16879616
Running: build_verity_tree -s 2115547136
16666624
Running: system/extras/verity/build_verity_metadata.py size 2115547136
32768
Running: fec -s 2132246528
16863232
Running: build_verity_tree -s 2114482176
16658432
Running: system/extras/verity/build_verity_metadata.py size 2114482176
32768
Running: fec -s 2131173376
16855040
Running: build_verity_tree -s 2113949696
16654336
Running: system/extras/verity/build_verity_metadata.py size 2113949696
32768
Running: fec -s 2130636800
16855040
Running: build_verity_tree -s 2113683456
16650240
Running: system/extras/verity/build_verity_metadata.py size 2113683456
32768
Running: fec -s 2130366464
16846848
Running: build_verity_tree -s 2113818624
16650240
Running: system/extras/verity/build_verity_metadata.py size 2113818624
32768
Running: fec -s 2130501632
16846848
Running: build_verity_tree -s 2113884160
16650240
Running: system/extras/verity/build_verity_metadata.py size 2113884160
32768
Running: fec -s 2130567168
16846848
Running: build_verity_tree -s 2113916928
16650240
Running: system/extras/verity/build_verity_metadata.py size 2113916928
32768
Running: fec -s 2130599936
16846848
Running: build_verity_tree -s 2113933312
16654336
Running: system/extras/verity/build_verity_metadata.py size 2113933312
32768
Running: fec -s 2130620416
16855040
Running: build_verity_tree -s 2113941504
16654336
Running: system/extras/verity/build_verity_metadata.py size 2113941504
32768
Running: fec -s 2130628608
16855040
Running: build_verity_tree -s 2113945600
16654336
Running: system/extras/verity/build_verity_metadata.py size 2113945600
32768
Running: fec -s 2130632704
16855040
Running: mkuserimg_mke2fs.sh -s /tmp/tmpgTZl2D /tmp/system-398kur.img ext4 / 2113941504 -T 1230768000 -C /tmp/root_fs_configSTK7_I.txt -B /tmp/system-iOql_c.map -L / /tmp/targetfiles-2aOYw1/META/file_contexts.bin
mke2fs -L / -E android_sparse -t ext4 -b 4096 /tmp/system-398kur.img 516099
mke2fs 1.43.3 (04-Sep-2016)
Creating filesystem with 516099 4k blocks and 129024 inodes
Filesystem UUID: 7d250937-2c8c-4b02-8b6f-f7ea7fc9781f
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912
Allocating group tables: 0/16 done
Writing inode tables: 0/16 done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: 0/16 done
e2fsdroid -T 1230768000 -C /tmp/root_fs_configSTK7_I.txt -B /tmp/system-iOql_c.map -S /tmp/targetfiles-2aOYw1/META/file_contexts.bin -f /tmp/tmpgTZl2D -a / /tmp/system-398kur.img
loaded 2790 fs_config entries
Running: build_verity_tree -A aee087a5be3b982978c923f566a94613496b417f2af592639bc80d141e34dfe7 /tmp/system-398kur.img /tmp/tmpPDfXCR_verity_images/verity.img
08fa6abdfcf2c5542eeea21e9bd12ba950a20f5d868863ac189d2dc1c3716058 aee087a5be3b982978c923f566a94613496b417f2af592639bc80d141e34dfe7
Running: system/extras/verity/build_verity_metadata.py build 2113941504 /tmp/tmpPDfXCR_verity_images/verity_metadata.img 08fa6abdfcf2c5542eeea21e9bd12ba950a20f5d868863ac189d2dc1c3716058 aee087a5be3b982978c923f566a94613496b417f2af592639bc80d141e34dfe7 /dev/block/platform/soc/624000.ufshc/by-name/system verity_signer keys/marlin/verity.pk8
['verity_signer', '/tmp/tmphBAbjq.table', 'keys/marlin/verity.pk8', '/tmp/tmpdjzuXJ.sig']
appending /tmp/tmpPDfXCR_verity_images/verity_metadata.img to /tmp/tmpPDfXCR_verity_images/verity.img
Running: fec -e -p 0 /tmp/system-398kur.img /tmp/tmpPDfXCR_verity_images/verity.img /tmp/tmpPDfXCR_verity_images/verity_fec.img
encoding RS(255, 253) to '/tmp/tmpPDfXCR_verity_images/verity_fec.img' for input files:
1: '/tmp/system-398kur.img'
2: '/tmp/tmpPDfXCR_verity_images/verity.img'
appending /tmp/tmpPDfXCR_verity_images/verity_fec.img to /tmp/tmpPDfXCR_verity_images/verity.img
Running: append2simg /tmp/system-398kur.img /tmp/tmpPDfXCR_verity_images/verity.img
Running: simg2img /tmp/system-398kur.img /tmp/unsparse_system-398kur.img
Running: e2fsck -f -n /tmp/unsparse_system-398kur.img
e2fsck 1.43.3 (04-Sep-2016)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/: 2799/129024 files (0.6% non-contiguous), 322094/516099 blocks
Same build snippet that failed this time around:
++++ system ++++
creating system.img...
Running: mkuserimg_mke2fs.sh -s /tmp/tmpLtf1kG /tmp/system-_9oD5K.img ext4 / 2147483648 -T 1230768000 -C /tmp/root_fs_config697Z7w.txt -B /tmp/system-yIGr9f.map -L / -U 324e47d2-eee6-5011-a137-965e22be1dc8 -S 904674ae-21eb-5022-bf95-2006c440aa1c /tmp/targetfiles-HGOZiM/META/file_contexts.bin
MKE2FS_CONFIG=./system/extras/ext4_utils/mke2fs.conf E2FSPROGS_FAKE_TIME=1230768000 mke2fs -L / -U 324e47d2-eee6-5011-a137-965e22be1dc8 -E android_sparse,hash_seed=904674ae-21eb-5022-bf95-2006c440aa1c -t ext4 -b 4096 /tmp/system-_9oD5K.img 524288
mke2fs 1.43.3 (04-Sep-2016)
Creating filesystem with 524288 4k blocks and 131072 inodes
Filesystem UUID: 324e47d2-eee6-5011-a137-965e22be1dc8
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912
Allocating group tables: 0/16 done
Writing inode tables: 0/16 done
Creating journal (16384 blocks): done
Writing superblocks and filesystem accounting information: 0/16 done
E2FSPROGS_FAKE_TIME=1230768000 e2fsdroid -T 1230768000 -C /tmp/root_fs_config697Z7w.txt -B /tmp/system-yIGr9f.map -S /tmp/targetfiles-HGOZiM/META/file_contexts.bin -f /tmp/tmpLtf1kG -a / /tmp/system-_9oD5K.img
failed to find [/verity_key] in canned fs_config
loaded 2901 fs_config entries
Traceback (most recent call last):
File "build/tools/releasetools/sign_target_files_apks", line 831, in <module>
common.Cleanup()
File "/tmp/android-build-root/src/build/make/tools/releasetools/common.py", line 938, in Cleanup
os.remove(i)
OSError: [Errno 2] No such file or directory: '/tmp/system-_9oD5K.img'
+ exit 1
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: script returned exit code 1
Finished: FAILURE
There appears to have been a failure of cleanup as well. But, here's the deal, apparently, the exception that would be hit in this code for that program:
if __name__ == '__main__':
try:
main(sys.argv[1:])
except common.ExternalError, e:
print
print " ERROR: %s" % (e,)
print
sys.exit(1)
finally:
common.Cleanup()
See that? The "
Strace execution of program shows verity_key to be in the damn root image:
META/otakeys.txt has no keys; using keys/marlin/releasekey.x509.pem for OTA package verification.
Using keys/marlin/releasekey.x509.pem for payload verification.
Replacing verity private key with keys/marlin/verity
Replacing verity public key with keys/marlin/verity_key.pub
++++ boot ++++
--
unlink("/tmp/tmpSQjdRI/dsp") = 0
lstat("/tmp/tmpSQjdRI/init.rc", {st_mode=S_IFREG|0644, st_size=29114, ...}) = 0
unlink("/tmp/tmpSQjdRI/init.rc") = 0
lstat("/tmp/tmpSQjdRI/verity_key", {st_mode=S_IFREG|0644, st_size=524, ...}) = 0
unlink("/tmp/tmpSQjdRI/verity_key") = 0
lstat("/tmp/tmpSQjdRI/config", {st_mode=S_IFDIR|0700, st_size=4096, ...}) = 0
lstat("/tmp/tmpSQjdRI/config", {st_mode=S_IFDIR|0700, st_size=4096, ...}) = 0
open("/tmp/tmpSQjdRI/config", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 4
--
unlink("/tmp/targetfiles-gFts_2/ROOT/dsp") = 0
lstat("/tmp/targetfiles-gFts_2/ROOT/init.rc", {st_mode=S_IFREG|0644, st_size=29114, ...}) = 0
unlink("/tmp/targetfiles-gFts_2/ROOT/init.rc") = 0
lstat("/tmp/targetfiles-gFts_2/ROOT/verity_key", {st_mode=S_IFREG|0644, st_size=524, ...}) = 0
unlink("/tmp/targetfiles-gFts_2/ROOT/verity_key") = 0
lstat("/tmp/targetfiles-gFts_2/ROOT/config", {st_mode=S_IFDIR|0700, st_size=4096, ...}) = 0
lstat("/tmp/targetfiles-gFts_2/ROOT/config", {st_mode=S_IFDIR|0700, st_size=4096, ...}) = 0
open("/tmp/targetfiles-gFts_2/ROOT/config", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 4
--
stat("/tmp/system-v3pk5k.img", 0x7ffdc9e38980) = -1 ENOENT (No such file or directory)
unlink("/tmp/system-v3pk5k.img") = -1 ENOENT (No such file or directory)
ts_2/META/file_contexts.bin -f /tmp/tmpSQjdRI -a / /tmp/system-v3pk5k.img
failed to find [/verity_key] in canned fs_config
loaded 2901 fs_config entries
Traceback (most recent call last):
File "build/tools/releasetools/sign_target_files_apks", line 831, in <module>
Userdebug / user builds work fine. This only fails on eng builds. Release.sh does not seem to work with eng builds. I'm pissed off that nothing mentions this in the Google Android documentation — basically you have to know someone who knows someone, or else you're shit out of luck. The fuck — this makes autotools look nice.
Well, script/ is entirely our stuff. Google doesn't really document how to do proper signing at all especially on the Pixel and Pixel 2.
do you find the culprit ?
You probably shouldn't be building this anymore as a whole anyway even with the security patches merged in since Android 9.0 is available.
Seems it cannot find the verity key? But I know it's there in the build at least.
I will attach the full log soon.