WeAreFairphone / android_device_fairphone_FP3

Android / LineageOS 16 device tree for Fairphone 3
46 stars 7 forks source link

Error while filling the product image #11

Closed dk1978 closed 4 years ago

dk1978 commented 4 years ago

Hi, after doing a completely clean build things failed while trying to fill the product.img:

[ 88% 280/315] Target product fs image: /opt/lineageOS/out/target/product/FP3/product.img
FAILED: /opt/lineageOS/out/target/product/FP3/product.img 
/bin/bash -c "(mkdir -p /opt/lineageOS/out/target/product/FP3/product ) && (mkdir -p /opt/lineageOS/out/target/product/FP3/obj/PACKAGING/product_intermediates && rm -rf /opt/lineageOS/out/target/product/FP3/obj/PACKAGING/product_intermediates/product_image_info.txt ) && (echo \"ext_mkuserimg=mkuserimg_mke2fs.sh\" >>  /opt/lineageOS/out/target/product/FP3/obj/PACKAGING/product_intermediates/product_image_info.txt ) && (echo \"fs_type=ext4\" >>  /opt/lineageOS/out/target/product/FP3/obj/PACKAGING/product_intermediates/product_image_info.txt ) && (echo \"product_fs_type=ext4\" >>  /opt/lineageOS/out/target/product/FP3/obj/PACKAGING/product_intermediates/product_image_info.txt ) && (echo \"product_size=134217728\" >>  /opt/lineageOS/out/target/product/FP3/obj/PACKAGING/product_intermediates/product_image_info.txt ) && (echo \"extfs_sparse_flag=-s\" >>  /opt/lineageOS/out/target/product/FP3/obj/PACKAGING/product_intermediates/product_image_info.txt ) && (echo \"squashfs_sparse_flag=-s\" >>  /opt/lineageOS/out/target/product/FP3/obj/PACKAGING/product_intermediates/product_image_info.txt ) && (echo \"selinux_fc=/opt/lineageOS/out/target/product/FP3/obj/ETC/file_contexts.bin_intermediates/file_contexts.bin\" >>  /opt/lineageOS/out/target/product/FP3/obj/PACKAGING/product_intermediates/product_image_info.txt ) && (echo \"verity_disable=true\" >>  /opt/lineageOS/out/target/product/FP3/obj/PACKAGING/product_intermediates/product_image_info.txt ) && (echo \"avb_avbtool=avbtool\" >>  /opt/lineageOS/out/target/product/FP3/obj/PACKAGING/product_intermediates/product_image_info.txt ) && (echo \"avb_system_hashtree_enable=true\" >>  /opt/lineageOS/out/target/product/FP3/obj/PACKAGING/product_intermediates/product_image_info.txt ) && (echo \"avb_system_add_hashtree_footer_args=--prop com.android.build.system.security_patch:2020-05-05 --rollback_index 0 --setup_as_rootfs_from_kernel\" >>  /opt/lineageOS/out/target/product/FP3/obj/PACKAGING/product_intermediates/product_image_info.txt ) && (echo \"avb_system_key_path=external/avb/test/data/testkey_rsa2048.pem\" >>  /opt/lineageOS/out/target/product/FP3/obj/PACKAGING/product_intermediates/product_image_info.txt ) && (echo \"avb_system_algorithm=SHA256_RSA2048\" >>  /opt/lineageOS/out/target/product/FP3/obj/PACKAGING/product_intermediates/product_image_info.txt ) && (echo \"avb_system_rollback_index_location=2\" >>  /opt/lineageOS/out/target/product/FP3/obj/PACKAGING/product_intermediates/product_image_info.txt ) && (echo \"avb_vendor_hashtree_enable=true\" >>  /opt/lineageOS/out/target/product/FP3/obj/PACKAGING/product_intermediates/product_image_info.txt ) && (echo \"avb_vendor_add_hashtree_footer_args=--prop com.android.build.vendor.security_patch:\"2018-08-05\"\" >>  /opt/lineageOS/out/target/product/FP3/obj/PACKAGING/product_intermediates/product_image_info.txt ) && (echo \"avb_product_hashtree_enable=true\" >>  /opt/lineageOS/out/target/product/FP3/obj/PACKAGING/product_intermediates/product_image_info.txt ) && (echo \"avb_product_add_hashtree_footer_args=--prop com.android.build.product.security_patch:2020-05-05\" >>  /opt/lineageOS/out/target/product/FP3/obj/PACKAGING/product_intermediates/product_image_info.txt ) && (echo \"recovery_as_boot=true\" >>  /opt/lineageOS/out/target/product/FP3/obj/PACKAGING/product_intermediates/product_image_info.txt ) && (echo \"system_root_image=true\" >>  /opt/lineageOS/out/target/product/FP3/obj/PACKAGING/product_intermediates/product_image_info.txt ) && (echo \"root_dir=/opt/lineageOS/out/target/product/FP3/root\" >>  /opt/lineageOS/out/target/product/FP3/obj/PACKAGING/product_intermediates/product_image_info.txt ) && (echo \"skip_fsck=true\" >>  /opt/lineageOS/out/target/product/FP3/obj/PACKAGING/product_intermediates/product_image_info.txt ) && (PATH=/opt/lineageOS/out/host/linux-x86/bin/:\$PATH ./build/tools/releasetools/build_image.py /opt/lineageOS/out/target/product/FP3/product /opt/lineageOS/out/target/product/FP3/obj/PACKAGING/product_intermediates/product_image_info.txt /opt/lineageOS/out/target/product/FP3/product.img /opt/lineageOS/out/target/product/FP3/system /opt/lineageOS/out/target/product/FP3/obj/PACKAGING/product_intermediates/generated_product_image_info.txt ) && (size=\$(for i in /opt/lineageOS/out/target/product/FP3/product.img; do stat --format \"%s\" \"\$i\" | tr -d '\\n'; echo +; done; echo 0); total=\$(( \$( echo \"\$size\" ) )); printname=\$(echo -n \"/opt/lineageOS/out/target/product/FP3/product.img\" | tr \" \" +); maxsize=\$(( \$(grep 'product_size='  /opt/lineageOS/out/target/product/FP3/obj/PACKAGING/product_intermediates/generated_product_image_info.txt | cut -f2- -d'='))); if [ \"\$total\" -gt \"\$maxsize\" ]; then echo \"error: \$printname too large (\$total > \$maxsize)\"; false; elif [ \"\$total\" -gt \$((maxsize - 32768)) ]; then echo \"WARNING: \$printname approaching size limit (\$total now; limit \$maxsize)\"; fi )"
error: failed to build /opt/lineageOS/out/target/product/FP3/product.img from /opt/lineageOS/out/target/product/FP3/product
Error: '['mkuserimg_mke2fs.sh', '-s', '/opt/lineageOS/out/target/product/FP3/product', '/opt/lineageOS/out/target/product/FP3/product.img', 'ext4', 'product', '132018176', '-j', '0', '-D', '/opt/lineageOS/out/target/product/FP3/system', '-L', 'product', '-M', '0', '/opt/lineageOS/out/target/product/FP3/obj/ETC/file_contexts.bin_intermediates/file_contexts.bin']' failed with exit code 4:
MKE2FS_CONFIG=./system/extras/ext4_utils/mke2fs.conf mke2fs -O ^has_journal -L product -m 0 -E android_sparse -t ext4 -b 4096 /opt/lineageOS/out/target/product/FP3/product.img 32231
mke2fs 1.43.3 (04-Sep-2016)
Creating filesystem with 32231 4k blocks and 32256 inodes

