Linux Mint - Community (2024)

The main purpose of this tutorial is to share my experience of building and running Anbox project from sources in Ulaya.

Anbox is a container-based approach to boot a full Android system on a regular GNU/Linux system.
Anbox is only officially deployed on the snap app store, and since snap store is disabled by default on linux Mint 20, this tutorial will try to help you to compile and run Anbox directly from sources. There is also a quite old version (2019-11-15) in apt.

Personnally, I am absolutely not an expert in compilation and I failed several times in past to build anbox, mainly due to a lack of documentation and some obscure black magic. I hope this tutorial will give you keys to make it working but I can’t guarantee you that this will work on your system.

1. Tested environment

  • Source: master#170f1e0
  • Mint: 20 (Ulaya)
  • Kernel: 5.4.0-48-generic
  • C/CXX Compiler: GNU 9.3.0

I recommend you to configure your system to get as close as possible to this environment.

2. Useful resources

1. Prerequisites

a) Kernel modules

As explained in official documentation, you need to load two kernel modules: ashmem_linux and binder_linux.

$ sudo modprobe ashmem_linux$ sudo modprobe binder_linux$ ls -1 /dev/{ashmem,binder}/dev/ashmem/dev/binder

If you experience issue with binder_linux, try this instructions. (Thanks to RogerWilco)

b) Dependencies

$ sudo apt update$ sudo apt install build-essential cmake cmake-data debhelper dbus google-mock \ libboost-dev libboost-filesystem-dev libboost-log-dev libboost-iostreams-dev \ libboost-program-options-dev libboost-system-dev libboost-test-dev \ libboost-thread-dev libcap-dev libexpat1-dev libsystemd-dev libegl1-mesa-dev \ libgles2-mesa-dev libglm-dev libgtest-dev liblxc1 \ libproperties-cpp-dev libprotobuf-dev libsdl2-dev libsdl2-image-dev lxc-dev \  pkg-config protobuf-compiler libgmock-dev git

2. Compilation

1. Go where you want to build (assuming here "/usr/local/src/" directory)

$ cd /usr/local/src

2. Get sources

$ sudo git clone https://github.com/anbox/anbox.git --recurse-submodules

3. Adjust permissions and create a build directory

$ sudo chown -R $USER:$USER anbox/$ mkdir anbox/build/$ cd anbox/build/

4. Prepare for compilation

$ cmake ..-- The C compiler identification is GNU 9.3.0-- The CXX compiler identification is GNU 9.3.0-- Check for working C compiler: /usr/bin/cc-- Check for working C compiler: /usr/bin/cc -- works-- Detecting C compiler ABI info-- Detecting C compiler ABI info - done-- Detecting C compile features-- Detecting C compile features - done-- Check for working CXX compiler: /usr/bin/c++-- Check for working CXX compiler: /usr/bin/c++ -- works-- Detecting CXX compiler ABI info-- Detecting CXX compiler ABI info - done-- Detecting CXX compile features-- Detecting CXX compile features - done-- No build type selected, default to RelWithDebInfo-- Treat warnings as errors-- Found Boost: /usr/lib/x86_64-linux-gnu/cmake/Boost-1.71.0/BoostConfig.cmake (found version "1.71.0") found components: filesystem log serialization system thread program_options -- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1") -- Found Threads: TRUE -- Found EGL: /usr/lib/x86_64-linux-gnu/libEGL.so -- Found GLESv2: /usr/lib/x86_64-linux-gnu/libGLESv2.so -- Found Protobuf: /usr/lib/x86_64-linux-gnu/libprotobuf.so;-lpthread (found version "3.6.1") -- Checking for module 'sdl2'-- Found sdl2, version 2.0.10-- Checking for module 'SDL2_image'-- Found SDL2_image, version 2.0.5-- Checking for module 'dbus-1'-- Found dbus-1, version 1.12.16-- Checking for module 'lxc'-- Found lxc, version 4.0.2-- Checking for module 'properties-cpp'-- Found properties-cpp, version 0.0.1-- Checking for module 'libsystemd'-- Found libsystemd, version 245-- Checking for module 'libcap'-- Found libcap, version 2.32-- LXC version: 4.0.2-- Checking for module 'gtest'-- Found gtest, version 1.10.0-- Checking for module 'gtest_main'-- Found gtest_main, version 1.10.0-- Checking for module 'gmock'-- Found gmock, version 1.10.0-- Checking for module 'gmock_main'-- Found gmock_main, version 1.10.0-- Found Boost: /usr/lib/x86_64-linux-gnu/cmake/Boost-1.71.0/BoostConfig.cmake (found version "1.71.0") found components: iostreams system -- Found Boost: /usr/lib/x86_64-linux-gnu/cmake/Boost-1.71.0/BoostConfig.cmake (found version "1.71.0") found components: filesystem system unit_test_framework -- Found libdw: /usr/lib/x86_64-linux-gnu/libdw.so -- Found libbfd: /usr/lib/x86_64-linux-gnu/libbfd.so -- Found libdwarf: /usr/lib/x86_64-linux-gnu/libdwarf.so -- Found Backward: /usr/local/src/anbox/external/backward-cpp -- Looking for dlfcn.h-- Looking for dlfcn.h - found-- Looking for getauxval-- Looking for getauxval - found-- Configuring done-- Generating done-- Build files have been written to: /usr/local/src/anbox/build

