Ultimate Guide to install Anbox in any Arch-based distro(especially Garuda)

Anbox is deprecated now as its development has stalled, and its founding developer has acknowledged this.
There are other alternatives:

You can check out our Waydroid installation guide:



The guide will be available here for any references.



While trying to get Anbox running, you would probably get stuck somewhere and find it all confusing, just like it was for me before getting it running.

I have made this guide so that it would be a lot easier for you to get Anbox running!
These steps should work for everyone, and I have ensured every step is explained well enough so that even someone new to Linux can do it!

ArchWiki:Archive - ArchWiki (refer to this for more information regarding kernel modules)

1. Installing required modules:

  • Install anbox-modules-dkms(check out this link for more information, recent updates and prevailing issues if any), which provides binder and ashmem modules.

sudo pacman -S anbox-modules-dkms

This installs the required binder and ashmem modules for any kernel.

2. Reboot
3. Installing Anbox:

You can install it from Garuda Gamer ā†’ Emulators. It will install Anbox with all necessary dependencies and even Google PlayStore!

or just run the command:

sudo pacman -S anbox-support

4. Enable Anbox services:

automated with installing anbox-support

i) Configure Networking:

sudo systemctl enable --now systemd-networkd

ii) Enable the Container Manager Service:

sudo systemctl enable --now anbox-container-manager.service

iii) Enable the Session Manager Service:

sudo systemctl --user enable --now anbox-session-manager.service

5. Setting up Kernel Modules

i) To automatically load the ashmem & binder modules on boot(Kernel module - ArchWiki):
Create a file inside /etc/modules-load.d/, which contains the lines:
(sudo nano /etc/modules-load.d/anbox.conf)

/etc/modules-load.d/anbox.conf

binder_linux 
ashmem_linux

(Save and exit)

You could refer this(anbox-modules-dkms) if needed.

ii) To automatically create mount points for the ashmem & binder modules at boot
(systemd - ArchWiki):
Create a file in /etc/tmpfiles.d/ with the content:
(sudo nano /etc/tmpfiles.d/anbox.conf)

/etc/tmpfiles.d/anbox.conf

d! /dev/binderfs 0755 root root
d! /dev/ashmem 0755 root root

(Save and exit)

iii) To automatically mount the binder modules on boot, add a line in the fstab. Using the option nofail here will not greet you with a recovery shell when you are booting a kernel without binderfs support (such as the standard kernel):
(sudo nano /etc/fstab)

/etc/fstab

none                         /dev/binderfs binder   nofail  0      0

(Save and exit)

You can skip iv) & v) steps if you reboot after the iii) one.

iv) Load ashmem and binder modules without reboot (Kernel module - ArchWiki)

sudo modprobe binder_linux devices=binder,hwbinder,vndbinder,anbox-binder,anbox-hwbinder,anbox-vndbinder

sudo modprobe ashmem_linux

v) Mount the binder modules:

(mkdir(1) ā€” Arch manual pages)
(mount(8) ā€” Arch manual pages)

  • sudo mkdir -p /dev/binderfs
  • sudo mount -t binder none /dev/binderfs

6. Now to check the required modules are loaded and mounted automatically on boot, run:
sudo ls -1 /dev/binderfs

It should give a somewhat similar output(may even vary, itā€™s ok):

āÆ ls -1 /dev/{ashmem,binder}
/dev/ashmem

/dev/binder
binder
binder-control
features
hwbinder
vndbinder

(The ashmem directory wouldnā€™t show any modules.)

If the modules are all up and running, you should now be able to launch Anbox from your application menu!

7. If you want to use adb to debug, install android-tools:
sudo pacman -S android-tools

8. Once you have the APK package for the application, you can install it into the Android container with the following command:

adb install my-app.apk

This post is a simplified version of this one: https://forum.garudalinux.org/t/a-little-help-with-anbox/

           There you are, enjoy Android Apps in Garuda Linux!
11 Likes

Very nice, thanks! :slight_smile:

2 Likes

If I ask your advice, which kernel is better? I donā€™t want to run both of them.

