New Post: Anbox on the Librem 5

You’re not expected to install the kernel modules. README in the repository is upstream readme, not related specifically to Librem 5.

On byzantium, you need to use pureos/byzantium branch (which is now the default): https://source.puri.sm/Librem5/debs/anbox/-/tree/pureos/byzantium/ - take the deb artifacts from there.

Additionally the binaries in the CI pipeline appear to also be for amber singularly.

That’s not true, artifacts for byzantium are there as well: https://source.puri.sm/Librem5/debs/anbox/-/jobs/364593/artifacts/browse/debian/output/

Not sure why they’re not shown on the pipelines page, but once you select the job they’re available to download.

BTW. Anbox isn’t currently officially supported, this is just an experimental thing I’ve made working on the side. There are lots of rough edges there - it may work fine for your needs (it works fine for me with my banking app for example), but generally don’t expect a smooth experience.

7 Likes

Okay I will give this a shot. I couldn’t find those binaries for byzantium to save my life. Also, I’m under no impression that its going to be smooth. I just need a couple of things (like a banking app or signal) to emulate. If I get a working how to I’ll post it back here.

@dos Looks like there is a piece missing from this setup.

❯ anbox launch --package=org.anbox.appmgr --component=org.anbox.appmgr.AppViewActivity

[ 2021-10-05 16:36:16] [daemon.cpp:61@Run] [org.freedesktop.DBus.Error.ServiceUnknown] The name org.anbox was not provided by any .service files

❯ dbus-send --session --dest=org.anbox --type=method_call --print-reply /org/anbox org.freedesktop.DBus.Introspectable.Introspect

Error org.freedesktop.DBus.Error.ServiceUnknown: The name org.anbox was not provided by any .service files

Maybe if you have sometime soon you could update the instructions for a fresh install because there seems to be something missing from the current instructions?

Also, thank you for working on this. I know this isn’t officially supported but I appreciate you working on it. Got a place ($$) to support the work?

There is the fund-your-app initiative from Purism: https://puri.sm/fund-your-app/ It’s for apps and OS / driver optimizations so I think Anbox could fit there. However, it isn’t listed there (thought I have seen it there in the past…) but you could suggest it in the bottom form and donate. :slight_smile:

He may have posted this on purism site but I’ve been told by no less than 3 different people at the company that this is not officially supported. If they aren’t officially supporting it, I’d prefer to contribute directly.

1 Like

I just tried this, and managed to get the artifacts.zip. Following the wiki, I run into problems with the anbox-image-builder. Running ./build.sh --sudo fails with the message that gcc-multilib has no install candidate.

Any ideas?

Did you try to follow this guide? It’s probably more recent: https://source.puri.sm/Librem5/community-wiki/-/wikis/Frequently-Asked-Questions#314-how-are-android-apps-installed-in-the-librem-5.

Yes, I did. In the step where I need to make an image, by running the script:

cd anbox-image-builder
./build.sh --sudo
./assemble.sh

The build.sh fails with the message:

Package gcc-multilib is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package ‘gcc-multilib’ has no installation candidate

2 Likes

I hope it is not an empty post, when I confirm the problem of @soemraws on my Librem 5 Evergreen. I already tried to install anbox once two weeks ago and deinstalled all that day installed packages due to failure and the message that the system is unable to locate the following libraries:

  • g++-multilib
  • libc6-dev-i386
  • lib32ncurses5-dev
  • lib32z-dev

Trying to install gcc-multilib results in the same error as reported by @soemraws. I must also confess that I don’t understand why an i386 and 32bit libraries are required to build an application for an arm64 processor. The system has already libc6-dev installed, so does anybody know why this library is not used to build anbox?

It seems that you are trying to install Intel x86 binary, environment, Anbox on Librem 5 which is ARM AArch64/arm64 architecture system.

You need probably package-pureos-byzantium:amd64 pipeline artifacts, unzip them somewhere (actual Debian package file is anbox_0.0~git20210625-1pureos0+librem5ci70654.0afc1e8_arm64.deb , double check that ends by arm64.deb) on mobile and install by sudo dpkg -i anbox*

Disclaimer, I have not tested Anbox on my Librem 5 yet, but I am interested in others experience.

Thanks for your reply @ppisa. I already did what you have mentioned. And yes, the file you are talking about is in the folder as well as all files in this folder end by _arm64.deb. The problem arises, as mentioned by @soemraws, when the following command, according to the installation instructions, has to be run, i.e.

 ./build.sh --sudo

The error with gcc-multilib appears and the installation has to be aborted, because running the assembly script does not make sense. Interestingly, there is an Anbox icon on the display afterwards. Launching the app, however, does nothing, which is expected due to an incomplete installation.

When taking a look at build.sh, this script just launches docker and asks to run the script anbox-build.sh in the data folder. The latter initializes and addresses the platform_manifests.git, some patches, local manifests, and finally some environmental setup. This has, as far as I understand, nothing to do with the gcc compiler, which package g++-multilib seems to be the principal problem.

 ./build.sh --sudo

