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

WAYDROID formerly referred to as Anbox-Halium which is a rebuild of Anbox, intended to use more of the native host’s hardware resulting in faster performance as compared to Anbox .

https://waydro.id/
https://wiki.archlinux.org/title/Waydroid
https://github.com/waydroid/waydroid

Though you might be able to follow the above guides and get Waydroid running,
most probably you might get stuck somewhere and find it all confusing, just like I was before getting it running.
The instructions are all the more similar to that for getting anbox running!

These steps should definitely work for everyone, and I have made sure everything step is explained well enough so that even someone new to Linux would be able to do it!

  1. Choose a kernel from here: List of Arch Linux Kernels patched for Anbox .
    [ Anbox works with following kernels :-
  • linux-zen (it is in the Arch Official Repositories),
  • linux-tkg-bmq (it is in the chaotic-aur for Garuda users),
  • linux-cacule (it is in the chaotic-aur for Garuda users,
    for more details refer:https://forum.garudalinux.org/t/linux-cacule-feedback-testing)
  • linux-xanmod-anbox (it is in the chaotic-aur for Garuda users),**(Anbox doesn't work with linux-lts) ]
    However, you could use any of the kernels from the above link and follow similar steps to install the kernel and the corresponding kernel header.
  1. To install the Xanmod kernel:
    sudo pacman -S linux-xanmod-anbox linux-xanmod-anbox-headers
    or
    To install the Zen Kernel:
    sudo pacman -S linux-zen linux-zen-headers
    or
    To install Linux-tkg-bmq:
    sudo pacman -S linux-tkg-bmq linux-tkg-bmq-headers
    or
    To install Linux-cacule:
    sudo pacman -S linux-cacule linux-cacule-headers

  2. Reboot and choose the patched kernel that you just installed

  3. Setting up Kernel Modules:

i) To enable module loading at boot(Kernel module - ArchWiki):
create a file inside /etc/modules-load.d/, which contains the lines:
(sudo nano /etc/modules-load.d/waydroid.conf)

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

ashmem_linux
binder_linux

(Save and exit)

ii) Load Modules(Kernel module - ArchWiki):
sudo modprobe -a binder-linux ashmem-linux
(Might not be necessary for some kernels)

iii) To enable creating mount point of binderfs at boot(systemd - ArchWiki):
create a file in /etc/tmpfiles.d/ with the content:
(sudo nano /etc/tmpfiles.d/waydroid.conf)

/etc/tmpfiles.d/waydroid.conf

d! /dev/binderfs 0755 root root

(Save and exit)

iv) Mount binderfs:
(mkdir(1) — Arch manual pages)
(mount(8) — Arch manual pages)

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

v) To enable mounting binderfs at 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

:point_down:

There is a anbox-support package(For Garuda Users) which pulls dependencies, sets the required configs in place and gives instructions how to complete the setup (/etc/fstab for example needs to be edited manually).

vi) Now to check the required modules are loaded and mounted automatically on boot, run:
sudo ls -1 /dev/{ashmem,binderfs}

It should give a somewhat similar output (depending on the kernel being used, I use linux-cacule btw):

❯ sudo ls -1 /dev/{ashmem,binderfs}

/dev/ashmem

/dev/binderfs:
anbox-binder
anbox-hwbinder
anbox-vndbinder
binder
binder-control
features
hwbinder
vndbinder

5) Wayland
Waydroid only works in a Wayland session manager, so make sure you are in a Wayland session.
Note that even if you are in X11, many Wayland session manager supports nested session (so you can run it inside your X11 session), the simplest example is weston.

6) Setting up Waydroid:

  • Install Waydroid (available in chaotic-aur for Garuda users):
sudo pacman -Syu waydroid && sudo waydroid init 
  • After installing, you will want to start the waydroid-container service
sudo systemctl start waydroid-container
  • Then launch waydroid container:
sudo waydroid container start
  • And launch the session:
waydroid session start
  • Then launch the waydroid app in full UI mode by running the Waydroid app in the app drawer, or through the terminal:
waydroid show-full-ui
  • For network in your Waydroid container:
    Please check this out:
    Network in Waydroid

  • Install an application:

waydroid app install $path_to_apk

Happy New Year 2022!
:partying_face: :confetti_ball:

5 Likes

Does the guidance on the Arch wiki page not work?

https://wiki.archlinux.org/title/Waydroid

Some instructions are lacking in the Arch wiki, specifically regarding the automatic mounting of binderfs on boot, which is where most people get stuck.

Rest, everything is well documented in the Arch wiki