@dr460nf1r3, I have decided to use Linux-Xanmod, hope it doesn't disappear from the repositories :grinning:

For me Xanmod is better than Zen, choosing a kernel is highly dependant on the setup you run so it might not apply for you. Best is to just test :wink:

Noted, trying to keep it updated :slight_smile:

4 Likes

Thanks a lot.
You people are doing a great job with this distro. :smiley: :wink:

3 Likes

I thing tkg-bmg it works best with my mac.

1 Like

Edit - UPDATE: I still cannot enter developer options and therefore can't turn on USB debugging however I am now signed in with Google Play Services/Store and was able to get Magisk launched and updated... I thought I had configured my firewall correctly to allow anbox0 to connect but I was wrong. That was the hitch with those 2 issues. So unless anyone can think of why I might need USB debugging now that I can install apps/magisk modules, I think I can call it a day and chalk this up to (mostly) user error. Not that I really see much of a need to do this but out of curiosity, can ROMs be flashed using a flashing tool on anbox (thereby circumventing any need for USB debugging for flashing ROMs)?

I don't see anyone else mentioning any issues so I'm going to assume I'm alone here but maybe that means one of you are able to point me in the right direction or point out where I went wrong - install process went buttery smooth and Anbox launches just fine. Network connection/Anbox0 bridge is up and running, too. My issue is that I can't enable USB debugging and therefore can't install any apps AFAIK. I can open settings and tap "Build Number" 7 times to enable Developer Options, however when I click on Developer Options, anbox thinks for a moment and then settings/anbox crashes (sometimes just settings, sometimes the entire application). I wasn't surprised that I couldn't sign in with Google in order to use the Google Play Store but was left asking myself why it would be included if it wouldn't work. I thought perhaps clearing cache might help but clicking on Backup and Reset yields the same result as clicking Dev Options, i.e., crash. I was hoping that maybe USB debugging would be enabled by default once Dev Options are unmasked but no dice, ADB doesn't list it under devices.

For a little background, I've tried using both the xanmod-anbox and tkg-bmq kernels with the same result. Perhaps worth noting that I'm actually using tkg-bmq-zen2 since I'm on zen2 arch, but I can't imagine that would make any difference, or am I wrong to make this assumption? Outside of that, I didn't stray from the instructions at all. The only other thing I can think of to make note of is that I did not skip the "Load modules" step, both because I wanted to be able to run anbox using other kernels and because of the slight/zen2 difference. Again, if I was a fool to do this, please don't hesitate to tell me so.

Lastly, and this may not be relevant but I cannot launch Magisk. It just displays a black/blank screen for a few seconds before crashing.

Of course I searched the internet high and low for insight and there are mentions of others having this issue but nothing in the way of a fix, so any insight would be awesome! THANKS!