At this step, triple check everything is alright. If something went wrong here, you must fix it before continuing.

5. Cross fingers and compile!

$ make[...]Scanning dependencies of target buffer_queue_tests[100%] Building CXX object tests/anbox/graphics/CMakeFiles/buffer_queue_tests.dir/buffer_queue_tests.cpp.o[100%] Linking CXX executable buffer_queue_tests[100%] Built target buffer_queue_testsScanning dependencies of target lxc_container_tests[100%] Building CXX object tests/anbox/container/CMakeFiles/lxc_container_tests.dir/lxc_container_tests.cpp.o[100%] Linking CXX executable lxc_container_tests[100%] Built target lxc_container_tests

You surely will see some warnings, but you should not see any errors.

6. Install anbox For some reasons, “sudo make install” failed with insufficient permissions, so I went with “sudo -i”.

$ sudo -i$ cd /usr/local/src/anbox/build/$ make install[ 3%] Built target sdbus-cpp[ 10%] Built target process-cpp[ 12%] Built target emugen[ 13%] Built target OpenglCodecCommon[ 14%] Built target renderControl_dec[ 17%] Built target GLESv2_dec[ 19%] Built target GLESv1_dec[ 25%] Built target emugl_common[ 27%] Built target OpenGLESDispatch[ 28%] Built target xdg[ 29%] Built target xdg_test[ 29%] Built target backward[ 30%] Built target backward_object[ 31%] Built target utils[ 32%] Built target cpu_features[ 34%] Built target list_cpu_features[ 35%] Built target unix_based_hardware_detection[ 38%] Built target anbox-protobuf[ 88%] Built target anbox-core[ 89%] Built target anbox[ 90%] Built target intent_tests[ 91%] Built target restricted_manager_tests[ 92%] Built target at_parser_tests[ 93%] Built target scope_ptr_tests[ 93%] Built target binary_writer_tests[ 94%] Built target type_traits_tests[ 94%] Built target small_vector_tests[ 95%] Built target message_channel_tests[ 96%] Built target render_control_tests[ 97%] Built target layer_composer_tests[ 98%] Built target buffered_io_stream_tests[100%] Built target buffer_queue_tests[100%] Built target lxc_container_testsInstall the project...-- Install configuration: "RelWithDebInfo"-- Installing: /usr/local/share/anbox/ui/loading-screen.png-- Installing: /usr/local/include/backward.hpp-- Installing: /usr/local/lib/backward/BackwardConfig.cmake-- Installing: /usr/local/lib/libcpu_features.a-- Installing: /usr/local/include/cpu_features/cpu_features_macros.h-- Installing: /usr/local/include/cpu_features/cpu_features_cache_info.h-- Installing: /usr/local/include/cpu_features/cpuinfo_x86.h-- Installing: /usr/local/bin/list_cpu_features-- Installing: /usr/local/lib/cmake/CpuFeatures/CpuFeaturesTargets.cmake-- Installing: /usr/local/lib/cmake/CpuFeatures/CpuFeaturesTargets-relwithdebinfo.cmake-- Installing: /usr/local/lib/cmake/CpuFeatures/CpuFeaturesConfig.cmake-- Installing: /usr/local/lib/cmake/CpuFeatures/CpuFeaturesConfigVersion.cmake-- Installing: /usr/local/bin/anbox-- Set runtime path of "/usr/local/bin/anbox" to ""$ exit

