Android Emulator on 4.1

Does anyone here successfully Anbox/Waydroid on qubes 4.1? Cant make it happen here.

I belief the answer you seek you can find through this link:
I’ve tried a couple of weeks ago without success this week I’ll try the below link.

Otherwise you could also look at alternatives.
https://alternativeto.net/software/anbox/?platform=linux

Hope it’s helpfull

2 Likes

I have already tried everything on that link and it doesnt work(anbox), when i try to start a debian-11 appvm in HVM and kernel=none, it doesnt even boot so, cant open the terminal to install anbox. i appreciate if you could try to do it and pass the instructions on how you did it, thank you.

Well if was planning to try it again anyway and I have a couple of possible solution in mind.
I’m using Qubes-os for 1.5 year and it is my first experience with Linux, I’ve learned you can do pretty much the same as on a windows machine, I would be surprised if it wasn’t possible.
So I’ll give you a update within 3 day otherwise asap.

Ok, i made some other tests, created a standalone debian11 and installed

sudo apt install software-properties-common dkms linux-image-amd64 linux-headers-amd64 qubes-kernel-vm-support grub2 android-tools-adb anbox && sudo apt update && sudo apt upgrade && sudo grub-install /dev/xvda && sudo update-initramfs -u

then i download the anbox modules

git clone https://github.com/choff/anbox-modules

then i tried to install the modules using the script /anbox-modules/INSTALL.sh and it returned ashmem successfully installed but got an error when trying to install binder

thats my problem, without this i cant run anbox properly

x3

when i try to run anbox i get stucked on this screen:

and after some seconds the window get closed with this error in terminal:

just to complement, i have moved the android.img to /var/lib/anbox as required in whonix docs

when i check if anbox systemd service is functional. using: sudo systemctl status anbox-container-manager.service i receive this:

this damn binder_linux, is getting me crazy, someone give the light? thanks :smiley:

here is the make.log

DKMS make.log for anbox-binder-1 for kernel 5.10.104-3.fc32.qubes.x86_64 (x86_64)
Sat 23 Apr 2022 04:18:58 PM -03
make -C /lib/modules/5.10.104-3.fc32.qubes.x86_64/build V=0 M=$PWD
make[1]: Entering directory '/usr/lib/modules/5.10.104-3.fc32.qubes.x86_64/build'
  CC [M]  /var/lib/dkms/anbox-binder/1/build/deps.o
  CC [M]  /var/lib/dkms/anbox-binder/1/build/binder.o
/var/lib/dkms/anbox-binder/1/build/binder.c: In function ‘binder_update_page_range’:
/var/lib/dkms/anbox-binder/1/build/binder.c:633:19: error: ‘struct mm_struct’ has no member named ‘mmap_sem’; did you mean ‘mmap_base’?
  633 |   down_write(&mm->mmap_sem);
      |                   ^~~~~~~~
      |                   mmap_base
/var/lib/dkms/anbox-binder/1/build/binder.c:683:17: error: ‘struct mm_struct’ has no member named ‘mmap_sem’; did you mean ‘mmap_base’?
  683 |   up_write(&mm->mmap_sem);
      |                 ^~~~~~~~
      |                 mmap_base
/var/lib/dkms/anbox-binder/1/build/binder.c:710:17: error: ‘struct mm_struct’ has no member named ‘mmap_sem’; did you mean ‘mmap_base’?
  710 |   up_write(&mm->mmap_sem);
      |                 ^~~~~~~~
      |                 mmap_base
/var/lib/dkms/anbox-binder/1/build/binder.c: In function ‘binder_translate_binder’:
/var/lib/dkms/anbox-binder/1/build/binder.c:1626:42: error: passing argument 1 of ‘security_binder_transfer_binder’ from incompatible pointer type [-Werror=incompatible-pointer-types]
 1626 |  if (security_binder_transfer_binder(proc->tsk, target_proc->tsk))
      |                                      ~~~~^~~~~
      |                                          |
      |                                          struct task_struct *