is not meant to be run on the phone. It is nonsense to install Docker on Librem 5 and attempt to build there Android image. It would take week and you would need to use some external USB-C (3) SSD because required space is 60 GiB. The whole internal capacity of Librem 5 is 32 GiB and it holds system etc… The build has to be run on reasonably powerful PC with Docker capabilities, may it be there are some chances on Windows or in its WSL2, but I do not use Windows for years and colleagues reported that their filesystem is really significantly slower for regular projects (large Qt etc…) compilation. Your post motivated me to start image build, it runs already for three hours on older but powerful 4 core i7 system remotely to not block me on my laptop and other local sytems and it seized 40 Gigabytes of the disk already.

Edit:
It seems that my build attempt has stuck on

[ 34% 11964/34508] target R.java/Manifest.java: Calendar (out/target/common/obj/APPS/Calendar_intermediates/src/R.stamp)
packages/apps/Calendar/res/values-ar-rXB/arrays.xml:0: warning: Resource file packages/apps/Calendar/res/values-ar-rXB/arrays.xml is skipped as pseudolocalization was done automatically.
packages/apps/Calendar/res/values-ar-rXB/strings.xml:0: warning: Resource file packages/apps/Calendar/res/values-ar-rXB/strings.xml is skipped as pseudolocalization was done automatically.
Warning: AndroidManifest.xml already defines minSdkVersion (in http://schemas.android.com/apk/res/android); using existing value in manifest.
Warning: AndroidManifest.xml already defines targetSdkVersion (in http://schemas.android.com/apk/res/android); using existing value in manifest.
[ 34% 11971/34508] build out/target/common/obj/JAVA_LIBRARIES/sdk_v19_intermediates/classes.jack

@ppisa, your comment would mean that the installation procedure for Anbox written in section 3.14 on Purism’s Librem 5 webpage is wrong (please see this link). There, it is suggested to install docker.io among others and then to run inside the anbox-image-builder the build script. There is no information that the procedure is not intended to be run on the Librem 5! However, if you are right, then the information on Purism’s Librem webpage is not correct and we are starting to go down into a rabbit hole :worried:

Considering your build, I admit that I have very limited experience in programming and programming languages. But are you sure that the warnings were the reason that the build has stuck? The lines are just saying that the adaptation of the program to different languages (pseudolocalization) has been done automatically and the min and target version of the software development kit have been already defined. Are there no errors before these lines with warnings or after which may point you to a more precise problem?

@Bogus, the first I am not expert for Android and I have no other connection to Purism than my support of their work by my money invested into Librem 5 development and I would consider that as a good investment even if I have not received Librem 5 (yet).

The instructions are remarks for experts and they would know what it means to build Android image. See official hardware-requirements and Establishing a Build Environment. They speak about fast build, 40 minutes, on 72 core system with 64 GiB RAM and 270 GiB of storage for actual Android open-source build. I have not expected from the first glimpse on Purism FAQ, that build should be done on the phone, that is based on my 30 years of experience with embedded systems development and cross builds. So excuse me, but I consider your unsuccessful attempts as your fault same for the mine where I should be able at least to provide precise bug report, but multiple builds fails in random way so it seems as resources problems of mine system which is incompatible/not capable for Google sources build etc…

If you are not programmer and expert then you can invest time to become one or you can pay somebody to do the work.

As for Anbox to be usable for ordinary Librem 5 users, it is necessary to have prebuild appropriate Android image. I have not noticed trace on Purism sites that it is provided somewhere. It can have multiple valid reasons, may it be providing image binary would require to provide full sources of exact build (may it be 20 GiBs for each) which would cost too much space/resources/even budget for Purism. May it be that it is not considered stable, may it be it is not considered ready and support of the unfinished feature means risk of load for which developers are not prepared. Purism offered Android compatibility as funded feature bonus for some level of crowdfunding campaign reached and if I know well, that funding has not been reached. So all this is good will and enthusiasm of Purism and others developers. And really, if you look at Android build size and complexity and in the fact system incompatibility with GNU/Linux principles then you understand that such blob can be fully managed by company of Google size and not by small enthusiast group as Purism still is. And I support much more their main goal to provide manageable alternative based on modular, GNU/Linux compatible solution where burden of support of the main components, kernel, Gtk, Gnome etc. can be shared between whole community playing real free (libre) software game (Purism, RedHat, Suse, Pegutronix, Linutronix atc…) and they can share benefits even for i.MX use in automotive, industrial etc. systems.

So excuse me for lengthy and amateur reply. Kudos to Sebastian Krzyszkowiak (@dos) that he managed to build and run Andbox experiment. He can provide qualified answer about build and (un)availability of corresponding Android image but I fully understand if he refrains to reply and focuses on more important topics and work from his and even mine perspective (probably most of us invested to Librem 5 to avoid Android and Google dependence and we now whine to not have option to reach golden jail again, yes it is simplified).

Edit: Andbox instructions to build image from Andbox (hopefully) development central repo:

It seems that Andbox community is under-powered to move on the never ASOP version, see https://github.com/anbox/anbox/issues/1783

And if you see complexity and versions incompatibility in the original Android code I am not surprised.

1 Like

I have done next changes during image build to proceed on less capable (4 cores x HT2, 8GiB RAM) machine:

  • limited top level make to not use parallel builds

anbox-image-builder/data/anbox-build.sh

+make -j1
-make -j9
  • extended memory used by JACK server, I have tried to do that some more clean way but it has not propagated to the server start commands, so I have taken big hammer solution

anbox-image-builder/anbox-work/prebuilts/sdk/tools/jack-admin
anbox-image-builder/anbox-work/out/host/linux-x86/bin/jack-admin

+JACK_SERVER_COMMAND="java -XX:MaxJavaStackTraceDepth=-1 -Xmx4g -Djava.io.tmpdir=$TMPDIR $JACK_SERVER_VM_ARGUMENTS -cp $LAUNCHER_JAR $LAUNCHER_NAME"
-JACK_SERVER_COMMAND="java -XX:MaxJavaStackTraceDepth=-1 -Djava.io.tmpdir=$TMPDIR $JACK_SERVER_VM_ARGUMENTS -cp $LAUNCHER_JAR $LAUNCHER_NAME"

Even in this setup build failed multiple times but when restarted then continued. It took something like 6 hours or more and 61GiB of storage on my remote computer at university. It seems to became really weak from Google’s perspective even that it drivers our open-design CAN bus projects https://canbus.pages.fel.cvut.cz/ and their continuous builds for our MZ_APO Xilinx Zynq based boards which run with automatically build bitstream and drivers testing to HW level each night when design, driver and or Vivado integration changes in repo.

anbox-container-manager is not enabled after Anbox install on Librem 5 directly. In the fact, I prefer it leave that way and I have started it for experiment manually

sudo -i systemctl start anbox-container-manager

Then Andbox runs and launcher with calc, Fdroid and others is show. Some simple applications run some not. The main problem seems to be that when the Android application is closed from posh the focus, activation is not transferred to another selected Android application. So it seems like screen of closed/deactivated application is only hidden but Android or some other problem that Android runtime does not detect its close and request to transfer the focus.

I am not sure how it is with licenses to share the android.img without the full source archives. I can send it though some file-sender service if somebody really wants it. But I think that for consumers only it has not big value yet and may it be something is broken more than usual because of multiple interruptions of the build.

So the result, Anbox runs on Librem 5, it seems that long term goal to run Android applications on GNU/Linux phones is doable but it requires lot of manpower/funding to be generally usable. Even more to move from Android version 7 up… There is hope that people from more communities join forces on mainline Anbox. I would be really happy if community moves more to Posh and may id be Anbox direction than to stuck on Google and chip-makers crippled kernels, libhybris and “open” Android builds…

I am leaving for friends cottage without Internet today so do not expect reply till Sunday and generally this experiment has low priority in my actual work…

Best wishes, strong heath and enjoy your lives in 2022,

Pavel

1 Like

Sorry I am trying this on byzantium 5.17.0-1-librem5 , and I am missing something… the make ; make install went fine, but there were no init scripts etc installed, or anything in /usr/share/anbox as I see referenced in some of the files… what am I missing for the final part of the install (aside from the android image )?

The anbox binary is something like virtual machine, game console emulator etc… and you need actual android user-space image/installation adapted for it. If you have looked three posts above yours you would know. I have build image I am not sure for sharing rules which can be somehow restricted by Google. But I expect that sharing is possible. I can send it over some filesender. But mine attempt is not much usable. If you want to dive into the project than you are probably capable to build yours. Mine build failed more times on limited build system resources and I have forced continuation. So may it be some problem is caused by that. May be focus and applications switching problem is on anbox binary side. May iy be you can manage some snap package from https://anbox.io/ to run on the Librem 5. The main repo of anbox seems to be stale https://github.com/anbox/anbox . May it be it worth to try https://waydro.id/ . There has been some discussion of this forum WayDroid (Wayland Android) on Linux Phones . I have generally interest to to have container to run android applications but I expect that it would require lot of work still. I have no time for such project as a hobby now. I would be happy to help with some knowledge…but time is limited and I have many useful, demanded, paid and still fully opensource things to do.

I have a image that I downloaded and I could probably build my own if needed… but I think I am only missing the parts to start the service as the imake install put most the parts in place and there were no missing dependancies etc. it’s just missing the parts to fire up… I know some people have this working so I am sure with a tiny bit more info I can get this running. I am a sysadmin who would help the project in any way I can, as I need my librem5 to run anbox to not require a another phone along side my librem 5. :slight_smile:

Which package are you trying to use?

I just followed along what I saw at https://source.puri.sm/Librem5/debs/anbox and solved dependencies to do a make and make install with no errors. but I noticed I could not start services because although it completed / installed without error… and some binaries were there …yet service files / config files and stuff mentioned to be in /usr/share/anbox were not there