7. Test

$ anboxNAME: anbox - anboxUSAGE: anbox [command options] [arguments...]COMMANDS: check-features Check that the host system supports all necessary features wait-ready Wait until the Android system has successfully booted system-info Print various information about the system we're running on launch Launch an Activity by sending an intent session-manager Run the the anbox session manager version Print the version of the daemon help Print a short help message

8. If you reach this step, you have successfully compiled Anbox! Congrats!

9. Additional checks : especially check that binder and ashmem are recognised.

$ anbox check-featuresYour computer does meet all requirements to run Anbox$ anbox system-infoversion: local-170f1e0cpu: arch: x86 brand: Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz features: - aes - sse4_1 - sse4_2 - avx - avx2os: name: Linux Mint version: 20 (Ulyana) snap-based: falsekernel: version: Linux version 5.4.0-48-generic (buildd@lcy01-amd64-010) (gcc version 9.3.0 (Ubuntu 9.3.0-10ubuntu2)) #52-Ubuntu SMP Thu Sep 10 10:58:49 UTC 2020 binder: true ashmem: truegraphics:[...]

1. Introduction

As doc says, Anbox does not contain any android image and uses:

  • a container manager
  • a session manager

What doc does not say is what to do with those info when you know nothing about the project and virtualization.

Hopefully, sources of debian package of anbox took me to the right way:

  1. Session manager depends on Container manager to run
  2. Container manager depends on anbox-bridge.sh script and the famous android image to run
  3. anbox-bridge.sh appears to be on a scripts/ directory inside anbox sources ("/usr/local/src/anbox/scripts/")
  4. android image is… to build or find on the Internet

2. Get an android image

This operation must be done once, but you need an android image to run container manager. You can download one from here, altought images are not really recent.

Alternatively you can build your own android image as explained here, but I have not tested it and this is not covered by this tutorial (maybe another one?).

1. Download image

$ wget https://build.anbox.io/android-images/2018/07/19/android_amd64.img

2. Check integrity

$ wget https://build.anbox.io/android-images/2018/07/19/android_amd64.img.sha256sum$ sha256sum -c android_amd64.img.sha256sum

3. Create a directory for storing this image, let’s say "/var/lib/anbox"

$ sudo mkdir /var/lib/anbox

4. Move the android image to this directory

$ sudo mv android_amd64.img /var/lib/anbox/android.img

3. Let's run it!

This process must be followed each time you want to run Anbox manually:

1. Assert kernel modules are loaded (required after each reboot)

$ ls -1 /dev/{ashmem,binder}/dev/ashmem/dev/binder

2. Start bridge script

$ sudo /usr/local/src/anbox/scripts/anbox-bridge.sh start

3. Manually start container manager

$ sudo anbox container-manager --daemon --privileged --data-path=/var/lib/anbox

This command will launch container as a daemon, do not expect any output and let it running (use CTRL+C if you want to stop it later)

4. Optionaly, if you are looking for logs, open another terminal and watch for logs

$ sudo tail -f /var/lib/anbox/logs/container.log

5. Open another terminal and finally, launch anbox app manager (will automatically start session manager)!

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

1. Using a service for container

To simplify startup routine, we can use a systemd service:

1. Create a anbox-container-manager.service file with following content (adapt paths if needed)