In file included from /var/lib/dkms/anbox-binder/1/build/binder.c:48:
./include/linux/security.h:260:56: note: expected ‘const struct cred *’ but argument is of type ‘struct task_struct *’
  260 | int security_binder_transfer_binder(const struct cred *from,
      |                                     ~~~~~~~~~~~~~~~~~~~^~~~
/var/lib/dkms/anbox-binder/1/build/binder.c:1626:60: error: passing argument 2 of ‘security_binder_transfer_binder’ from incompatible pointer type [-Werror=incompatible-pointer-types]
 1626 |  if (security_binder_transfer_binder(proc->tsk, target_proc->tsk))
      |                                                 ~~~~~~~~~~~^~~~~
      |                                                            |
      |                                                            struct task_struct *
In file included from /var/lib/dkms/anbox-binder/1/build/binder.c:48:
./include/linux/security.h:261:28: note: expected ‘const struct cred *’ but argument is of type ‘struct task_struct *’
  261 |         const struct cred *to);
      |         ~~~~~~~~~~~~~~~~~~~^~
/var/lib/dkms/anbox-binder/1/build/binder.c: In function ‘binder_translate_handle’:
/var/lib/dkms/anbox-binder/1/build/binder.c:1668:42: error: passing argument 1 of ‘security_binder_transfer_binder’ from incompatible pointer type [-Werror=incompatible-pointer-types]
 1668 |  if (security_binder_transfer_binder(proc->tsk, target_proc->tsk))
      |                                      ~~~~^~~~~
      |                                          |
      |                                          struct task_struct *
In file included from /var/lib/dkms/anbox-binder/1/build/binder.c:48:
./include/linux/security.h:260:56: note: expected ‘const struct cred *’ but argument is of type ‘struct task_struct *’
  260 | int security_binder_transfer_binder(const struct cred *from,
      |                                     ~~~~~~~~~~~~~~~~~~~^~~~
/var/lib/dkms/anbox-binder/1/build/binder.c:1668:60: error: passing argument 2 of ‘security_binder_transfer_binder’ from incompatible pointer type [-Werror=incompatible-pointer-types]
 1668 |  if (security_binder_transfer_binder(proc->tsk, target_proc->tsk))
      |                                                 ~~~~~~~~~~~^~~~~
      |                                                            |
      |                                                            struct task_struct *
In file included from /var/lib/dkms/anbox-binder/1/build/binder.c:48:
./include/linux/security.h:261:28: note: expected ‘const struct cred *’ but argument is of type ‘struct task_struct *’
  261 |         const struct cred *to);
      |         ~~~~~~~~~~~~~~~~~~~^~
/var/lib/dkms/anbox-binder/1/build/binder.c: In function ‘binder_translate_fd’:
/var/lib/dkms/anbox-binder/1/build/binder.c:1740:42: error: passing argument 1 of ‘security_binder_transfer_file’ from incompatible pointer type [-Werror=incompatible-pointer-types]
 1740 |  ret = security_binder_transfer_file(proc->tsk, target_proc->tsk, file);
      |                                      ~~~~^~~~~
      |                                          |
      |                                          struct task_struct *
In file included from /var/lib/dkms/anbox-binder/1/build/binder.c:48:
./include/linux/security.h:262:54: note: expected ‘const struct cred *’ but argument is of type ‘struct task_struct *’
  262 | int security_binder_transfer_file(const struct cred *from,
      |                                   ~~~~~~~~~~~~~~~~~~~^~~~
/var/lib/dkms/anbox-binder/1/build/binder.c:1740:60: error: passing argument 2 of ‘security_binder_transfer_file’ from incompatible pointer type [-Werror=incompatible-pointer-types]
 1740 |  ret = security_binder_transfer_file(proc->tsk, target_proc->tsk, file);
      |                                                 ~~~~~~~~~~~^~~~~
      |                                                            |
      |                                                            struct task_struct *
In file included from /var/lib/dkms/anbox-binder/1/build/binder.c:48:
./include/linux/security.h:263:26: note: expected ‘const struct cred *’ but argument is of type ‘struct task_struct *’
  263 |       const struct cred *to, struct file *file);
      |       ~~~~~~~~~~~~~~~~~~~^~
