How to Run Android Apps in Linux Without an Emulator

Got an error after installing Waydroid from the repo:

sudo waydroid init
ERROR: Binder node “binder” for waydroid not found

You should perhaps get in the habit of reading the comments on the package's AUR webpage before installing anything from an outside repo.

5 Likes

I think it is fixed upsteam if you what to build directly from there. Eg see:

2 Likes
  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, 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

ashmem_linux
binder_linux

(Save and exit)

ii) Load Modules: sudo modprobe -a binder-linux ashmem-linux
(You can skip this step for linux-tkg-bmq)

iii) To enable creating mount point of binderfs at boot, 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

(Save and exit)

iv) Mount binderfs:

  • 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
  1. To check modules status:
    sudo ls -1 /dev/{ashmem,binderfs}

This should work here.

Waydroid still won't run:

 waydroid log
(041363) [16:05:40] UserMonitor service is not even started
(041363) [16:05:40] Clipboard service is not even started
(041449) [16:05:58] XDG Session is not "wayland"
(041449) [16:05:58] Save session config: /var/lib/waydroid/session.cfg
(041449) [16:05:58] UserMonitor service is not even started
(041449) [16:05:58] Clipboard service is not even started
(041449) [16:06:46] UserMonitor service is not even started
(041449) [16:06:46] Clipboard service is not even started
(041607) [16:06:49] Starting waydroid session
(041607) [16:06:49] XDG Session is not "wayland"
(041607) [16:06:49] Save session config: /var/lib/waydroid/session.cfg
(041607) [16:06:49] UserMonitor service is not even started
(041607) [16:06:49] Clipboard service is not even started
(041607) [16:07:00] UserMonitor service is not even started
(041607) [16:07:00] Clipboard service is not even started
(041715) [16:07:08] % tail -n 60 -F /var/lib/waydroid/waydroid.log
(041715) [16:07:08] *** output passed to waydroid stdout, not to this log ***
(000556) [16:09:29] WayDroid container is 
(000627) [16:09:30] % sudo lxc-stop -P /var/lib/waydroid/lxc -n waydroid -k
lxc-stop: waydroid: tools/lxc_stop.c: main: 170 waydroid is not running
(000627) [16:09:30] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
(000627) [16:09:30] NOTE: The failed command's output is above the ^^^ line in the log file: /var/lib/waydroid/waydroid.log
(000627) [16:09:30] ERROR: Command failed: % sudo lxc-stop -P /var/lib/waydroid/lxc -n waydroid -k
(000627) [16:09:30] See also: <https://github.com/waydroid>
(000627) [16:09:30] Traceback (most recent call last):
  File "/usr/lib/waydroid/tools/__init__.py", line 66, in main
    actions.container_manager.stop(args)
  File "/usr/lib/waydroid/tools/actions/container_manager.py", line 185, in stop
    helpers.lxc.stop(args)
  File "/usr/lib/waydroid/tools/helpers/lxc.py", line 240, in stop
    tools.helpers.run.root(args, command)
  File "/usr/lib/waydroid/tools/helpers/run.py", line 77, in root
    return user(args, cmd, working_dir, output, output_return, check, env,
  File "/usr/lib/waydroid/tools/helpers/run.py", line 58, in user
    return tools.helpers.run_core.core(args, msg, cmd, working_dir, output,
  File "/usr/lib/waydroid/tools/helpers/run_core.py", line 343, in core
    check_return_code(args, code, log_message)
  File "/usr/lib/waydroid/tools/helpers/run_core.py", line 219, in check_return_code
    raise RuntimeError("Command failed: " + log_message)
RuntimeError: Command failed: % sudo lxc-stop -P /var/lib/waydroid/lxc -n waydroid -k

(000634) [16:09:30] WayDroid session is not started
(015470) [16:12:46] Already initialized
(016589) [16:13:15] XDG Session is not "wayland"
(016589) [16:13:15] Save session config: /var/lib/waydroid/session.cfg
(016589) [16:13:15] UserMonitor service is not even started
(016589) [16:13:15] Clipboard service is not even started
(016589) [16:13:37] UserMonitor service is not even started
(016589) [16:13:37] Clipboard service is not even started
(017572) [16:13:42] Starting waydroid session
(017572) [16:13:42] XDG Session is not "wayland"
(017572) [16:13:42] Save session config: /var/lib/waydroid/session.cfg
(017572) [16:13:42] UserMonitor service is not even started
(017572) [16:13:42] Clipboard service is not even started
(017572) [16:13:51] UserMonitor service is not even started
(017572) [16:13:51] Clipboard service is not even started
(018589) [16:14:04] % tail -n 60 -F /var/lib/waydroid/waydroid.log
(018589) [16:14:04] *** output passed to waydroid stdout, not to this log ***
(024396) [16:15:58] % tail -n 60 -F /var/lib/waydroid/waydroid.log
(024396) [16:15:58] *** output passed to waydroid stdout, not to this log ***

There are similar issues in its Github page, If someone is able to run it please let us know

Thank you

Has anyone been successfully running this with the linux-zen kernel? If so, what has been your experience using it so far?

Just curious how well it works.

1 Like

Use Wayland instead of Xorg?

I had been trying to run it through with Wayland for some time, it was not working at all, but unexpectedly, it worked yesterday. But again just after the reboot, it stopped working.

[🔴] × waydroid log
(035081) [08:34:02] See also: <https://github.com/waydroid>
(035081) [08:34:02] Traceback (most recent call last):
  File "/usr/lib/waydroid/tools/__init__.py", line 64, in main
    actions.container_manager.start(args)
  File "/usr/lib/waydroid/tools/actions/container_manager.py", line 160, in start
    raise OSError("container failed to start")
OSError: container failed to start

(036554) [08:34:05] WayDroid container is STOPPED
(036599) [08:34:08] % chmod 666 -R /dev/binder
(036599) [08:34:08] % chmod 666 -R /dev/vndbinder
(036599) [08:34:08] % chmod 666 -R /dev/hwbinder
(036599) [08:34:08] Container manager is waiting for session to load
(036599) [08:34:08] % /usr/lib/waydroid/data/scripts/waydroid-net.sh start
waydroid-net is already running
(036599) [08:34:08] % umount /var/lib/waydroid/rootfs/vendor/waydroid.prop
(036599) [08:34:08] % umount /var/lib/waydroid/rootfs/vendor
(036599) [08:34:08] % umount /var/lib/waydroid/rootfs
(036599) [08:34:08] % mount /usr/share/waydroid-extra/images/system.img /var/lib/waydroid/rootfs
(036599) [08:34:08] % mount -o remount,ro /usr/share/waydroid-extra/images/system.img /var/lib/waydroid/rootfs
(036599) [08:34:08] % mount /usr/share/waydroid-extra/images/vendor.img /var/lib/waydroid/rootfs/vendor
(036599) [08:34:09] % mount -o remount,ro /usr/share/waydroid-extra/images/vendor.img /var/lib/waydroid/rootfs/vendor
(036599) [08:34:09] % mount -o bind /var/lib/waydroid/waydroid.prop /var/lib/waydroid/rootfs/vendor/waydroid.prop
(036599) [08:34:09] % chmod 777 -R /dev/ashmem
(036599) [08:34:09] % chmod 777 -R /dev/dri
(036599) [08:34:09] % chmod 777 -R /dev/fb0
(036599) [08:34:09] % chmod 777 -R /dev/video1
(036599) [08:34:09] % chmod 777 -R /dev/video0
(036599) [08:34:09] % lxc-start -P /var/lib/waydroid/lxc -F -n waydroid -- /init
(036599) [08:34:09] New background process: pid=36641, output=background
lxc-start: waydroid: conf.c: mount_entry: 2247 No such file or directory - Failed to mount "tmpfs" on "/usr/lib/lxc/rootfs/mnt_extra"
lxc-start: waydroid: conf.c: lxc_setup: 4104 Failed to setup mount entries
lxc-start: waydroid: start.c: do_start: 1291 Failed to setup container "waydroid"
lxc-start: waydroid: sync.c: sync_wait: 36 An error occurred in another process (expected sequence number 3)
lxc-start: waydroid: start.c: __lxc_start: 2053 Failed to spawn container "waydroid"
lxc-start: waydroid: conf.c: run_buffer: 323 Script exited with status 126
lxc-start: waydroid: start.c: lxc_end: 996 Failed to run lxc.hook.post-stop for container "waydroid"
lxc-start: waydroid: tools/lxc_start.c: main: 308 The container failed to start
lxc-start: waydroid: tools/lxc_start.c: main: 313 Additional information can be obtained by setting the --logfile and --logpriority options
(036599) [08:34:09] waiting 10 seconds for container to start...
(036599) [08:34:10] waiting 9 seconds for container to start...
(036599) [08:34:11] waiting 8 seconds for container to start...
(036599) [08:34:12] waiting 7 seconds for container to start...
(036599) [08:34:13] waiting 6 seconds for container to start...
(036599) [08:34:14] waiting 5 seconds for container to start...
(036599) [08:34:15] waiting 4 seconds for container to start...
(036599) [08:34:16] waiting 3 seconds for container to start...
(036599) [08:34:17] waiting 2 seconds for container to start...
(036599) [08:34:18] waiting 1 seconds for container to start...
(036599) [08:34:19] ERROR: container failed to start
(036599) [08:34:19] See also: <https://github.com/waydroid>
(036599) [08:34:19] Traceback (most recent call last):
  File "/usr/lib/waydroid/tools/__init__.py", line 64, in main
    actions.container_manager.start(args)
  File "/usr/lib/waydroid/tools/actions/container_manager.py", line 160, in start
    raise OSError("container failed to start")
OSError: container failed to start

(038124) [08:34:35] % tail -n 60 -F /var/lib/waydroid/waydroid.log
(038124) [08:34:35] *** output passed to waydroid stdout, not to this log ***

I don't know what is causing it, but the container itself is not starting.

Probably this bit is worth looking into:

4 Likes

Looks like this issue here

1 Like

I was able to get Waydroid work on KDE Wayland. It was running smooth.

I followed the docs -

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

I installed it, I faced some problems running it, these helped me -

Everything was smooth, the browser is not that good from my experience.

2 Likes

Waydroid worked today after an update!

2 Likes

Dat beautiful Lineage :eyes:

3 Likes

1 Like

Is this KDE on Wayland?

1 Like

Yes, I am using KDE on Wayland. Till now the experience has been moreover like Xorg, though I had to do some tweaks to enable tap to click for my laptop's touchpad: https://www.reddit.com/r/kde/comments/a4i9fy/is_there_a_way_to_enable_taptoclick_on_wayland/

And I still have to figure out the touchpad gestures too.

You do not need to use the Wayland session to use Waydroid, simply installing weston, running it and then starting Waydroid does the trick :slight_smile: this also adds proper window buttons, so I'm happy :grin:

6 Likes