James Moore
James Moore

Reputation: 9026

Android AOSP build failing in build_image.py for android-10.0.0_r39

On Ubuntu 20.04 LTS. I have an AOSP tree checked out at android-10.0.0_r39. The tree builds fine for walleye - I can build an run on a device, no issues. I have no new files in the AOSP repo tree. If I switch to blueline, though, I get:

lunch aosp_blueline-userdebug
...
[ 99% 67222/67226] Target system fs image: out/target/product/blueline/obj/PACKAGING/systemimage_intermediates/system.img
FAILED: out/target/product/blueline/obj/PACKAGING/systemimage_intermediates/system.img
/bin/bash -c "(if [ -d out/target/product/blueline/system/vendor ] && [ ! -h out/target/product/blueline/system/vendor ]; then echo 'Non-symlink out/target/product/blueline/system/vendor detected!' 1>&2; echo 'You cannot install files to out/target/product/blueline/system/vendor while building a separate vendor.img!' 1>&2; exit 1; fi ) && (ln -sf /vendor out/target/product/blueline/system/vendor ) && (if [ -d out/target/product/blueline/system/product ] && [ ! -h out/target/product/blueline/system/product ]; then echo 'Non-symlink out/target/product/blueline/system/product detected!' 1>&2; echo 'You cannot install files to out/target/product/blueline/system/product while building a separate product.img!' 1>&2; exit 1; fi ) && (ln -sf /product out/target/product/blueline/system/product ) && (( cd out/target/product/blueline/system && findres=\$(find lib* -path \"lib/bootstrap\" -prune -o -path \"lib64/bootstrap\" -prune -o -path \"lib/arm\" -prune -o -path \"lib/arm64\" -prune -o -path \"lib/vndk-*\" -prune -o -path \"lib64/vndk-*\" -prune -o -type f \\( -false -o -name libadbconnection.so -o -name libadbconnectiond.so -o -name libandroidicu.so -o -name libandroidio.so -o -name libart-compiler.so -o -name libart-dexlayout.so -o -name libart-disassembler.so -o -name libart.so -o -name libartbase.so -o -name libartbased.so -o -name libartd-compiler.so -o -name libartd-dexlayout.so -o -name libartd.so -o -name libartpalette.so -o -name libc.so -o -name libdexfile.so -o -name libdexfile_external.so -o -name libdexfiled.so -o -name libdexfiled_external.so -o -name libdl.so -o -name libdt_fd_forward.so -o -name libdt_socket.so -o -name libicui18n.so -o -name libicuuc.so -o -name libjavacore.so -o -name libjdwp.so -o -name libm.so -o -name libnativebridge.so -o -name libnativehelper.so -o -name libnativeloader.so -o -name libnpt.so -o -name libopenjdk.so -o -name libopenjdkjvm.so -o -name libopenjdkjvmd.so -o -name libopenjdkjvmti.so -o -name libopenjdkjvmtid.so -o -name libpac.so -o -name libprofile.so -o -name libprofiled.so -o -name libsigchain.so -o -name libjavacrypto.so \\) -print) && if [ -n \"\$findres\" ]; then echo \"APEX libraries found in system image (see comment for check-apex-libs-absence\" 1>&2; echo \"in build/make/core/main.mk for details):\" 1>&2; echo \"\$findres\" | sort 1>&2; false; fi; ) ) && (mkdir -p out/target/product/blueline/obj/PACKAGING/systemimage_intermediates/ out/target/product/blueline/obj/PACKAGING/systemimage_intermediates && rm -rf out/target/product/blueline/obj/PACKAGING/systemimage_intermediates/system_image_info.txt ) && (echo \"system_other_size=2952790016\" >>  out/target/product/blueline/obj/PACKAGING/systemimage_intermediates/system_image_info.txt ) && (echo \"system_journal_size=0\" >>  out/target/product/blueline/obj/PACKAGING/systemimage_intermediates/system_image_info.txt ) && (echo \"ext_mkuserimg=mkuserimg_mke2fs\" >>  out/target/product/blueline/obj/PACKAGING/systemimage_intermediates/system_image_info.txt ) && (echo \"fs_type=ext4\" >>  out/target/product/blueline/obj/PACKAGING/systemimage_intermediates/system_image_info.txt ) && (echo \"extfs_sparse_flag=-s\" >>  out/target/product/blueline/obj/PACKAGING/systemimage_intermediates/system_image_info.txt ) && (echo \"squashfs_sparse_flag=-s\" >>  out/target/product/blueline/obj/PACKAGING/systemimage_intermediates/system_image_info.txt ) && (echo \"ext4_share_dup_blocks=true\" >>  out/target/product/blueline/obj/PACKAGING/systemimage_intermediates/system_image_info.txt ) && (echo \"selinux_fc=out/target/product/blueline/obj/ETC/file_contexts.bin_intermediates/file_contexts.bin\" >>  out/target/product/blueline/obj/PACKAGING/systemimage_intermediates/system_image_info.txt ) && (echo \"avb_avbtool=avbtool\" >>  out/target/product/blueline/obj/PACKAGING/systemimage_intermediates/system_image_info.txt ) && (echo \"avb_system_hashtree_enable=true\" >>  out/target/product/blueline/obj/PACKAGING/systemimage_intermediates/system_image_info.txt ) && (echo \"avb_system_add_hashtree_footer_args=--prop com.android.build.system.os_version:10 --prop com.android.build.system.security_patch:2020-06-05\" >>  out/target/product/blueline/obj/PACKAGING/systemimage_intermediates/system_image_info.txt ) && (echo \"avb_system_other_hashtree_enable=true\" >>  out/target/product/blueline/obj/PACKAGING/systemimage_intermediates/system_image_info.txt ) && (echo \"avb_system_other_add_hashtree_footer_args=--rollback_index 1591315200\" >>  out/target/product/blueline/obj/PACKAGING/systemimage_intermediates/system_image_info.txt ) && (echo \"avb_system_other_key_path=external/avb/test/data/testkey_rsa4096.pem\" >>  out/target/product/blueline/obj/PACKAGING/systemimage_intermediates/system_image_info.txt ) && (echo \"avb_system_other_algorithm=SHA256_RSA4096\" >>  out/target/product/blueline/obj/PACKAGING/systemimage_intermediates/system_image_info.txt ) && (echo \"avb_vendor_hashtree_enable=true\" >>  out/target/product/blueline/obj/PACKAGING/systemimage_intermediates/system_image_info.txt ) && (echo \"avb_vendor_add_hashtree_footer_args=--prop com.android.build.vendor.os_version:10 --prop com.android.build.vendor.security_patch:2020-06-05\" >>  out/target/product/blueline/obj/PACKAGING/systemimage_intermediates/system_image_info.txt ) && (echo \"avb_product_hashtree_enable=true\" >>  out/target/product/blueline/obj/PACKAGING/systemimage_intermediates/system_image_info.txt ) && (echo \"avb_product_add_hashtree_footer_args=--prop com.android.build.product.os_version:10 --prop com.android.build.product.security_patch:2020-06-05\" >>  out/target/product/blueline/obj/PACKAGING/systemimage_intermediates/system_image_info.txt ) && (echo \"avb_product_services_hashtree_enable=true\" >>  out/target/product/blueline/obj/PACKAGING/systemimage_intermediates/system_image_info.txt ) && (echo \"avb_product_services_add_hashtree_footer_args=--prop com.android.build.product_services.os_version:10 --prop com.android.build.product_services.security_patch:2020-06-05\" >>  out/target/product/blueline/obj/PACKAGING/systemimage_intermediates/system_image_info.txt ) && (echo \"avb_odm_hashtree_enable=true\" >>  out/target/product/blueline/obj/PACKAGING/systemimage_intermediates/system_image_info.txt ) && (echo \"avb_odm_add_hashtree_footer_args=--prop com.android.build.odm.os_version:10\" >>  out/target/product/blueline/obj/PACKAGING/systemimage_intermediates/system_image_info.txt ) && (echo \"recovery_as_boot=true\" >>  out/target/product/blueline/obj/PACKAGING/systemimage_intermediates/system_image_info.txt ) && (echo \"root_dir=out/target/product/blueline/root\" >>  out/target/product/blueline/obj/PACKAGING/systemimage_intermediates/system_image_info.txt ) && (echo \"use_dynamic_partition_size=true\" >>  out/target/product/blueline/obj/PACKAGING/systemimage_intermediates/system_image_info.txt ) && (echo \"skip_fsck=true\" >>  out/target/product/blueline/obj/PACKAGING/systemimage_intermediates/system_image_info.txt ) && (PATH=out/host/linux-x86/bin/:\$PATH build/make/tools/releasetools/build_image.py out/target/product/blueline/system out/target/product/blueline/obj/PACKAGING/systemimage_intermediates/system_image_info.txt out/target/product/blueline/obj/PACKAGING/systemimage_intermediates/system.img out/target/product/blueline/system || ( mkdir -p \${DIST_DIR}; cp out/target/product/blueline/installed-files.txt \${DIST_DIR}/installed-files-rescued.txt; exit 1 ) )"
2020-06-18 22:52:22 - build_image.py - ERROR   : Failed to build out/target/product/blueline/obj/PACKAGING/systemimage_intermediates/system.img from out/target/product/blueline/system
Out of space? Out of inodes? The tree size of /pool/james/aosp/out/soong/.temp/tmpceCvjm is 153844736 bytes (146 MB), with reserved space of 0 bytes (0 MB).
The max image size for filesystem files is 73134080 bytes (69 MB), out of a total partition size of 73134080 bytes (69 MB).
Traceback (most recent call last):
  File "build/make/tools/releasetools/build_image.py", line 789, in <module>
    main(sys.argv[1:])
  File "build/make/tools/releasetools/build_image.py", line 781, in main
    BuildImage(in_dir, image_properties, out_file, target_out)
  File "build/make/tools/releasetools/build_image.py", line 423, in BuildImage
    BuildImageMkfs(in_dir, prop_dict, out_file, target_out, fs_config)
  File "build/make/tools/releasetools/build_image.py", line 334, in BuildImageMkfs
    mkfs_output = common.RunAndCheckOutput(build_command)
  File "/pool/james/aosp/build/make/tools/releasetools/common.py", line 252, in RunAndCheckOutput
    args, proc.returncode, output))
