APM is a GPLv3 package manager for rooted Android with an APT-like workflow and Android-specific daemon tooling.
Current CLI version string in source: 2.0.0b - Open Beta.
apm: CLI client.apmd: main package daemon (install/update/remove/upgrade, APK workflows, AMS module operations).amsd: AMS daemon (overlay application + module daemon IPC).- AMS (APM Module System): module format and runtime for system/vendor/product overlays.
- Transport is UNIX socket based.
- CLI requests go to
apmdover/data/apm/apmd.sock(emulator:$HOME/APMEmulator/data/apm/apmd.socket). - AMS daemon serves module IPC over
/data/ams/amsd.sock(emulator:$HOME/APMEmulator/ams/amsd.socket). - Binder code exists in-tree as legacy/reference, but active runtime flow is socket-first.
src/
apm/ CLI + IPC client
apmd/ Main daemon, package install logic, APK logic, auth/session, PATH hotload
amsd/ AMS daemon, module dispatcher, overlay startup/safe-mode handling
ams/ Module metadata + module manager
core/ Repo parsing, download/index handling, status DB, extraction, shared security utils
util/ Filesystem helpers + crypto helpers (SHA256/MD5/OpenPGP verify)
thirdparty/ Vendored headers
APM root:
/data/apm/installed/data/apm/installed/commands/data/apm/installed/dependencies/data/apm/installed/termux/data/apm/bin/data/apm/cache/data/apm/pkgs/data/apm/lists/data/apm/status/data/apm/sourcesand/data/apm/sources/sources.list.d/data/apm/manual-packages/data/apm/keys/data/apm/.security/data/apm/logs/data/apm/apmd.sock
AMS root:
/data/ams/modules/data/ams/logs/data/ams/.runtime/data/ams/.runtime/upper/data/ams/.runtime/work/data/ams/.runtime/base/data/ams/amsd.sock- Safe-mode files:
/data/ams/.amsd_boot_counter,/data/ams/.amsd_safe_mode_threshold,/data/ams/.amsd_safe_mode
Emulator mode roots:
$HOME/APMEmulator/data/apm$HOME/APMEmulator/ams
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DAPM_EMULATOR_MODE=ON
cmake --build build -j$(nproc)Run daemons with --emulator when built in emulator mode.
./build_android.shNotes:
- Script enforces API level >= 29.
- Detects NDK from
ANDROID_NDK_ROOT/ANDROID_NDK_HOMEor$ANDROID_SDK_ROOT/ndk. - Includes an
x86_64 (Emulator Mode)option.
Use Android.bp (apm, apmd, amsd targets).
apm-magisk/ contains module assets and startup scripts. The service flow starts amsd first and then apmd.
Note: some deployment scripts still reference /dev/socket/amsd as a readiness hint, but current daemon default socket path from runtime config is /data/ams/amsd.sock.
apm-flashable-new/ contains a slot-aware Lineage Recovery installer and SELinux payload.
APM reads deb entries from:
/data/apm/sources/sources.list/data/apm/sources/sources.list.d/*.list
Supported options in bracket blocks include:
arch=/architectures=trusted=deb-signatures=
Trust behavior:
trusted=yesskips Release signature verification.trusted=requiredrequires valid Release signature.- Default (
trustednot set) attempts verification and can continue unverified on failure.
Package signature behavior:
deb-signatures=required:.debdetached signature required and must verify.deb-signatures=optional: attempts verify if signature exists; install may continue when missing/invalid.deb-signatures=disabled: no package-level detached signature enforcement.
Packages.gz and plain Packages are used. Packages.xz is intentionally disabled in current Android path.
Daemon-backed:
apm pingapm updateapm install <pkg>apm remove <pkg>apm upgrade [pkgs...]apm autoremoveapm factory-resetapm forgot-passwordapm module-listapm module-install <zip>apm module-enable <name>apm module-disable <name>apm module-remove <name>apm apk-install <apk> [--install-as-system]apm apk-uninstall <package>
Local/offline helpers:
apm listapm info <pkg>apm search <pattern>apm package-install <file>apm key-add <file.asc|file.gpg>apm sig-cache showapm sig-cache clearapm versionapm help
- First privileged flow sets or unlocks a password/PIN.
- Exactly 3 security questions are required on initial setup.
- Master key at
/data/apm/.security/masterkey.bin. - Password/PIN and security answers are stored encrypted.
- PBKDF2-HMAC-SHA256 uses 200,000 iterations.
- Session token is persisted with HMAC integrity and 180-second expiry.
- Forgot-password wrong answers trigger a 5-minute cooldown lockout.
amsdvalidates session tokens against the same session material.
Package install behavior:
- Dependency resolver is currently direct dependency oriented (not full recursive SAT solver).
- SHA256 verification is preferred, with MD5 fallback when metadata provides it.
- Signature verification cache stored at
/data/apm/pkgs/sig-cache.json.
Manual package install:
- Supports
.deband archive suffixes.tar.gz,.tgz,.tar.xz,.txz,.tar,.gz,.xz. - Tar-based manual packages require
package-info.json.
APK workflows:
- User app install uses staged
pm install --user 0 -rflow. --install-as-systemstages APK into AMS moduleapm-system-appsunderoverlay/system/app/.../base.apk.
AMS modules live in /data/ams/modules/<module_name>.
Expected module files:
module-info.json(required)overlay/(required)overlay/system,overlay/vendor,overlay/product(optional subtrees)post-fs-data.sh(optional)service.sh(optional)
module-info.json fields in current parser:
name(required)versionauthordescriptionmount(defaulttrue)post_fs_data(defaultfalse)service(defaultfalse)
state.json fields:
enabledinstalled_atupdated_atlast_error
Install expectations:
- ZIP extraction uses
unzip -oq. - Either flat module root or single nested top directory is accepted.
overlay/directory must exist.
Overlay targets:
systemvendorproduct
Current implementation detail: the bind-backend path is the primary overlay path reached during applyOverlayForTarget().
apmd:/data/apm/logs/apmd.logamsd:/data/ams/amsd.log- Module logs:
/data/ams/logs/<module>.log
- Dependency resolution is direct-dependency oriented (not a full recursive SAT resolver).
Packages.xzindexes are intentionally disabled in the current Android path.- Binder paths remain in source as legacy/reference; active runtime uses UNIX sockets.
apmdstartup aborts if legacy modules are detected under/data/apm/modules.
Wiki-ready markdown pages are in docs/wiki/:
docs/wiki/Home.mddocs/wiki/APM-Architecture.mddocs/wiki/AMS-Architecture.mddocs/wiki/AMS-Module-Development.mddocs/wiki/CLI-and-Operations.mddocs/wiki/Build-and-Deployment.mddocs/wiki/Troubleshooting.md
These are intended to be copied into GitHub Wiki pages.
GNU GPL v3.0 or later.