How to Install Anbox to Run Android Apps in Ubuntu 20.04, Ubuntu 21.10

Last updated: December 10, 2023

 

 
ANBOX IS NO LONGER IN ACTIVE DEVELOPMENT! Try the popular Waydroid instead!

Want to run Android apps in Linux? Here’s how to do it using the Anbox container in Ubuntu 20.04 and Ubuntu 21.10.

Anbox, Anbox in a box, is a free and open-source software that runs the full Android system in a container, abstracts hardware access and integrates core system services into a GNU/Linux system.

There’s another solution “Waydroid” to do the similar things in Linux. It’s said to have better performance, though it requires Wayland session. For those stick to Xorg, here’s how to install and use Anbox.

Load Kernel modules:

Anbox requires ashmem_linux and binder_linux kernel modules.

1.) If you have the SecureBoot enabled (check via sudo mokutil --sb-state command), open terminal by pressing Ctrl+Alt+T on keyboard, and run command to sign the kernel module:

sudo kmodsign sha512 /var/lib/shim-signed/mok/MOK.priv /var/lib/shim-signed/mok/MOK.der /lib/modules/`uname -r`/kernel/drivers/staging/android/ashmem_linux.ko

2.) Next load the modules one by one via command:

sudo modprobe ashmem_linux
sudo modprobe binder_linux

3.) Finally verify the kernel modules via command:

lsmod | grep -e ashmem_linux -e binder_linux

Install Anbox:

The software is available to install via official Snap and classic DEB packages, though I recommend the snap package this time. Because, the DEB is not well supported. User needs to manually mount binder, download and load Android image, and troubleshoot other issues. And it ultimately failed to run in my case.

To install Anbox snap, press Ctrl+Alt+T to open terminal, and run command:

snap install anbox --beta --devmode

After installation, you may try to launch Anbox by searching it from activities overview screen. However, it does not launch in my case until installed the Google Play Store. If so, try running the command below in terminal to start it:

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

Install Google Play Store:

Anbox has a few built-in applications except Google Play Store, because Google will only permit certified devices to ship with their applications. Thankfully, there’s an installer script to automatically install it for you.

1.) Firstly, open terminal and run command to install some required libraries:

sudo apt install wget curl lzip tar unzip squashfs-tools

2.) Next, download the script via wget command:

wget https://raw.githubusercontent.com/geeks-r-us/anbox-playstore-installer/master/install-playstore.sh

3.) Add executable permission:

chmod u+x install-playstore.sh

4.) And run the script will download the package and install Play Store:

./install-playstore.sh

Now, search for and open Anbox from activities overview screen. When it opens, go to settings and grant all permissions to Google Play Store, and finally open the Play Store to install Android apps.

How to Remove Anbox:

To remove the software, simply run command in terminal:

snap remove --purge anbox

You may also remove the “anbox” and “anbox-work” folders in user’s home directory.

Twitter

I'm a freelance blogger who started using Ubuntu in 2007 and wishes to share my experiences and some useful tips with Ubuntu beginners and lovers. Please comment to let me know if the tutorial is outdated! And, notify me if you find any typo/grammar/language mistakes. English is not my native language. Contact me via [email protected] Buy me a coffee: https://ko-fi.com/ubuntuhandbook1

10 responses to How to Install Anbox to Run Android Apps in Ubuntu 20.04, Ubuntu 21.10

  1. anbox launch –package=org.anbox.appmgr –component=org.anbox.appmgr.AppViewActivity
    [ 2021-10-26 06:53:08] [daemon.cpp:61@Run] Application manager service is not running yet

    • Seems you have installed the DEB package via apt, since anbox SNAP runs in my case without starting the “Application manager service”.

      You may either remove it via the command below, and continue this tutorial.

      sudo apt remove --autoremove anbox

      Or, troubleshooting the DEB version by manually starting the service:

      systemctl start anbox-container-manager.service

      Though things will be more difficult. You’ve to manually download Android image and put it into /var/lib/anbox. Mount /dev/binder via the text below in /etc/fstab, and more …

      “none /dev/binder binder nofail 0 0”

  2. MIke O’Donnell November 6, 2021 at 12:08 am

    I copied and pasted from your instructions on a new Ubuntu 21.10 installation on IdeaPad 1. This is running Wayland, which may have an impact. Everything seemed to work until the final launch. The first launch, before installing Google Play Store, brought up a window with one row of applications. After installing Google Play Store, launches failed, sometimes bringing up a blank window that disappeared later. After failing from the Application menu, I tried the manual start again:

    $ anbox launch –package=org.anbox.appmgr –component=org.anbox.appmgr.AppViewActivity
    [ 2021-11-05 23:59:25] [daemon.cpp:61@Run] Application manager service is not running yet

    Previously, ps reported something with anbox involving a container manager. That line has disappeared from ps output, so perhaps some daemon was killed and needs to restart. I will reboot and report back in another comment. I wanted to get some copy and paste into this one before losing context.

  3. MIke O’Donnell November 6, 2021 at 12:53 am

    After a reboot I found an anbox daemon running before I started the application:

    ps aux | grep anbox
    root 679 0.0 0.2 248192 11296 ? Ssl 18:10 0:00 /snap/anbox/186/usr/bin/anbox container-manager –data-path=/var/snap/anbox/common/ –android-image=/snap/anbox/186/android.img –daemon –use-rootfs-overlay

    Anbox still failed from the menu, but I was able to start it up from the command line using your “anbox launch” command, and I made it in to Google Play.

    In case others are interested:

    1. I first tried the Debian package for anbox, but could not figure out exactly what android.img to download, and I figured there would be other problems, so I removed it.

    2. I thought Waydroid might be better, but the download instructions went up to 21.04 and not to 21.10. I tried putting in “impish” instead of “hirsute” but there was no release for “impish.”

    3. Now I am running the snap anbox fine under Wayland. There is an XWayland package installed, so it might not be working directly on Wayland.

  4. Thank you Ji. It all worked on the first pass using ubuntu 20.04

  5. Everything worked for me but I didn’t get an application menu icon and everything crashes when i try to run Art of War. Thanks for this guide.

  6. I’ve gotten it running but Google can’t connect and it crashes every time I try to add an account through Settings.

  7. Not have another way

  8. I did everything from your instructions until i attempted to install the playstore.
    This is what I got:
    ./install-playstore.sh: line 164: /etc/systemd/system/anbox-container-manager.service.d/override.conf: Permission denied.
    Any help would be apprectiated.