/var/lib/dkms/anbox-binder/1/build/binder.c: In function ‘binder_transaction’:
/var/lib/dkms/anbox-binder/1/build/binder.c:1967:39: error: passing argument 1 of ‘security_binder_transaction’ from incompatible pointer type [-Werror=incompatible-pointer-types]
 1967 |   if (security_binder_transaction(proc->tsk,
      |                                   ~~~~^~~~~
      |                                       |
      |                                       struct task_struct *
In file included from /var/lib/dkms/anbox-binder/1/build/binder.c:48:
./include/linux/security.h:258:52: note: expected ‘const struct cred *’ but argument is of type ‘struct task_struct *’
  258 | int security_binder_transaction(const struct cred *from,
      |                                 ~~~~~~~~~~~~~~~~~~~^~~~
/var/lib/dkms/anbox-binder/1/build/binder.c:1968:18: error: passing argument 2 of ‘security_binder_transaction’ from incompatible pointer type [-Werror=incompatible-pointer-types]
 1968 |       target_proc->tsk) < 0) {
      |       ~~~~~~~~~~~^~~~~
      |                  |
      |                  struct task_struct *
In file included from /var/lib/dkms/anbox-binder/1/build/binder.c:48:
./include/linux/security.h:259:24: note: expected ‘const struct cred *’ but argument is of type ‘struct task_struct *’
  259 |     const struct cred *to);
      |     ~~~~~~~~~~~~~~~~~~~^~
/var/lib/dkms/anbox-binder/1/build/binder.c: In function ‘binder_ioctl_set_ctx_mgr’:
/var/lib/dkms/anbox-binder/1/build/binder.c:3262:44: error: passing argument 1 of ‘security_binder_set_context_mgr’ from incompatible pointer type [-Werror=incompatible-pointer-types]
 3262 |  ret = security_binder_set_context_mgr(proc->tsk);
      |                                        ~~~~^~~~~
      |                                            |
      |                                            struct task_struct *
In file included from /var/lib/dkms/anbox-binder/1/build/binder.c:48:
./include/linux/security.h:257:56: note: expected ‘const struct cred *’ but argument is of type ‘struct task_struct *’
  257 | int security_binder_set_context_mgr(const struct cred *mgr);
      |                                     ~~~~~~~~~~~~~~~~~~~^~~
cc1: some warnings being treated as errors
make[2]: *** [scripts/Makefile.build:280: /var/lib/dkms/anbox-binder/1/build/binder.o] Error 1
make[1]: *** [Makefile:1822: /var/lib/dkms/anbox-binder/1/build] Error 2
make[1]: Leaving directory '/usr/lib/modules/5.10.104-3.fc32.qubes.x86_64/build'
make: *** [Makefile:8: all] Error 2
1 Like

Building the modules should be unnecessary. I’m on R4.0 but the in-VM Debian kernel should be the same since it’s pulled from Debian 11 repos, not Qubes OS repos:

user@deb11hvm:~$ cat /etc/debian_version 
11.3

user@deb11hvm:~$ apt list --installed linux-image*
Listing... Done
linux-image-5.10.0-11-amd64/stable-security,now 5.10.92-2 amd64 [installed,auto-removable]
linux-image-5.10.0-12-amd64/stable-security,now 5.10.103-1 amd64 [installed,automatic]
linux-image-5.10.0-13-amd64/stable,now 5.10.106-1 amd64 [installed,automatic]
linux-image-amd64/stable,now 5.10.106-1 amd64 [installed]

user@deb11hvm:~$ find /lib/modules -name binder_linux.ko -o -name ashmem_linux.ko
/lib/modules/5.10.0-11-amd64/kernel/drivers/staging/android/ashmem_linux.ko
/lib/modules/5.10.0-11-amd64/kernel/drivers/android/binder_linux.ko
/lib/modules/5.10.0-12-amd64/kernel/drivers/staging/android/ashmem_linux.ko
/lib/modules/5.10.0-12-amd64/kernel/drivers/android/binder_linux.ko
/lib/modules/5.10.0-13-amd64/kernel/drivers/staging/android/ashmem_linux.ko
/lib/modules/5.10.0-13-amd64/kernel/drivers/android/binder_linux.ko

Make sure you’re doing the following for HVM qubes:

  1. Setting kernel to ‘(none)’
  2. Setting virtualization mode to ‘HVM’
  3. Excluding from memory balancing
  4. Supplying a decent amount of memory. On R4.0 I have no issue with the in-VM Debian 11 5.10.0-13 kernel and 400MB.

it worked here now i boot normal, the problem was that i didnt exclude from the memory balance.

let me try install anbox or/and waydroid to see what happens…

I’ve been trying the whole day and got stuck severale times on the anbox startup screen, I even tried to use docker which gave me the same result.
Glad to see you have it working, can you describe the steps that made it work for you?

just create a standalone vm without kernel and HVM mode and exclude it from memory balancing, but now im having another problem, waydroid is installed but i get stucked on this:

  1. started the container with sudo waydroid container start
  2. started the session with waydroid session start
    but android doesnt boot, if i check the status it shows that container and session is running but no wayland display, any idea how to fix it @icequbes1?

waydroid-logcat.log (259.2 KB)

i tried to enable wayland by editing /etc/gdm3/daemon.conf and uncomment “WayLandEnable=True” but no success too

I’ve followed these steps in order, I skipped the git clone GitHub - choff/anbox-modules: Anbox kernel modules part because @icequbes1 said it was unnecessary.
I still get the freeze starting screen from Anbox, am I missing a step?
I’m on QubesOs 4.1

  • sudo apt install software-properties-common dkms linux-image-amd64 linux-headers-amd64 qubes-kernel-vm-support grub2 android-tools-adb anbox && sudo apt update && sudo apt upgrade && sudo grub-install /dev/xvda && sudo update-initramfs -u
  • sudo modprobe ashmem_linux
  • sudo modprobe binder_linux
  • ls -1 /dev/{ashmem,binder}
  • apt list --installed linux-image*
  • anbox launch --package=org.anbox.appmgr --component=org.anbox.appmgr.AppViewActivity

user@cc:~$ sudo systemctl status anbox-container-manager.service

● anbox-container-manager.service - Anbox Container Manager
Loaded: loaded (/lib/systemd/system/anbox-container-manager.service; enabled; vendor preset: ena>
Active: inactive (dead)
Condition: start condition failed at Sun 2022-04-24 04:11:50 EDT; 6min ago
└─ ConditionPathExists=/var/lib/anbox/android.img was not met
Docs: man:anbox(1)

Apr 24 04:11:50 cc systemd[1]: Condition check resulted in Anbox Container Manager being skipped.

I got it working!
Thanks for the tips

For other people interested in the solution, the steps below worked for me.

create New qube
Name and label: anbox-qube
Type: Standalone VM
Template: debian
Networking: sys-firewall
Launch setting after creation

under tab Basic
I gave it 15 GB diskspace
under tab Advanced
/section/Memory/CPU
initial memory: 800 mb
VCPUs:
exclude in memory balancing (tick off the box)
/section/Kernel/
none
/section/Virtualization
Mode: HVM (current)
apply - ok

user@anboxqube:~$ sudo add-apt-repository ppa:morphis/anbox-support
enter
user@anboxqube:~$ sudo apt install software-properties-common
user@anboxqube:~$ sudo modprobe ashmem_linux
user@anboxqube:~$ sudo modprobe binder_linux
user@anboxqube:~$ ls -1 /dev/{ashmem,binder}
user@anboxqube:~$ snap install --devmode --beta anbox
user@anboxqube:~$ sudo apt update
user@anboxqube:~$ anbox launch --package=org.anbox.appmgr --component=org.anbox.appmgr.AppViewActivity

Good luck!

2 Likes

Hello, here is how i did it:

  1. Create a new qube StandAloneVM (Fully persistent) with Debian-11 template and check “Launch settings after creation”

01

  1. On Settings window, go to “Advanced”, uncheck “Include in memory balancing”, set your initial memory.
    2.1 On kernel, set it to (none).
    2.2 On Virtualization, set HVM.

  1. Run the vm, open the terminal to update the package list and upgrade the system to install adb, fastboot and anbox: sudo apt update && sudo apt full-upgrade && sudo apt install adb fastboot anbox

  2. Download the Anbox Android Image and the sha256sum file
    wget https://build.anbox.io/android-images/2018/07/19/android_amd64.img.sha256sum && wget https://build.anbox.io/android-images/2018/07/19/android_amd64.img

  1. Verify the image and move/rename to /var/lib/anbox/android.img

  1. Restart vm, open the terminal, check adb devices and start anbox, wait some seconds, if you have done eveything right, it will run fine.

adb devices && anbox launch --package=org.anbox.appmgr --component=org.anbox.appmgr.AppViewActivity

2 Likes

Depending on the kernel in your debian template, installation of the anbox drivers may be necessary.

1 Like

I see this thread has went the direction of Anbox.

After looking further into Waydroid, it runs under Wayland. Qubes OS uses X11.

It might be possible to run the weston compositor within a qube (e.g., nested under X11), start a shell within weston, and then run waydroid.