common.ExternalError: Failed to run command '['mkuserimg_mke2fs', '-s', '/pool/james/aosp/out/soong/.temp/tmpceCvjm', 'out/target/product/blueline/obj/PACKAGING/systemimage_intermediates/system.img', 'ext4', '/', '73134080', '-j', '0', '-D', 'out/target/product/blueline/system', '-L', '/', '-i', '3256', '-M', '0', '-c', '--inode_size', '256', 'out/target/product/blueline/obj/ETC/file_contexts.bin_intermediates/file_contexts.bin']' (exit code 4):
22:52:21 mkuserimg_mke2fs.py INFO: Env: {'MKE2FS_CONFIG': './system/extras/ext4_utils/mke2fs.conf'}
22:52:21 mkuserimg_mke2fs.py INFO: Running: mke2fs -O ^has_journal -L / -N 3256 -I 256 -M / -m 0 -E android_sparse -t ext4 -b 4096 out/target/product/blueline/obj/PACKAGING/systemimage_intermediates/system.img 17855
22:52:21 mkuserimg_mke2fs.py INFO: Env: {}
22:52:21 mkuserimg_mke2fs.py INFO: Running: e2fsdroid -p out/target/product/blueline/system -s -S out/target/product/blueline/obj/ETC/file_contexts.bin_intermediates/file_contexts.bin -f /pool/james/aosp/out/soong/.temp/tmpceCvjm -a / out/target/product/blueline/obj/PACKAGING/systemimage_intermediates/system.img
22:52:22 mkuserimg_mke2fs.py ERROR: Failed to run e2fsdroid_cmd: __populate_fs: Could not allocate block in ext2 filesystem while writing file "com.android.runtime.debug.apex"
e2fsdroid: Could not allocate block in ext2 filesystem while populating file system

