Anbox should be started, displaying and populating the session-manager
What's the current behaviour?
Anbox tries to start at first, but eventually fails, giving the following error message: "[daemon.cpp:61@Run] [org.freedesktop.DBus.Error.ServiceUnknown] The name org.anbox was not provided by any .service files"
How to reproduce your issue?
Install the postmarketos-anbox meta-package from the repository
Start the anbox-container-manager service
Run anbox-launch from the terminal, which results in the above dbus error
alternatively Run anbox session-manager, which results in a segfault
What device are you using?
pine64-pinephone
On what postmarketOS version did you encounter the issue?
What's the build date of the image? (in yyyy-mm-dd format)
2021-05-13
Additional information
The wiki stated that, according to my error message, dbus isn't started or properly configured properly. "ps ax | grep -i dbus" shows that dbus is indeed running, so it must be a configuration issue. I followed #458 (closed). DBus is running and both XDG_RUNTIME_DIR and DBUS_SESSION_BUS_ADDRESS are indeed set. (I had to install dbus-x11 to run dbus-launch). Not sure what else to do...
Some facts:
"rc-service anbox-container-manager status" shows the container manager is started
the container itself isn't running, however - anbox session-manager segfaults, anbox-launch gives the above error, adb shell shows no devices
/var/lib/anbox/logs/ is completely empty
Any thoughts?
3 of 9 checklist items completed
· Edited
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Child items ...
Show closed items
Linked items 0
Link issues together to show that they're related.
Learn more.
Good to know, thanks for the datapoint, @afontain!
Given that you contributed most of anbox to pmOS/alpine, and we have quite the detailed bug report here, can you give @baconicsynergy any pointers how to debug this further?
What's the segfault message you get when launching anbox session-manager exactly?
I'll update the wiki page a bit. When anbox says "[daemon.cpp:61@Run]
[org.freedesktop.DBus.Error.ServiceUnknown] The name org.anbox was not
provided by any .service files", it really means the session-manager
crashed.
I can reproduce the issue on phosh. I get the following:
[ 2021-05-22 12:25:47] [client.cpp:48@start] Failed to start container: Failed to start container: Failed to set config item lxc.apparmor.profile[ 2021-05-22 12:25:47] [session_manager.cpp:164@operator()] Lost connection to container manager, terminating.[ 2021-05-22 12:25:47] [daemon.cpp:61@Run] Container is not running[ 2021-05-22 12:25:48] [session_manager.cpp:164@operator()] Lost connection to container manager, terminating.Stack trace (most recent call last) in thread 4333:#6 Object "0xffff8377fbab <???+0> at /lib/ld-musl-aarch64.so.1", at 0xffff8377fbab, in#5 Object "0xffff83078bc3 <???+0> at /usr/lib/libstdc++.so.6", at 0xffff83078bc3, in#4 Object "0xaaaab1541a0b <???+0> at /usr/bin/anbox", at 0xaaaab1541a0b, in#3 Object "0xaaaab150e6ef <_ZN5boost4asio6detail9scheduler10do_run_oneERNS1_27conditionally_enabled_mutex11scoped_lockERNS1_21scheduler_thread_infoERKNS_6system10error_codeE+347> at /usr/bin/anbox", at 0xaaaab150e6ef, in#2 Object "0xaaaab155836b <_ZN5boost4asio6detail23reactive_socket_recv_opINS0_17mutable_buffers_1ESt8functionIFvRKNS_6system10error_codeEmEENS0_15any_io_executorEE11do_completeEPvPNS1_19scheduler_operationES8_m+143> at /usr/bin/anbox", at 0xaaaab155836b, in#1 Object "0xaaaab15580ab <_ZN5boost4asio6detail7binder2ISt8functionIFvRKNS_6system10error_codeEmEES5_mEclEv+63> at /usr/bin/anbox", at 0xaaaab15580ab, in#0 Object "0xaaaab150932c <???+0> at /usr/bin/anbox", at 0xaaaab150932c, inSegmentation fault
Can you try to enable apparmor in the kernel config and test again?
« Failed to start container: Failed to set config item
lxc.apparmor.profile » suggests that's what you are missing.
How does one enable apparmor? I'm confused as to why it's disabled if Anbox needs it, especially if it worked before. That must mean it used to be enabled, right?
Hmm... how would I run lxc config set $CONTAINER raw.lxc "lxc.apparmor.profile=unconfined" on the Anbox container? It looks like it's the only way to solve the problem.
You will be compiling kernel, so doing it at phone isn't good idea at all, you need POWER AND SPEEEEED.
First you need to know which kernel are you running - I see your device is pine64-pinephone so you are running linux-postmarketos-allwinner on aarch64 architecture (you can learn it by looking at device package)
Then in menu you need to find apparmor suppport - the easiest way is to use / key to search and then selecting the option interesting you by number key.
eg. in this example apparmor support seem to be on second place with (2) number:
When you click 2 key on your keyboard it will magically teleport you to that option in menuconfig.
Enable it by pressing space until it's * as we want it to be built-in:
Select "Save" button using right-left arrows and confirm saving using enter key. Default name is the one you want to use. Accept confirmation and select exit as long as you are still in menu - you want to quit whole menuconfig now.
Now pmbootstrap should modify kernel package for you, checksum new config and blablabla.
It's still complaining about apparmor. I'll get you a log, but I have to rebuild the kernel because I ran the update command on my phone and it overwrote the kernel with the stock one. And my computer is slow so it takes a little bit to compile.
Okay, so running anbox-launch gives this:
[ 2021-07-13 00:50:37] [daemon.cpp:61@Run] [org.freedesktop.DBus.Error.ServiceUnknown] The name org.anbox was not provided by any .service files
And then running anbox session-manager gives this:
[ 2021-07-13 00:52:39] [client.cpp:48@start] Failed to start container: Failed to start container: Failed to set config item lxc.apparmor.profile
And in /var/lib/anbox/logs/container.log, is this:
lxc 20210713004946.850 ERROR confile - confile.c:set_config_apparmor_profile:1459 - Invalid argument - Built without AppArmor supportlxc 20210713004947.647 TRACE commands - commands.c:lxc_cmd:511 - Connection refused - Command "get_state" failed to connect command socketlxc 20210713005239.545 ERROR confile - confile.c:set_config_apparmor_profile:1459 - Invalid argument - Built without AppArmor supportlxc 20210713005239.439 TRACE commands - commands.c:lxc_cmd:511 - Connection refused - Command "get_state" failed to connect command socketlxc 20210713005534.340 ERROR confile - confile.c:set_config_apparmor_profile:1459 - Invalid argument - Built without AppArmor supportlxc 20210713005534.769 TRACE commands - commands.c:lxc_cmd:511 - Connection refused - Command "get_state" failed to connect command socket
I also did check to make sure the kernel edit worked.
pinephone:~$ cat config | grep APPARMORCONFIG_SECURITY_APPARMOR=yCONFIG_SECURITY_APPARMOR_HASH=yCONFIG_SECURITY_APPARMOR_HASH_DEFAULT=y# CONFIG_SECURITY_APPARMOR_DEBUG is not setCONFIG_DEFAULT_SECURITY_APPARMOR=y
Oh, so basically now we have lxc compiled without apparmor support and still there's no evidence the lack of apparmor is a problem which makes anbox segfault. Please try running session-manager through gdb or at least strace.
I suppose this isn't surprising, but the log is really long. I tried to use gdb but it didn't seem to be able to recognise "anbox session-manager" as a single command.
anbox.strace.err.log