Difference between revisions of "Anbox"

From Maemo Leste Wiki
Jump to navigationJump to search
 
(12 intermediate revisions by the same user not shown)
Line 4: Line 4:


  apt install anbox
  apt install anbox
Or install anbox from HAM.
[[File:Anbox-ham.png|400px]]
You might have to enable zram or classic swap (at least 1GB).


= Usage =
= Usage =
Line 12: Line 18:
  \_ /usr/bin/anbox container-manager --daemon --privileged --data-path=/var/lib/anbox --android-image=/usr/share/anbox/android.img
  \_ /usr/bin/anbox container-manager --daemon --privileged --data-path=/var/lib/anbox --android-image=/usr/share/anbox/android.img


You should be able to start Anbox through '''Menu->Anbox'''. Be patient with the splash screen. It can take a looong time.
== Alternative (CLI) ==
Same as above, the initscript should start anbox's container manager.


As '''user''':
As '''user''' in a terminal:


export ANBOX_LOG_LEVEL=debug
  anbox session-manager
  anbox session-manager
This should output:
user@devuan-pinephone:~$ anbox session-manager
[ 2021-01-18 14:20:08] [Renderer.cpp:165@initialize] Using a surfaceless EGL context
[ 2021-01-18 14:20:08] [Renderer.cpp:248@initialize] Successfully initialized EGL
[ 2021-01-18 14:21:03] [session_manager.cpp:264@operator()] Android successfully booted
In another terminal, also as '''user''':
  anbox launch --package=org.anbox.appmgr --component=org.anbox.appmgr.AppViewActivity
  anbox launch --package=org.anbox.appmgr --component=org.anbox.appmgr.AppViewActivity


There is also an option with using '''anbox-launch.sh''' but I have not gotten it to work successfully.
Please note that '''it takes a long time to start''' an activity for the first time. So be patient. Subsequent runs should be faster.
You can view "progress" in htop. anbox should be using the CPU. When the usage is low, you should be ready to start activities.
 
 
== Tips ==
 
=== Free memory after usage ===
 
To free up some memory after you're done with usage:
 
kill -3 `pgrep -f session-manager`


Please note that '''it takes a long time to start''' an activity for the first time. So be patient. Subsequent runs should be faster.
=== Logs ===
 
You can export an environment variable to get some more debug output from Anbox
 
export ANBOX_LOG_LEVEL=debug
 
Plus, you can also find some useful logs in /var/lib/anbox/logs.
 
=== Running Anbox in the Leste VM ===
 
Under qemu, it is possible to run Anbox in a VM. (Please add instructions for other VM backends if you test them)
 
A command line that is tested to work:
 
qemu-system-x86_64 -enable-kvm -cpu host -m 4G \
    -smp cores=4 -drive file=maemo-leste.qcow2,if=virtio \
    -net nic -net user,hostfwd=tcp::2223-:22 \
    -usb -device usb-tablet \
    -vga virtio -display gtk,gl=on
 
The <code>-vga virtio -display gtk,gl=on</code> is the important part. It should also be possible
to use plain SDL rather than GTK with <code>-display sdl,gl=on</code> instead. When booted, you
should see that hardware acceleration is enabled in the kernel log.
 
# dmesg | grep -i dri
 
Once enabled, on beowulf you also need the backports kernel, so you can install it by enabling the
backports repository:
 
# echo "deb https://pkgmaster.devuan.org/merged beowulf-backports main" >> /etc/apt/sources.list
# apt update
# apt -t beowulf-backports install linux-image-amd64
# reboot
# apt install anbox
 
Then you can use Anbox normally.
 
= Further reading =
 
https://wiki.postmarketos.org/wiki/Anbox
 
https://anbox.io/

Latest revision as of 09:55, 27 January 2021

Installation

From extras

apt install anbox

Or install anbox from HAM.

Anbox-ham.png

You might have to enable zram or classic swap (at least 1GB).

Usage

The initscript should automatically start anbox container-manager.

supervise-daemon anbox-container-manager --start /usr/bin/anbox -- container-manager --daemon --privileged --data-path=/var/lib/anbox --android-image=/usr/share/anbox/android.img
\_ /usr/bin/anbox container-manager --daemon --privileged --data-path=/var/lib/anbox --android-image=/usr/share/anbox/android.img

You should be able to start Anbox through Menu->Anbox. Be patient with the splash screen. It can take a looong time.

Alternative (CLI)

Same as above, the initscript should start anbox's container manager.

As user in a terminal:

export ANBOX_LOG_LEVEL=debug
anbox session-manager

This should output:

user@devuan-pinephone:~$ anbox session-manager
[ 2021-01-18 14:20:08] [Renderer.cpp:165@initialize] Using a surfaceless EGL context
[ 2021-01-18 14:20:08] [Renderer.cpp:248@initialize] Successfully initialized EGL
[ 2021-01-18 14:21:03] [session_manager.cpp:264@operator()] Android successfully booted

In another terminal, also as user:

anbox launch --package=org.anbox.appmgr --component=org.anbox.appmgr.AppViewActivity

Please note that it takes a long time to start an activity for the first time. So be patient. Subsequent runs should be faster. You can view "progress" in htop. anbox should be using the CPU. When the usage is low, you should be ready to start activities.


Tips

Free memory after usage

To free up some memory after you're done with usage:

kill -3 `pgrep -f session-manager`

Logs

You can export an environment variable to get some more debug output from Anbox

export ANBOX_LOG_LEVEL=debug

Plus, you can also find some useful logs in /var/lib/anbox/logs.

Running Anbox in the Leste VM

Under qemu, it is possible to run Anbox in a VM. (Please add instructions for other VM backends if you test them)

A command line that is tested to work:

qemu-system-x86_64 -enable-kvm -cpu host -m 4G \
    -smp cores=4 -drive file=maemo-leste.qcow2,if=virtio \
    -net nic -net user,hostfwd=tcp::2223-:22 \
    -usb -device usb-tablet \
    -vga virtio -display gtk,gl=on

The -vga virtio -display gtk,gl=on is the important part. It should also be possible to use plain SDL rather than GTK with -display sdl,gl=on instead. When booted, you should see that hardware acceleration is enabled in the kernel log.

# dmesg | grep -i dri

Once enabled, on beowulf you also need the backports kernel, so you can install it by enabling the backports repository:

# echo "deb https://pkgmaster.devuan.org/merged beowulf-backports main" >> /etc/apt/sources.list
# apt update
# apt -t beowulf-backports install linux-image-amd64
# reboot
# apt install anbox

Then you can use Anbox normally.

Further reading

https://wiki.postmarketos.org/wiki/Anbox

https://anbox.io/