Sarab

Using Sarab

Inside Android

Run commands inside Android, read its logs, and change its properties, settings and package policy.

Sarab never starts adb. Everything adb would give you is a sarab command instead, and works without a key or a connection.

A shell

sarab exec                                 # a shell inside Android, as root
sarab exec getprop ro.build.version.release
sarab exec -u shell cmd package list packages

-u picks the Android user: root (the default), shell (uid 2000, with the groups adbd would give it), system, or a number. -g adds supplementary groups by gid. When you are at a terminal you get a real one inside Android, so Ctrl+C, the window size and full-screen programs work, and the exit status comes back to you.

Android’s root is your own user on the host, inside Android’s namespaces, not the machine’s root. See Security.

Logs

sarab logs                    # Android's log (logcat)
sarab logs -f                 # and keep following it
sarab logs -n 200             # only the last 200 lines
sarab logs -- -s ActivityManager

Anything after -- goes to logcat. The host side has logs of its own:

Flag Log
--kernel Android’s kernel log, what its init writes to /dev/kmsg
--daemon the output of the process that owns Android, sarab start
--hostd the host services: clipboard, notifications, launcher entries, the display relay

Properties and settings

sarab prop get ro.build.version.sdk
sarab prop set debug.example.value 1
sarab prop ls waydroid          # the properties whose name contains "waydroid"

sarab settings get global policy_control
sarab settings put system screen_off_timeout 600000

settings takes a table, system, secure or global, as Android’s settings command does.

The desktop policy

On the first boot of Android’s data, Sarab switches off what a desktop does not need, which saves memory and a few annoyances:

  • Google’s search app and hotword listener, Android Auto, SMS, carrier services and WAP push, since there is no telephony;
  • the setup wizard, partner setup, Google’s feedback uploader, the backup transports and the print spooler;
  • Launcher3, replaced as the home screen by a tiny home activity of Sarab’s, 8.5 KB with no code;
  • a lower limit on cached background processes;
  • Play Protect’s check of apps installed from the host, whose dialog would have no window to appear in.
sarab policy status   # what is on and off
sarab policy revert   # switch everything back on
sarab policy apply    # switch it off again

    Type to search the documentation.