APM is a GPL-3.0-or-later package manager stack for Android. It combines an APT-like package workflow, a privileged daemon, an Android module system, APK staging helpers, and shell PATH hotload support.
apm: CLI client. It handles local read-only commands, manual package installs, log viewing/export, trusted-key import, and IPC requests to the daemon.apmd: privileged package daemon. It handles repository updates, package install/remove/upgrade/autoremove, APK install/uninstall, security sessions, factory reset, and command shim generation.amsd: AMS daemon. It applies overlays, runs enabled module scripts at boot, manages AMS safe mode, and exposes module IPC.- AMS: APM Module System. Modules live under
/data/ams/modulesand can overlaysystem,vendor, andproduct.
- Active transport is UNIX sockets, not Binder.
apm -> apmd- Android: abstract socket
@apmd - Emulator mode:
$HOME/APMEmulator/data/apm/apmd.socket
- Android: abstract socket
client -> amsd- Android:
/data/ams/amsd.sock - Emulator mode:
$HOME/APMEmulator/ams/amsd.socket
- Android:
Persistent APM data under /data/apm:
cachekeyslistslogspkgssandbox/{state,env,mounts}sources/*.repostatus.security/debug.txt
Shell-accessible runtime content under /data/local/tmp/apm:
runtime/installed/runtime/installed/commands/runtime/installed/dependencies/runtime/installed/termux/runtime/manual-packages/bin/path/logs/
AMS data under /data/ams:
modules/logs/.runtime/{upper,work,base}amsd.sock.amsd_boot_counter.amsd_safe_mode_threshold.amsd_safe_mode
- APM root:
$HOME/APMEmulator/data/apm - AMS root:
$HOME/APMEmulator/ams
The CLI auto-detects emulator mode by looking for the emulator apmd.socket.
- Sources are read from
/data/apm/sources/*.repo. - Add a source with
apm add-repo <file.repo>, then runapm update. - Supported source options:
Type=debURL=...Suites=<dist>,<component>[,<component>...]Architectures=...Trusted=...Deb-Signatures=...
- Release metadata flow:
- Prefer
InRelease - Fall back to
Release+Release.gpg
- Prefer
Packages.gzand plainPackagesare supported.Packages.xzis intentionally disabled in the current Android path.- Termux-style repositories are auto-detected and architecture-mapped when needed.
Trust behavior:
Trusted=yes|true|1: skip Release signature verificationTrusted=required: require Release signature verification- default: try verification and continue unverified on failure
Detached .deb signature behavior:
Deb-Signatures=required: package install fails if detached verification fails or no signature is availableDeb-Signatures=optional: verification is attempted when possible, but install can continueDeb-Signatures=disabled: skip detached package signature checks
Detached package signature results are cached in /data/apm/pkgs/sig-cache.json.
Daemon-backed commands:
apm pingapm updateapm add-repo <file.repo|file.apprepo>apm list-reposapm remove-repo <name|name.repo>apm install <pkg>apm remove <pkg>apm upgrade [pkgs...]apm autoremoveapm debuglogging <true|false>apm factory-resetapm wipe-cache [all|apm|repo-lists|package-downloads|sig-cache|ams-runtime]apm forgot-passwordapm module-listapm module-install <zip>apm module-enable <name>apm module-disable <name>apm module-remove <name>apm app-install <id> [<release>|--select-release] [--install-as-system]app-remove <id>app-info <id>apm apk-install <apk> [--install-as-system]apm apk-uninstall <package>
Session-free daemon/local commands:
apm app-list <id> [<release>]apm listapm list-reposapm info <pkg>apm search <pattern>apm package-install <file>apm log [--apm|--ams|--module <name>|<module>] [--export|--clear]apm log --clear-allapm versionapm key-add <file.asc|file.gpg>apm sig-cache showapm sig-cache clearapm help
Notes:
package-installsupports local.debfiles plus tar-style archives such as.tar,.tar.gz,.tgz,.tar.xz,.txz,.gz, and.xz.- Tarball/manual packages must contain
package-info.json. removefirst checks whether the target is a manual package and removes it locally before falling back to daemon-backed package removal.log --exportwrites a timestamped copy to/storage/emulated/0.log --exportand live log following are local read operations.log --clearandlog --clear-allare daemon-backed operations and require an authenticated session because they delete privileged log files.apk-install --install-as-systemstages the APK into the AMS-backedapm-system-appsoverlay module and requires a reboot for Android to see it as a system app.
- Privileged operations require an authenticated session.
- Session-free requests:
PingAuthenticateForgotPasswordListInfoSearchListRepos
- Session-required requests:
- update/add-repo/remove-repo/install/remove/upgrade/autoremove
- APK operations
- module lifecycle operations
- factory reset
- debug logging toggle
- First privileged use triggers password/PIN setup if none exists.
- Initial setup requires exactly 3 security questions.
- Password/PIN and security-question data are encrypted with AES-256-GCM.
- User-secret derivation uses PBKDF2-HMAC-SHA256 with
200000iterations. - Session tokens are HMAC-protected and expire after
180seconds. - Failed forgot-password answer verification triggers a
5minute cooldown.
sudo apt update
sudo apt install -y \
build-essential cmake pkg-config git \
ninja-build clang clangd sdkmanager google-android-platform-tools-installersudo dnf install -y \
@development-tools cmake pkgconf-pkg-config git \
ninja-build clang clangd clang-tools-extra sdkmanager android-toolssudo pacman -Sy --needed \
base-devel cmake pkgconf git ninja clang clangd sdkmanager adb fastbootbuild_android.sh expects an Android SDK plus an NDK reachable via ANDROID_NDK_ROOT, ANDROID_NDK_HOME, or $ANDROID_SDK_ROOT/ndk.
Recommended SDK components:
sdkmanager --install \
"build-tools;37.0.0" \
"cmake;4.1.2" \
"ndk;r30"All CMake builds use repository-staged BoringSSL prebuilts:
- Android:
prebuilt/boringssl/build-<abi>/libssl.a - Android:
prebuilt/boringssl/build-<abi>/libcrypto.a - Host/emulator:
prebuilt/boringssl/build-x86_64/orbuild-x86/ - Headers:
prebuilt/boringssl/include/openssl/base.h
See boringssl-tools/compile-for-all-abi/README.md for the Android helper flow.
./build_android.shHelpful flags:
./build_android.sh --abi arm64-v8a./build_android.sh --all./build_android.sh --emulator./build_android.sh --api 34
Behavior:
- API level must be
29or newer - Android builds go to
build-<abi>/ - Emulator builds go to
build/ compile_commands.jsonis published at the workspace root
cmake -S . -B build -G Ninja -DAPM_EMULATOR_MODE=ON -DCMAKE_BUILD_TYPE=Release
cmake --build build --parallel "$(nproc)"Run emulator binaries with --emulator:
./build/apmd --emulator
./build/amsd --emulatorAndroid.bp defines apm, apmd, and amsd targets.
apm-flashable-new/ contains the maintained recovery deployment path.
Build it with:
cd apm-flashable-new
./build_recovery_zip.shThe flashable builder:
- rebuilds binaries by default with
APM_FORCE_REBUILD=1 - supports
--abi,--all, and--api - syncs SELinux payload from
selinux-contexting/ - emits
apm-lineage-recovery-YYYYMMDD-<abi>.zip
Magisk packaging is deprecated and no longer maintained here.
docs/wiki/Home.mddocs/wiki/APM-Architecture.mddocs/wiki/AMS-Architecture.mddocs/wiki/CLI-and-Operations.mddocs/wiki/Build-and-Deployment.mddocs/wiki/AMS-Module-Development.mddocs/wiki/Troubleshooting.md.deb-signature-verification-flow.md
.apprepo files describe APK bundles from GitHub and GitLab.com releases.
Use the MicroG example for GitHub or FDroid.apprepo
for GitLab.com.
apm add-repo Repositories/AppRepos/MicroG.apprepo
apm update
apm app-list microg
apm app-install microg --select-release
# Prompt for /system/app or /system/priv-app and privileged permission choices:
apm app-install microg --install-as-systemPass an exact release tag after the repository ID to list or install that version. During installation, enter one or more APK numbers separated by commas or spaces, or press Enter to select all. System app changes are staged through AMS and require a reboot. See App repositories for configuration, permissions, updates, removal, and MicroG's ROM prerequisites.