Sarab

Reference

Commands

Every sarab command and option, as sarab --help gives them.

sarab is the only command you need. It is shaped like docker or podman: a verb, then its arguments. Every command has --help, and sarab completion bash|zsh|fish|elvish|powershell prints shell completion (the installer sets up bash’s, and fish’s when fish is installed).

Commands that talk to Android start it when it is not running, and resume it when it is paused.

Android

sarab start

Boot Android; returns once it is up. The first time, it sets Android up with you (Installation).

Option
-F, --foreground Stay in the foreground as the runtime’s owner (what the systemd unit runs)
--lifetime SECS Stop after SECS (with --foreground; by default it runs until sarab stop)
--idle-freeze SECS Pause Android after SECS without a window; 0 never pauses. Default 60
--no-hostd Do not start the host services (clipboard, notifications, launcher entries)
--no-network Boot without networking

sarab stop, sarab restart

Stop Android; stop it, then start it again.

sarab status

Is Android running, paused, booting? --json for machine-readable output.

sarab pause, sarab unpause

Freeze every Android process (no CPU, no wakeups; memory is kept), and resume it. Android pauses itself a minute after its last window closes, so you rarely need these.

Apps

sarab install FILE

Install an .apk, or a split bundle (.apks, .xapk). A shortcut for sarab app install.

sarab app ls

List the installed apps that have a launcher entry. Alias list.

Option
--json Machine-readable output
-q, --quiet Print package names only

sarab app launch PACKAGE

Open an app in its own window.

sarab app rm PACKAGE

Remove an app you installed. Aliases remove, uninstall. Takes a few seconds, and closes open Android apps (why).

sarab app show

Show the full Android interface instead of a single app.

sarab app inspect PACKAGE

Details about one app. --json for machine-readable output.

sarab app intent ACTION URI

Send an intent, for example android.intent.action.VIEW and a web address, and print the package that handled it.

Inside Android

sarab exec [COMMAND]...

Run a command inside Android, or a shell when none is given.

Option
-u, --user USER Run as this Android user: root, shell, system, or a uid. Default root
-g, --groups GIDS Extra supplementary groups, as gids (e.g. 3003,3009); the user’s own are always given

sarab logs [-- LOGCAT...]

Show Android’s log (logcat), or the host-side logs. Extra logcat arguments go after --, for example sarab logs -- -s ActivityManager.

Option
-f, --follow Keep printing new lines as they arrive
-n, --tail N Only the last N lines
--kernel Android’s kernel log (init’s /dev/kmsg)
--daemon The runtime owner’s own output (sarab start)
--hostd The host services: clipboard, notifications, launcher entries

sarab stats

Live memory, CPU and process count of the running Android.

Option
--no-stream Print one reading and exit
--json Machine-readable output, one JSON object per reading

sarab prop get|set|ls

Read or set Android system properties: get NAME, set NAME VALUE, and ls [PATTERN], which lists the properties whose name contains PATTERN.

sarab settings get|put

Read or change Android settings: get TABLE KEY and put TABLE KEY VALUE, where TABLE is system, secure or global.

sarab policy apply|revert|status

The desktop package policy: what of the image is switched off. apply switches off what a desktop does not need (automatic on the first boot), revert switches everything back on, status shows what is on and off. See Inside Android.

Setup and maintenance

sarab setup

Download and prepare the Android image. sarab start does it the first time; it is safe to repeat.

Option
--system ZIP Use this system image zip instead of downloading one
--vendor ZIP Use this vendor image zip instead of downloading one
--data-dir DIR Keep the image and Android’s data here (installed sarab only; remembered)
--vanilla Download the image without Google apps (no Play Store)
--latest Download the newest build instead of the tested one (untested; its checksum comes from the same server)
--force Extract again even if the image is already there

sarab upgrade

Move Android to the image this Sarab is tested with, keeping its apps and data.

Option
-y, --yes Do not ask first (Android restarts if it is running)
--check Only say whether an upgrade is due

sarab google-id

Print this device’s Google ID, to register it so the Play Store works (Google Play).

Option
--wait SECS Wait up to this many seconds for Google Services to check in. Default 0
-q, --quiet Print only the ID

sarab info

Versions, paths and host checks. Paste its output into a bug report.

sarab purge

Delete the Android image and Android’s data. Asks first; Android must be stopped.

Option
--data-only Delete only Android’s data (apps, accounts, settings), keep the image
-y, --yes Do not ask

sarab apparmor-profile

Print the AppArmor profile that lets sarab-ns create Android’s namespace, for Ubuntu 23.10 and later (Requirements).

sarab completion SHELL

Print a shell completion script for bash, elvish, fish, powershell or zsh.

    Type to search the documentation.