Android in an LXC container
Well Packed
![© Lead Image ©bekas007, 123RF.com © Lead Image ©bekas007, 123RF.com](/var/linux_magazin/storage/images/issues/2017/204/android-in-a-box/po-22478-123rf-bekas007_123rf-pakete_resized.png/715146-1-eng-US/PO-22478-123RF-bekas007_123RF-Pakete_resized.png_medium.png)
© Lead Image ©bekas007, 123RF.com
Need Android apps in a separate window on the Linux desktop? Anbox is the answer. Unlike common Android emulators, the software relies on LXC containers and kernel namespaces. We tested the pre-alpha version.
In April 2017, developer Simon Fels introduced an early development version of his Android in a Box (Anbox) program [1]. Released under a GPLv3 and Apache license, Anbox brings favorite apps from the Android smartphone or tablet to the Linux desktop. The software uses a different approach than emulators like Shashlik [2] and Genymotion [3] or the development environment Android Studio [4]. To bring the apps natively to the desktop, Anbox encapsulates the Android system and the apps in a LXC container, to isolate them from the Linux system.
According to statements by the developer, the project is the result of a technical incentive and not aimed at a particular target group. The idea behind the packaged Android is good: The Anbox run time essentially comprises the session manager and the container manager, which is responsible for setting up the LXC container and exchanges data with the session manager.
In turn, the session manager communicates with the Android container via multiple sockets and ensures the integration of apps on your desktop when logged in.
For a more detailed overview of the architecture and interaction of the components, you can read an article in the project's GitHub repository [5].
In the Box
Officially, Anbox currently will only run on Ubuntu LTS v16.04, but according to the readme in the GitHub repository, it should also work on 14.04, 16.10, and 17.04. I ran Ubuntu 16.04 with the Unity desktop on the lab computer.
Snap loads the Anbox installer onto the system:
snap install --classic anbox-installer
Alternatively, the installer script is available for download from the project page. You can then launch the tool with the anbox-installer
command; the script uses sudo
and asks for a password if required.
The installer sets up the developer's PPA as a packet source, retrieves a package with two kernel modules (ashmem
and binder
) for the Android container, installs Anbox itself, and sets up an Upstart job on login. For the Android apps to appear in the desktop environment's application launcher, you must reboot the computer.
Searching for anbox in the Unity Dash shows several hits after the next login (Figure 1): anbox launches the Anbox Application Manager, which leads to all the installed apps. Alternatively, you can start the program by clicking on the icon in the Start menu.
Filler Material
A minimal Android image, which is based on Android 7.1.1, runs in the Android container. The Anbox developers used the sources from the Android Open Source Project [6] and adapted them to their needs [7]. Support for alternative factory images from Google or custom ROMs is not intended. These are tailored to the respective devices and have no relevance to Anbox.
The DIY Android does not support Google accounts, so Play Store integration is missing. New apps are therefore installed on the Android system via the Android Debug Bridge [8]. Install the android-tools-adb
packet, load the desired APK file from a mirror, and install using adb install file.apk
. Alternatively, install the F-Droid app [9] and get access to an alternative app store with exclusively free and open source apps (Figure 2).
![](/var/linux_magazin/storage/images/issues/2017/204/android-in-a-box/figure-2/715152-1-eng-US/Figure-2_large.png)
Impressive
At the time of testing, the network and PulseAudio access already worked from within Anbox (Figure 3). Some apps ran well, whereas others would not cooperate. If you encounter a bug and want to discuss it with other Anbox users, search for the GitHub bug tracker on the project page [10]. The pre-alpha edition still does not let you exchange images, videos, or music between Android and Linux computers, but this feature will be available in one of the future versions.
Many Android apps are not yet ready for use on the Linux desktop, but this will probably improve in the next few versions of Android. Linux Magazine asked how the project itself is looking to move forward. According to statements by Simon Fels, the main focus is currently on stability. In order for Anbox to reach the alpha or beta status, some work on the Android run time is still necessary – the project welcomes capable developers from the Android camp.
Infos
- Anbox: https://anbox.io
- Shashlik: http://www.shashlik.io
- Genymotion: https://www.genymotion.com
- Android Studio: https://developer.android.com/studio
- Anbox run time (overview): https://github.com/anbox/anbox/blob/master/docs/runtime-setup.md
- Android Open Source Project: https://source.android.com
- Building an Android image for Anbox: https://github.com/anbox/anbox/blob/master/docs/build-android.md
- Android Debug Bridge: https://developer.android.com/studio/command-line/adb.html
- F-Droid: https://f-droid.org
- Anbox issues: https://github.com/anbox/anbox/issues
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
![Learn More](https://www.linux-magazine.com/var/linux_magazin/storage/images/media/linux-magazine-eng-us/images/misc/learn-more/834592-1-eng-US/Learn-More_medium.png)
News
-
Gnome 48 Debuts New Audio Player
To date, the audio player found within the Gnome desktop has been meh at best, but with the upcoming release that all changes.
-
Plasma 6.3 Ready for Public Beta Testing
Plasma 6.3 will ship with KDE Gear 24.12.1 and KDE Frameworks 6.10, along with some new and exciting features.
-
Budgie 10.10 Scheduled for Q1 2025 with a Surprising Desktop Update
If Budgie is your desktop environment of choice, 2025 is going to be a great year for you.
-
Firefox 134 Offers Improvements for Linux Version
Fans of Linux and Firefox rejoice, as there's a new version available that includes some handy updates.
-
Serpent OS Arrives with a New Alpha Release
After months of silence, Ikey Doherty has released a new alpha for his Serpent OS.
-
HashiCorp Cofounder Unveils Ghostty, a Linux Terminal App
Ghostty is a new Linux terminal app that's fast, feature-rich, and offers a platform-native GUI while remaining cross-platform.
-
Fedora Asahi Remix 41 Available for Apple Silicon
If you have an Apple Silicon Mac and you're hoping to install Fedora, you're in luck because the latest release supports the M1 and M2 chips.
-
Systemd Fixes Bug While Facing New Challenger in GNU Shepherd
The systemd developers have fixed a really nasty bug amid the release of the new GNU Shepherd init system.
-
AlmaLinux 10.0 Beta Released
The AlmaLinux OS Foundation has announced the availability of AlmaLinux 10.0 Beta ("Purple Lion") for all supported devices with significant changes.
-
Gnome 47.2 Now Available
Gnome 47.2 is now available for general use but don't expect much in the way of newness, as this is all about improvements and bug fixes.