Anbox for Debian
#1
Following on from this post, here's a recap and some extra info.

Install the anbox modules:  [ Edit: No longer required from kernel 5.7 so read this post ]

Code:
sudo apt install dkms
git clone https://github.com/anbox/anbox-modules
cd anbox-modules
sudo cp anbox.conf /etc/modules-load.d/
sudo cp 99-anbox.rules /lib/udev/rules.d/
sudo cp -rT ashmem /usr/src/anbox-ashmem-1
sudo cp -rT binder /usr/src/anbox-binder-1
sudo dkms install anbox-ashmem/1
sudo dkms install anbox-binder/1

Download anbox-image-working.tar.gz from here - extract android.img and ignore the other files.

Code:
sudo apt install anbox android-tools-adb
sudo cp android.img /var/lib/anbox/

Get the services and frontend started:

Code:
sudo systemctl start anbox-container-manager.service
systemctl --user start anbox-session-manager.service
anbox launch --package=org.anbox.appmgr --component=org.anbox.appmgr.AppViewActivity

Download an app and install it, eg bbc news app

Code:
adb install InsertAppName.apk

App loads but no internet? The below should help once the kernel supports ip routing:

Code:
sudo /usr/share/anbox/anbox-shell.sh
su
ip route add default dev eth0 via 192.168.250.1
ip rule add pref 32766 table main
ip rule add pref 32767 table local

You may want to modify the android image, e.g. to support the microg app suite as discussed here. Someone has already provided a patched services.jar - download it from here. Following instructions are taken from here.

Uncompress filesystem:

Code:
sudo apt install squashfs-tools
mkdir ~/anbox-work
cd ~/anbox-work
cp /var/lib/anbox//android.img .
sudo unsquashfs android.img

Copy over patched file:

Code:
sudo cp ./services.jar ~/anbox-work/squashfs-root/system/framework/
cd ~/anbox-work/squashfs-root/system/framework/
sudo chown -R 100000:100000 services.jar

Recompress to image:

Code:
cd ~/anbox-work
rm android.img
sudo mksquashfs squashfs-root android.img -b 131072 -comp xz
sudo cp android.img /var/lib/anbox/

I haven't found any use for it but the microg self-test says it works.

.jpg   anbox-microg.jpg (Size: 48.79 KB / Downloads: 965)

Okay, that should be about it - except sound might not work. See this discussion but the media xml files are present in this image so maybe it's a permission issue. Anyway, have a play with it and see whether it works for you.
#2
great stuff! would this procedure work in ubuntu touch? ubuntu is based on debian right?
#3
For what i know, i dont think it will work on ubports as the root filesystem is read only.
#4
(05-11-2020, 12:09 AM)vanja Wrote: would this procedure work in ubuntu touch?

Only some devices appear to be supported according to their docs.

Edit: It looks like the modules are missing and they don't supply kernel headers to build them yourself. I guess you could ask on their forum to implement it in the next release.
#5
(05-11-2020, 05:40 AM)nas Wrote:
(05-11-2020, 12:09 AM)vanja Wrote: would this procedure work in ubuntu touch?

Only some devices appear to be supported according to their docs.

Edit: It looks like the modules are missing and they don't supply kernel headers to build them yourself. I guess you could ask on their forum to implement it in the next release.

forget ubuntu, I installed debian to emmc Smile
works great!
also, installed anbox, it works, but it's not really usable, tried few apps, they either crash once started or fail to install with:
failed to install *.apk: Failure [INSTALL_FAILED_NO_MATCHING_ABIS: Failed to extract native libraries, res=-113]

all these apps run without google services, as I'm using them on my daily driver LineageOS without gapps or microg, just clean android.

really hope this anbox would become more stable with time, as I'm dependent on some android apps in order to go to pinephone as daily driver (don't care about camera, battery life, those can be survived Smile
I would even consider running android in a virtual machine on top of mobian if there was such option Smile

anyway, thanks for the great work!

p.s. how can I update anbox to latest version? which of the commands to re-execute? thx
#6
should anbox be preinstalled on mobian?? @a-wai what do you think? or maybe at least the kernel modules...
#7
There are no plans to include anbox by default for now, this is not mature enough atm.
#8
I'm getting various errors with this. One class of "general" problems seems to be solved when I manually applied permissions to the generated device files. The udev rules for some reason did not seem to apply. Even after I manually ran 'udevadm control --reload-rules' . I can manually chmod as root, but the device files /dev/ashmem and /dev/binder are generated with 600 permissions.

I guess that those are the default permissions and the udev rules don't apply for some reason.

$ cat /lib/udev/rules.d/60-anbox-modules-dkms.rules
KERNEL=="ashmem", NAME="%k", MODE="0666"
KERNEL=="binder*", NAME="%k", MODE="0666"
#9
(05-30-2020, 08:53 AM)tzafrir Wrote: I'm getting various errors with this. One class of "general" problems seems to be solved when I manually applied permissions to the generated device files.

Did you check the modules load properly as described here? Also, which distro are you running?
#10
I believe that if the modules were not loaded, those device files were not created. But I did verify that. I'm using Debian Bullseye (mobian).

The modules I built with dkms are the only ones with that name under /lib/modules , so there's no mixup with a module of another source.

Note that I used the existing debian/ directory in that git repository to build a deb package and installed it.

debian@pinephone:~$ /sbin/lsmod | grep _linux
binder_linux 81920 0
ashmem_linux 20480 0
debian@pinephone:~$ ls -l /dev/binder /dev/ashmem
crw------- 1 root root 10, 62 May 31 09:09 /dev/ashmem
crw------- 1 root root 511, 0 May 31 09:09 /dev/binder

Using the following rules file seems to do the trick:

DEVPATH=="*/ashmem", MODE="0666"
DEVPATH=="*/binder*", MODE="0666"


Possibly Related Threads…
Thread Author Replies Views Last Post
  atinout binaries for mobian/debian? NeutralGrey 4 1,326 10-31-2024, 04:16 AM
Last Post: astylethargic
  Problem with updates: Repository 'Debian bookworm' changed its 'non-free component' Anna 7 5,295 08-31-2023, 12:38 PM
Last Post: vusra
  Debian bookworm security repo user641 2 2,124 02-17-2023, 01:12 AM
Last Post: user641
  Gnome-podcasts on Debian repos user641 4 3,744 02-06-2022, 04:58 AM
Last Post: jsch
  gnome podcasts on debian repo, dino-mobile user641 3 3,874 09-11-2021, 12:04 AM
Last Post: user641
  Best/easiest way to install minimal Debian on PinePhone? mcgee 6 6,603 07-18-2021, 09:35 AM
Last Post: swiley
  How does calls work in debian? temp0rary 4 4,998 05-31-2021, 10:44 AM
Last Post: temp0rary
  Whatsapp in Anbox scott_VYuCAbn3k1NFK 7 10,196 03-22-2021, 08:46 AM
Last Post: Skyrrd
  Debian/Mobian packaging help needed arno_nuehm 1 2,520 03-20-2021, 04:59 PM
Last Post: TRS-80
  Anbox apps listed in the launch screen mark1250 1 3,143 03-17-2021, 02:23 PM
Last Post: tvall

Forum Jump:


Users browsing this thread: 1 Guest(s)