Thank you, @Austin, Have you tested this procedure, and what were your personal results? Any further hints?

Feliz Ano Nuevo!

1 Like

Happy New Year @c00ter!

I have well tested this procedure, and I have covered every issue I was facing while doing so, and I have Waydroid up and running:

2 Likes

I am able to launch waydroid fine, but it will not connect to wifi. Wifi is disabled by default and enabling it in settings does nothing, then after a little bit disables itself again.

I'm not sure where I can find logs for this or see the reason. I ran the ufw commands in the arch wiki, but I'm not sure they did anything. Is ufw the firewall Garuda (KDE Dragonized) uses?

Well, ufw is a tool for managing firewalls, and there are other tools as well,

for example, firewalld, which is I think is the default one for Garuda.

In the Arch wiki, they have taken ufw as an example:

Taking ufw as an example:

  • Dns traffic needs to be allowed:
    • # ufw allow 67
    • # ufw allow 53
  • Packet forwarding needs to be allowed:
    • # ufw default allow FORWARD

If you know the firewalld equivalent of the above, you can apply them or switch from firewalld to ufw:

or

sudo pacman -Rns firewalld
sudo pacman -S ufw
sudo ufw enable

If someone knows the equivalent of firewalld of the above instructions, please do share it in this thread

I hope the solves the issue.

Recently Waydroid has started to freeze the entire system on running it and I have to do a force reboot.

Is anyone else facing this issue?

My logs:

(493643) [09:06:06] % mkdir -p /var/lib/waydroid/lxc/waydroid
(493643) [09:06:06] % cp -fpr /usr/lib/waydroid/data/configs/config_2 /var/lib/waydroid/lxc/waydroid/config
(493643) [09:06:06] % sed -i s/LXCARCH/x86_64/ /var/lib/waydroid/lxc/waydroid/config
(493643) [09:06:06] % mv /var/lib/waydroid/config_nodes /var/lib/waydroid/lxc/waydroid
(499570) [09:08:10] % chmod 666 -R /dev/binder
(499570) [09:08:10] % chmod 666 -R /dev/vndbinder
(499570) [09:08:10] % chmod 666 -R /dev/hwbinder
(499570) [09:08:10] Container manager is waiting for session to load
(499594) [09:08:24] Starting waydroid session
(499594) [09:08:24] Save session config: /var/lib/waydroid/session.cfg
(499594) [09:08:24] UserMonitor service is not even started
(499594) [09:08:24] Clipboard service is not even started
(499594) [09:10:05] waydroidusermonitor: Received transaction: 1
(499594) [09:10:05] Android with user 0 is ready
(000581) [09:13:18] % mkdir -p /dev/binderfs
(000581) [09:13:18] % mount -t binder binder /dev/binderfs
(000581) [09:13:18] % ln -s /dev/binderfs/anbox-hwbinder /dev/binderfs/anbox-vndbinder /dev/binderfs/anbox-binder /dev/binderfs/features /dev/binderfs/vndbinder /dev/binderfs/hwbinder /dev/binderfs/binder /dev/binderfs/binder-control /dev/
(000581) [09:13:18] % chmod 666 -R /dev/binder
(000581) [09:13:18] % chmod 666 -R /dev/vndbinder
(000581) [09:13:18] % chmod 666 -R /dev/hwbinder
(000581) [09:13:18] Found session config on state: RUNNING, restart session
(000581) [09:13:18] Container manager is waiting for session to load
(033944) [09:21:03] % tail -n 60 -F /var/lib/waydroid/waydroid.log
(033944) [09:21:03] *** output passed to waydroid stdout, not to this log ***

hi im getting this eror while trying to start waydroid container saying
XDG session is not wayland. how do i change my session to wayland? im on garuda cinnamon edition. tnx in advance.

I think cinnamon doesn't currently support, you would have to use kde or gnome.

Check out weston

ok tnx ima try weston

i couldn't get it working can you tell me what version of garuda your in?

There is no versioning of Garuda, it's a rolling distro

I will check it when I get time

i meant are you using kde or xfce what desktop enviroment are you using soory for bothering you.

1 Like

I am using KDE, which already has a Wayland session.

When you get this error first ensure this command is already running on a different tab of the terminal sudo waydroid container start. Then on your current tab fire up Weston, then at the top left side of the Weston window you'll see an icon to launch a terminal within Weston. So go ahead and launch and type this command, kwin_wayland "waydroid session start" Now here's a tip, just let the command simmer for around 10 mins, so that the droid can come to life. I should mention I have tried this on Garuda KDE. Cheers!