New Post: Anbox on the Librem 5

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

You’re expected to download a deb package from there (https://source.puri.sm/Librem5/debs/anbox/-/jobs/364593/artifacts/file/debian/output/anbox_0.0~git20210625-1pureos0+librem5ci70654.0afc1e8_arm64.deb). The repository’s README comes from upstream project and isn’t relevant to this package (you’re not expected to follow it and you’ll miss some important patches if you do).

1 Like

well that’s good …I could not find the link to the deb before… the container-manager can run and I have a icon which will give me a while screen for a while before exiting… so when I ran it from a shell to get more data it said [daemon.cpp:61@Run] [org.freedesktop.DBus.Error.ServiceUnknown] The name org.anbox was not provided by any .service files … so then since I see the container manager service is running I tried this…

$ /usr/local/bin/anbox session-manager
[ 2022-03-03 07:56:32] [Renderer.cpp:104@initialize] Failed to initialize EGL
[ 2022-03-03 07:56:34] [client.cpp:
48@start] Failed to start container: Failed to start container: Failed to create node for device /dev/tun: Operation not permitted
[ 2022-03-03 07:56:34] [session_manager.cpp:164@operator()] Lost connection to container manager, terminating.
[ 2022-03-03 07:56:34] [daemon.cpp:61@Run] Container is not running
[ 2022-03-03 07:56:34] [session_manager.cpp:164@operator()] Lost connection to container manager, terminating.
Stack trace (most recent call last) in thread 2854:
but I can see I have no anbox-session-manager.service… only the anbox-container-manager.service…

copying and enabling the service of course still gave No runtime directory specified I saw it mentioned adding a variable would set that… so I tried…

Environment=“XDG_RUNTIME_DIR=/run/user/$(id -u)”
Environment=“DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus”
ExecStart=/usr/bin/anbox session-manager

which just changed the error from No runtime directory specified to Failed to initialize SDL: x11 not available

any idea what could be missing to allow the anbox-session-manager.service to work?

If I have not forgot something, that all services and stuff has been in place and after unpacking image in /usr/share/anbox I have to start the service (in the fact LXC setup)
sudo systemctl start anbox-container-manager
and then run graphics icon for Anbox and after longer time when ART recompiles Dalvik packages and libraries into AArch64 native code I have Android home screen running with icons for applications. Calculator and even F-droid has been working. If you do not succeed I can try to debug more my setup and we can compare the logs.

But Librem 5 is on hold for me now, we are switching course to our RISC-V simulator and that is heavy work. We have over gigabyte of data to process from our ESA project. As for the GNSS, the Eltvor board (on which production my company cooperated) for ESA with space grade FPGA which can be base for future GNSS satellites signal generation has been bring up by Marek Peca. As for Librem 5 GNSS, my colleague does not dare to replace 201 components (he has experience with 403 soldering and considers risk to damage board when 201 are used too high) so I am in negotiation with company producing ESA and other our professional stuff to do the correction and I pay for it from company budget. It is great that Purism provided components placements thanks to @dcz help but even that Marek is a person who is able to start any Gallileo satellite signal generation even on his home equipment (if I do not count his option to use real satellite test-bed at ESA) we still do not know what was Purism intention with antenna and no response for another questions about warranty etc. has arrived… So I pay for repair according some changes which have not been not described etc. and about which person working on future of Galileo has doubts that are correct.

And no response to warranty questions either. I understand that it is problematic… but silence is worst of possible replies.

Sorry but I am still lost… how does the anbox-session-manager.service get started?
my container starts but
all I can get from session manager is either No runtime directory specified or Failed to initialize SDL: x11 not available (if I add the previous environment variables I mentioned)

Why do you try to run anbox-session-manager? The only service that needs to run is anbox-container-manager, then the Anbox launcher icon (which runs anbox launch --package=org.anbox.appmgr --component=org.anbox.appmgr.AppViewActivity) should work, provided that everything is configured properly (which it should be if you installed the deb package and put the image into correct place).

1 Like

all I get is a white screen for a while if I try the gui icon (provided the container is running) I tried both a image from 2017 I found, and also one I built myself and they only showed white… and then exited so I figured the anbox-session-manager was likely to be what was missing

White? Are you sure you’re using the packaged version, and not some leftovers from when you tried to make install it?

strange… I did the make uninstall…and then installed the .deb file and it showed a white screen for a minute or two before exiting … I did it again and found some things left over… now when it launched it after a install from the .deb … it had a doid logo on a white screen saying it was starting up… then it exited (so almost the same… Adroid logo withStarting … but on a white screen)

wait I stopped the service again and restarted it… now it works

1 Like