Anbox



Anbox runs Android apps on Linux using a trimmed down version of Android in a container. Anbox allows one to use Android applications sandboxed, running alongside the native Linux programs. It can be very handy to help people switch from Android to an operating that respects their privacy.

See the Anbox label in the issue tracker for current progress.

Installation
Install the  package, which pulls in anbox and the anbox image required to run it. Then start the  service. Anbox takes several minutes to start up, and after the initial start, a lot of new desktop icons from Android should appear (Calendar, Clock, Contacts, F-Droid, Email, Files, ...).

Factory reset
You can delete all data known by Anbox, effectively doing the equivalent of a factory reset for physical Android devices. To do that, stop the anbox service using  and remove everything in.

Virtual keyboard input in Phosh
Keyboard input is currently broken in Phosh because of some bugs in squeekboard. Previously a workaround was to use virtboard instead of squeekboard, however nowadays that package isn't available anymore.

Workaround for Anbox content being covered by Phosh' bottom bar
$ adb shell wm overscan 0,0,0,70

You may need to adjust the dimensions depending on your device. These should work well for the PinePhone.

Requirements

 * More than 1GB of RAM. Anbox is known to be broken on 512MB of RAM and has a lot of issues with 1GB. It is known to work well on 2GB (pinephone).


 * Kernel v3.17+ or alternatively one with the  syscall available (required by LXC).

Checking defconfig
First, you need to know which kernel package does your device use to perform a kconfig check (replace wiki-example with your actual device codename):

The output of the last command will be like this:. Your mainline Linux package name will be similar to the highlighted sample one.

Then you need to verify the defconfig with pmbootstrap to make sure all the kernel modules Anbox require will be installed(replace linux-postmarketos-wiki-example with actual kernel package name).

If the check was successful, pmbootstrap will output. If the check is successful, you can install the postmarketos-anbox package and run  to start Anbox.

If some checks failed, you need to rebuild the kernel package with updated defconfig. Update the defconfig so  command will output.

Updating defconfig
First, you need to bump pkgrel of your kernel package:

Then, use  to edit the defconfig. You can browse the options menu with arrow keys and select options with Space key. You can also search your needed kconfig option with "/" button.

Once done, close the menuconfig with exit button on bottom. pmbootstrap will update your kernel defconfig and you'll be able to build the kernel.

Try building the kernel with. If build succeeds, flash the kernel into your device, and install Anbox.

Once you confirmed that your port is working, edit the kernel package APKBUILD options property to include pmb:kconfigcheck-anbox option(needed to get the package merged) and create new MR to pmaports.

I don't have access to the internet
Anbox require an anbox0 bridge interface to access the internet. should report an anbox0 interface for the network to work. There seem to be some kind of kernel requirement too, see (contains workaround) for the investigation about that.

This error usually means the  command crashed. Launch it manually to see the actual error message.

This error means dbus isn't running, or that you launched it incorrectly (check environment variables are set with ). Ensure you start dbus with your session and that you are not starting Anbox with ssh.

You can try to run the session-manager as such:. You need to leave it running and click on the anbox icon to start the GUI.

Serious Debugging
If you never see the application manager, there can be plenty of problems. The first step to debug this is knowing roughly where it fails.

Check the openRC service
will give you the state of the container manager. If it reports to be stopped despite your attempts to start it, then the container manager exited. Tell me that the container manager doesn't run in a bug report and include.

Check if the container is up
If the container manager runs, it doesn't necessarily means the container android runs in is started. To check if the container is up and running, you can try two things can give interesting clues:


 * using
 * check what it answers when you run it.  is a pretty obvious way to tell the container doesn't run; but sometimes the session manager will segfault instead. You usually can still tell if container is started.


 * using
 * the file will (hopefully) contain a non-empty log. Look for Received container state "ABORTING" instead of "RUNNING" or Set container state to "STOPPED".

In this case, tell me in a bug report that the container itself doesn't run and include.

Check the session-manager starts correctly
From times to times, the session-manager will segfault or error out. You may want to check EGL Configuration. In any case open a bug report saying that the session-manager fails to start and include the output from the command,  and.

Check if works
Install and run. If you do have a shell, that's great, Android at least started to start. If adb answers you that no devices/emulators are found and the container is running, then tell me in a bug report that adb couldn't find the device and include.

Check if works
Download an apk, for example the F-Droid one and try to install it. For example,. If this doesn't work, then Zygote probably didn't start. If you can get a shell, but can't install an app with adb, tell me in a bug report that adb install doesn't work and include.

If  works, congratulations. Please still open an issue if you don't get the anbox application manager to show up, including.