Allocating group tables: done                            
Writing inode tables: done                            
Writing superblocks and filesystem accounting information: done

e2fsdroid -p /opt/lineageOS/out/target/product/FP3/system -S /opt/lineageOS/out/target/product/FP3/obj/ETC/file_contexts.bin_intermediates/file_contexts.bin -f /opt/lineageOS/out/target/product/FP3/product -a /product /opt/lineageOS/out/target/product/FP3/product.img
__populate_fs: Could not allocate block in ext2 filesystem while writing file "webview.apk"
e2fsdroid: Could not allocate block in ext2 filesystem while populating file system

Out of space? The tree size of /opt/lineageOS/out/target/product/FP3/product is 129142784 bytes (123 MB), with reserved space of 0 bytes (0 MB).
The max image size for filsystem files is 132018176 bytes (125 MB), out of a total partition size of 134217728 bytes (128 MB).
[ 89% 281/315] Building Kernel Config

Any ideas?

mstaz commented 4 years ago

Hi Daniel, yes, I faced same issue. This is what I mentioned on the Fairphone forum:

Seems to be caused by a recent change in chromium-webview, where it is moved to product partition which is not big enough on FP3. I don’t have any idea why they did that.

For a quick fix I added these two lines in my local manifest file:

  <remove-project name="LineageOS/android_external_chromium-webview"/>
  <project path="external/chromium-webview" name="LineageOS/android_external_chromium-webview" groups="pdk" revision="4a9980d94c632c731e8e8bbcea43467878e4bebd" clone-depth="1" />

I don't have any clue why they moved that. Also it's the only package that is moved to product. And I wonder that this is the only package where master revision is used in the LOS16 manifest.

sooorajjj commented 4 years ago

@mstaz This is where you should comment to get answers https://review.lineageos.org/c/LineageOS/android_external_chromium-webview/+/269533

mstaz commented 4 years ago

Thanks @sooorajjj for pointing that out. Unfortunately a google account is required for commenting on gerrit. Damn, now I need to create one only for that Ok, found an old one I can use. :+1:

dk1978 commented 4 years ago

This has stumped me for quite a while now. If we go official with LineageOS on FP3 I would be curious what other devs make of this. No other module wants to be installed on product as far as I can tell.

I tried overwriting global Makefile variables such as ALL_DEFAULT_INSTALLED_MODULES but this is likely to be too dangerous, even if I can make it work. I conclude that your solution using the local manifest file to pull in a working version of chromium-webview is probably the best we can do. Unless anyone knows a better way I would make that official and document it in our device tree README.

pipoprods commented 4 years ago

I've built with this commit reverted.

What I don't like in the local manifest approach by @mstaz is that it build the image with an old version of chromium-webview. My approach uses the latest version, but it's not adequate for an official support of LineageOS on FP3 as it requires an additional (currently) manual step…

Maybe the solution is somewhere in between, but I'm not used enough to the Android build system to have a better suggestion. Just let me know if I can provide/test anything that could help here.

dk1978 commented 4 years ago

What I don't like in the local manifest approach by @mstaz is that it build the image with an old version of chromium-webview. My approach uses the latest version, but it's not adequate for an official support of LineageOS on FP3 as it requires an additional (currently) manual step…

I agree. Note that using this in the local manifest actually works:

  <remove-project name="LineageOS/android_external_chromium-webview"/>
  <project path="external/chromium-webview" name="LineageOS/android_external_chromium-webview" groups="pdk" revision="lineage-16.0" />

Here I am checking out the branch 'lineage-16.0' which is better than checking out a frozen revision by commit hash. The change to building onto product has not been pushed to this branch (yet).

dk1978 commented 4 years ago

Closing this now as local manifest workaround seems to be best option.