edit - in my search for a fix I came across someone pointing to $XDG_RUNTIME_DIR not being defined but as far as my limited knowledge/experience in that area would take me and from what was indicated in that thread, there was nothing wrong with how anbox was configured on my system (though I can't help but have my doubts based on the terminal output). I'm just not knowledgeable enough on the subject and haven't yet changed that fact but the instructions given here by @Austin (thank you very much for taking the time to compile this set of instructions, btw) seem to be presented as a more or less total package and they make no mention of any need to mess with $XDG_RUNTIME_DIR...

ā•­ā”€sir_paul at 4x4-BOXPC in āŒ
ā•°ā”€Ī» echo $XDG_RUNTIME_DIR
/run/user/1000
ā•­ā”€sir_paul at 4x4-BOXPC in āŒ
ā•°ā”€Ī» sudo systemctl --user enable anbox-session-manager.service
[sudo] password for sir_paul:         
Failed to connect to bus: $DBUS_SESSION_BUS_ADDRESS and $XDG_RUNTIME_DIR not defined (consider using --machine=<user>@.host --user to connect to bus of other user)
ā•­ā”€sir_paul at 4x4-BOXPC in āŒ
ā•°ā”€Ī» echo $DBUS_SESSION_BUS_ADDRESS
unix:path=/run/user/1000/bus

Yeah, it happens to me too,
but I can sign in and use the Play store, but, it doesnā€™t make any difference cause non of the apps I installed launched.

The only other thing I can think of to make note of is that I did not skip the ā€œLoad modulesā€ step, both because I wanted to be able to run anbox using other kernels and because of the slight/zen2 difference. Again, if I was a fool to do this, please donā€™t hesitate to tell me so.

I donā€™t think, it would have caused any issue, I mentioned skipping ā€˜Load moduleā€™ in tkg-bmq because
because when I tried to run the command: sudo modprobe -a binder-linux ashmem-linux, I found that there were no such modules in tkg-bmq,
but running: sudo modprobe -a binder, did work.
But then, it still worked without running the Load module command.

By the way, I am no expert in all the technicality you are talking about (I am just a newbie to Linux). I have no idea about USB debugging and all that and I am sorry to say you may not find anyone, who might be knowing all this stuff. I think nobody is that interested in Anbox in this forum.

I just wanted to try and learn about running android in Linux, cause Chrome Os is just a container like Anbox on top of I think, Gentoo. Though I can just simply multi-boot Chrome Os [Chrome OS + Windows + Linux Triple Boot Install on PC or Laptop] in my system (I have Garuda, Fedora, MX Linux & Windows, installed on my machine), having able to run android in Linux itself would be just great. I have heard that Windows is trying to integrate the Android app into it.(I rare use Windows and I am trying to use as less as possible)
Anbox seems to be promising, but its development is slow.
And I am just looking forward to running android in Linux and lean more about it.

thank you very much for taking the time to compile this set of instructions, btw)
:wink:

1 Like

Hi all,
I think I'll give this one a try in the next days.

Looks promising, since unlike Anbox (or better the relevant android-images) this one seems more up-to-date (up to Android 11).

6 Likes

If anyone succeeds in running it please make an article to run it in Garuda Forum,
I will try to do so too

linux-cacule got updated today and anbox support has been added.

Take a watch here:

https://forum.garudalinux.org/t/linux-cacule-feedback-testing/7672

Github:

5 Likes

Hello everybody.
I just wanted to leave you my feedback on some quick tests done earlier.
I initially tried ReDroid on my default (zen) kernel and it didn't work (the docker instance was not created at all, although I didn't investigate in e.g. the logs).
In fact, I had previously tried manually compiling the ashmem_linux and binder_linux modules but got errors, which all in all I expected as I had previously read something about the fact that the zen kernel does not need those modules.
Then I installed the Linux-Cacule kernel, the pre-compiled one, since I don't know how to compile it manually :blush: and at this moment I didn't have time to "study" on it a bit ...
The Linux-Cacule kernel works fine for me, I haven't noticed any performance differences, but my laptop is definitely low-end, so this is kind of expectable...
With this kernel however, I was able to load ashmem_linux and binder_linux modules.
In this way, ReDroid worked, in the sense that the instance was created and I could connect via VNC and Android started, but it was so slow and laggish that I gave up.
I read only later that it should work better with scrcpy. Maybe one day I will try it, but I was quite / too much disappointed by the performance. Maybe that's why I had always read that Anbox was a better solution than all emulators, since it is not in fact an emulator.
Of course, Anbox also worked with Linux-Cacule (I only started it and made a few easy settings changes and connected to Google Play Store).
But my problem remains, I think due to the old Android image, that Roblox (my real goal, for my kids :slight_smile:, and to get rid of windows...) doesn't start...

3 Likes
  • Install kernel modules:

sudo bash -c ā€œcurl -s https://raw.githubusercontent.com/remote-android/redroid-modules/master/deploy/build.shā€

  • start ReDroid instance and connect via VNC
    docker run -v ~/data:/data -d -p 5900:5900 -p 5555:5555 --rm --memory-swappiness=0 --privileged redroid/redroid:10.0.0-latest redroid.vncserver=1

    explains:
    -v ~/data:/data ā€“ mount data partition
    -p 5900:5900 ā€“ 5900 for VNC connect, you can connect via VncViewer with :5900
    -p 5555:5555 ā€“ 5555 for adb connect, you can run adb connect localhost

    • OR start ReDroid instance and connect via scrcpy (Performance boost, recommended)
