Jump to content

Anbox: Difference between revisions

From postmarketOS Wiki
Afontain (talk | contribs)
Add a porting section
Ichernev (talk | contribs)
Line 24: Line 24:
=== I don't have access to the internet ===
=== I don't have access to the internet ===


Anbox require an anbox0 bridge interface to access the internet. <code>ip link</code> should report an anbox0 interface for the network to work. There seem to be some kind of kernel requirement too, see {{Issue|480|pmaports}} for the investigation about that.
Anbox require an anbox0 bridge interface to access the internet. <code>ip link</code> should report an anbox0 interface for the network to work. There seem to be some kind of kernel requirement too, see {{Issue|480|pmaports}} (contains workaround) for the investigation about that.


=== When I start Anbox, it complains about DBus ===
=== When I start Anbox, it complains about DBus ===

Revision as of 15:10, 15 June 2020

Note Consider using native Linux programs instead, see FAQ.
Note Development on this feature can be done without running pmOS on a real device with QEMU. Please use the lts kernel for that as the virt kernel doesn't include the necessary modules.
Note Anbox is currently somewhat broken on armv7 because Anbox assumes 64 bits in some places, which breaks input (see https://github.com/anbox/anbox/issues/1214#issuecomment-524578664. Please manifest yourself if you can test and try that)
The anbox application manager with the default apps.

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 milestone#7 for current progress.

Installation

Install the postmarketos-anbox package. Launch using anbox-launch or the icon launcher.


Porting

If Anbox have never been working on you device, you may have to add kernel support for it. Use pmbootstrap kconfig check --anbox (from !1916) to check.


Troubleshooting

I don't have access to the internet

Anbox require an anbox0 bridge interface to access the internet. ip link should report an anbox0 interface for the network to work. There seem to be some kind of kernel requirement too, see pmaports#480 (contains workaround) for the investigation about that.

When I start Anbox, it complains about DBus

[daemon.cpp:61@Run] Failed to request DBus service name means dbus isn't running, or that you launched it incorrectly (check environment variables are set with env). Ensure you start dbus with your session and that you are not starting Anbox with ssh.


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

rc-service anbox-container-manager status 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 /var/lib/anbox/logs/container.log.

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 anbox session-manager
check what it answers when you run it. Failed to start container 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 /var/lib/anbox/logs/container.log
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 /var/lib/anbox/logs/container.log.

Check if adb works

Install android-tools and run adb shell. 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 /var/lib/anbox/logs/console.log.

Check if adb install works

Download an apk, for example the F-Droid one and try to install it. For example, adb install Dowloads/FDroid.apk. 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 /var/lib/anbox/logs/console.log.

If adb install works, congratulations, we have only got Anbox to run that far once or twice so far. Please still open an issue if you don't get the anbox application manager to show up, including /var/lib/anbox/logs/console.log.