Android 11 AOSP编译后模拟器启动循环故障求助
execv("/system/bin/init") Error Hey there, let's break down the boot loop issue you're hitting after compiling Android 11 (android-11.0.0_r17) and launching the emulator. Those errors point to a few key areas we can investigate step by step:
Core Issue Breakdown
First, let's clarify the critical errors:
init: execv("/system/bin/init") failed: No such file or directory: Even though you confirmedinitexists in the ramdisk, the system is trying to launch it from/system/bin—which suggests either the system partition isn't mounting correctly, or there's a misconfiguration in the init scripts.Unable to open /lib/modules, skipping module loading: This is a warning (not usually a boot loop trigger on its own), but it might hint at a mismatch between your kernel and system image.
Step-by-Step Fixes
1. Simplify the Emulator Launch Command
Manually specifying image paths can introduce typos or mismatches. Try launching the emulator directly from your AOSP directory, which auto-loads the correct build artifacts:
cd /home/ubuntu/aosp source build/envsetup.sh lunch generic_x86-eng emulator -verbose -show-kernel
This ensures the emulator uses the exact kernel, system, and ramdisk from your out/target/product/generic_x86 directory without manual path errors.
2. Verify AVD Architecture Matches Your Build
You're using an AVD named a25x86, but your build targets generic_x86 (32-bit x86). If your AVD is configured for x86_64, this mismatch can cause mounting failures.
- Create a new AVD specifically for
generic_x86:- Run
avdmanager create avd -n aosp_x86 -k "system-images;android-30;google_apis;x86"(Android 11 corresponds to API 30) - Launch with
emulator -avd aosp_x86 -verbose -show-kernel
- Run
3. Check if /system/bin/init Actually Exists
The error says this file is missing—let's verify your system.img has it:
# Convert sparse image to raw format simg2img /home/ubuntu/aosp/out/target/product/generic_x86/system.img system_raw.img # Mount the raw image mkdir -p /mnt/aosp_system sudo mount -o loop system_raw.img /mnt/aosp_system # Check for init in system/bin ls /mnt/aosp_system/bin/init
If the file is missing, your build likely didn't complete successfully. Try a clean rebuild:
cd /home/ubuntu/aosp make clean lunch generic_x86-eng make -j$(nproc)
4. Inspect Ramdisk Init Configuration
Even if init exists in the ramdisk, the init scripts might be pointing to the wrong path. Let's unpack the ramdisk and check:
mkdir ramdisk_unpacked cd ramdisk_unpacked gzip -dc /home/ubuntu/aosp/out/target/product/generic_x86/ramdisk.img | cpio -idm # Look for references to /system/bin/init in init.rc grep "exec.*init" init.rc
Normally, the initial init runs from the ramdisk root (/init), not /system/bin/init. If you see a line trying to exec /system/bin/init before the system partition is mounted, that's the problem. Reverting to the default init.rc for generic_x86 should fix this.
5. Rule Out Kernel/Module Mismatches
The /lib/modules warning might indicate your kernel wasn't built with module support, or the modules aren't packaged into the system image. For emulator builds, you can usually ignore this, but if you modified the kernel config:
- Revert to the default kernel config for
generic_x86 - Rebuild the kernel with
make kernelthen recompile the system images.
Final Notes
Start with the simplest fixes first—simplifying the emulator command and checking AVD architecture. If those don't work, verifying the system.img content and init scripts will get you to the root cause.
内容的提问来源于stack exchange,提问作者emras