docker run -v ~/data:/data -d -p 5555:5555 --rm --memory-swappiness=0 --privileged redroid/redroid:10.0.0-latest
 adb connect <IP>:5555
 scrcpy --serial <IP>:5555

Did you work out by following these steps or was there anything else to do.

I didnā€™t quite, understand the github page ( I am new to all these things)

By the way, scrcpy is in chaotic aur.

Would you please point out the steps you followed to start ReDroid

2 Likes

I take a watch to find a kernel patch / modules for redroid.
Since I have never used anbox Iā€™m not familiar with that. (iOS/MacOS User / donā€™t hate me xD)

3 Likes
āÆ sudo modprobe -a binder-linux ashmem-linux
[sudo] password for austin:      
modprobe: WARNING: Module binder-linux not found in directory /lib/modules/5.12.0-6-cacule
modprobe: WARNING: Module ashmem-linux not found in directory /lib/modules/5.12.0-6-cacule
āÆ sudo modprobe -a binder ashmem
modprobe: WARNING: Module binder not found in directory /lib/modules/5.12.0-6-cacule
modprobe: WARNING: Module ashmem not found in directory /lib/modules/5.12.0-6-cacule
āÆ sudo modprobe -a binderfs
modprobe: WARNING: Module binderfs not found in directory /lib/modules/5.12.0-6-cacule
āÆ sudo systemctl enable --now systemd-networkd
āÆ systemctl --user enable --now anbox-session-manager.service
āÆ sudo systemctl enable --now anbox-container-manager.service

Tried all this, but anbox not launching.

Yes, I followed that guide, but not the initial part "Install Kernel Modules".
For that part, they provide a script (build.sh) but this includes only commands for debian/ubuntu or redhat. So, I tried to do manually what is written in that script.

  • you should install git kmod make and your linux-headers, but I just checked the availability of kmod (so did not install it) and did not install also the rest, git because I had already used it, so I knew I had it, as well as the linux-headers.
  • sudo su
  • cd /root
  • git clone https://github.com/remote-android/redroid-modules.git
  • cd redroid-modules && make install
    That gave me errors (I kept notes, but in this moment I'm not on that laptop).

Second try:
I installed the Linux-Cacule kernel, I tried again as above to "Install Kernel Module" but with no luck.
Then I tried simply to follow the Anbox procedure (Anbox - ArchWiki):
sudo modprobe -a binder-linux ashmem-linux
which is equivalent to the steps in your guide (which are the "persistent" solution):

/etc/modules-load.d/anbox.conf
ashmem_linux
binder_linux

Then:
sudo docker run -v ~/data:/data -d -p 5900:5900 -p 5555:5555 --rm --memory-swappiness=0 --privileged redroid/ redroid/redroid:11.0.0-amd64 redroid.vncserver=1
(sudo with docker can be avoided creating a "docker" group and adding your user to it)
Finally I connected via TigerVNC using MyIP:5900

I think Redroid works ootb with the Linux-Cacule kernel (see my other post, "Second try").
It is terribly slow, but I'm sure this has nothing to deal with the kernel...

You mean to say all these steps didnā€™t work for you, in that case, same with me, they didnā€™t work.

You just loaded the anbox modules(as in my guide), and ran this command:
sudo docker run -v ~/data:/data -d -p 5900:5900 -p 5555:5555 --rm --memory-swappiness=0 --privileged redroid/ redroid/redroid:11.0.0-amd64 redroid.vncserver=1
??

when I run the same command:
sudo docker run -v ~/data:/data -d -p 5900:5900 -p 5555:5555 --rm --memory-swappiness=0 --privileged redroid/redroid:10.0.0-latest redroid.vncserver=1

the system logouts and nothing shows up.
By the way how does the redroid look?
(I am first time using docker)

Now the modules have are there after an update
Thanks