mke2fs 1.44.4 (18-Aug-2018)
Creating filesystem with 17855 4k blocks and 3264 inodes

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


__populate_fs: Could not allocate block in ext2 filesystem while writing file "com.android.runtime.debug.apex"
e2fsdroid: Could not allocate block in ext2 filesystem while populating file system


22:52:33 ninja failed with: exit status 1

#### failed to build some targets (01:27:37 (hh:mm:ss)) ####

Suggestions?

Upvotes: 4

Views: 9792

Answers (5)

Suneel
Suneel

Reputation: 11

These issues happen mostly when system partition is exceeding the threshold size, removing APK's might solve it but it can not be permanent fix. The size overflow also happen because of AOT compilation (PreDexOpt), A little twisting with ART config might help. One way is to use WITH_DEXPREOPT_BOOT_IMG_AND_SYSTEM_SERVER_ONLY. Refer to https://source.android.com/devices/tech/dalvik/configure for more ideas.

Upvotes: 0

lallolu
lallolu

Reputation: 139

For me, it was caused by the ROM I was building, including gapps. I solved it by removing some of the google apps that do not neccessarily need to be inbuilt in the ROM from vendor/gms/gms_full.mk. I removed drive, chrome, calendar, calculator, youtube and youtube music.

Upvotes: 0

AndroidMeter
AndroidMeter

Reputation: 21

Out of space? Out of inodes? The tree size of /pool/james/aosp/out/soong/.temp/tmpceCvjm is 153844736 bytes (146 MB), with reserved space of 0 bytes (0 MB). The max image size for filesystem files is 73134080 bytes (69 MB), out of a total partition size of 73134080 bytes (69 MB).

Please modify BOARD_SYSTEMIMAGE_PARTITION_SIZE := , where in your error log must be more than 73134080. For example BOARD_SYSTEMIMAGE_PARTITION_SIZE = 73134080 + 100MB

In another scenario, I was able to get this error fixed after freeing up some space in host machine (Build PC)

Upvotes: 2

Henrique Poleselo
Henrique Poleselo

Reputation: 95

Setting $(BOARD_USERDATAIMAGE_FILE_SYSTEM_TYPE) to ext4 may help you.

In the BoardConfig.mk file add the following snippet:

BOARD_USERDATAIMAGE_FILE_SYSTEM_TYPE := ext4

Upvotes: 0

Matt
Matt

Reputation: 2070

This is likely due to the file system you are writing your image to. In particular, I received the same problem when writing to a zfs drive. As soon as I redirected my build to an ext4 device, my build completed.

To redirect where your image is written, set the environment variable OUT_DIR_COMMON_BASE, i.e.

export OUT_DIR_COMMON_BASE=/ext4/path/to/builds

Upvotes: 3

Related Questions