$ sudo vim /lib/systemd/system/anbox-container-manager.service[Unit]Description=Anbox Container ManagerAfter=network.targetWants=network.targetConditionPathExists=/var/lib/anbox/android.img[Service]ExecStartPre=/sbin/modprobe ashmem_linuxExecStartPre=/sbin/modprobe binder_linuxExecStartPre=/usr/local/src/anbox/scripts/anbox-bridge.sh startExecStart=/usr/local/bin/anbox container-manager --daemon --privileged --data-path=/var/lib/anboxExecStopPost=/usr/local/src/anbox/scripts/anbox-bridge.sh stop[Install]WantedBy=multi-user.target

2. Symlink it

$ sudo ln -s /lib/systemd/system/anbox-container-manager.service /etc/systemd/system/

3. Reload daemons

$ sudo systemctl daemon-reload

4. Start it!

$ sudo systemctl start anbox-container-manager.service

5. Check status

$ sudo systemctl status anbox-container-manager.service

5. Optionally : start it with system

$ sudo systemctl enable anbox-container-manager.service

I hope this tutorial has helped you making Anboxworking on your system.
How to use anbox is beyond the scope of this tutorial and I think you can find other ressources on the Internet.
Do not hesitate to comment to tell me if this worked for you too, correct my mistakes or to provide additional content.

Linux Mint - Community (2024)
Top Articles
Fort Smith AR Real Estate - Fort Smith AR Homes For Sale | Zillow
Www Televicentro En Vivo
Where To Go After Howling Pit Code Vein
Tattoo Shops Lansing Il
Hannaford Weekly Flyer Manchester Nh
Chicago Neighborhoods: Lincoln Square & Ravenswood - Chicago Moms
Unity Stuck Reload Script Assemblies
Brendon Tyler Wharton Height
Sportsman Warehouse Cda
Yi Asian Chinese Union
Wal-Mart 140 Supercenter Products
CA Kapil 🇦🇪 Talreja Dubai on LinkedIn: #businessethics #audit #pwc #evergrande #talrejaandtalreja #businesssetup…
Decaying Brackenhide Blanket
Does Publix Have Sephora Gift Cards
Https://Gw.mybeacon.its.state.nc.us/App
Ivegore Machete Mutolation
How do you like playing as an antagonist? - Goonstation Forums
Belly Dump Trailers For Sale On Craigslist
Craigslist Blackshear Ga
Ruben van Bommel: diepgang en doelgerichtheid als wapens, maar (nog) te weinig rendement
Between Friends Comic Strip Today
Utexas Iot Wifi
Https E22 Ultipro Com Login Aspx
Discord Nuker Bot Invite
Nk 1399
They Cloned Tyrone Showtimes Near Showbiz Cinemas - Kingwood
Ihs Hockey Systems
Halsted Bus Tracker
Hoofdletters voor God in de NBV21 - Bijbelblog
6465319333
Everstart Jump Starter Manual Pdf
Babbychula
Makemkv Key April 2023
SOC 100 ONL Syllabus
Priscilla 2023 Showtimes Near Consolidated Theatres Ward With Titan Luxe
Craigslist Jobs Brownsville Tx
Cdcs Rochester
Final Jeopardy July 25 2023
Thelemagick Library - The New Comment to Liber AL vel Legis
Gold Dipping Vat Terraria
Nba Props Covers
Gfs Ordering Online
Lbl A-Z
Trivago Anaheim California
Divinity: Original Sin II - How to Use the Conjurer Class
Celsius Claims Agent
Enr 2100
Go Nutrients Intestinal Edge Reviews
House For Sale On Trulia
Food and Water Safety During Power Outages and Floods
Swissport Timecard
Latest Posts
Article information

Author: Edmund Hettinger DC

Last Updated:

Views: 5860

Rating: 4.8 / 5 (78 voted)

Reviews: 85% of readers found this page helpful

Author information

Name: Edmund Hettinger DC

Birthday: 1994-08-17

Address: 2033 Gerhold Pine, Port Jocelyn, VA 12101-5654

Phone: +8524399971620

Job: Central Manufacturing Supervisor

Hobby: Jogging, Metalworking, Tai chi, Shopping, Puzzles, Rock climbing, Crocheting

Introduction: My name is Edmund Hettinger DC, I am a adventurous, colorful, gifted, determined, precious, open, colorful person who loves writing and wants to share my knowledge and understanding with you.