We have moved to a new Sailfish OS Forum. Please start new discussions there.
5

How to help debug android support

asked 2019-04-29 19:33:45 +0300

__rob__ gravatar image

Hi there,

I just made the jump to Sailfish OS X, got an XA2 Plus DualSIM... and got the SFOS on it. So far I'm very impressed with the quality of the OS. Having the Android support is handy for the missing apps and whatnot... but after a day of usage or maybe some of the apps I've tried to use (nothing fancy... Here wego maps, etc). It seems that the system is in a bad state and it is constantly restarting itself (dying and systemd restarting I guess).

I would like to know how to provide useful info to debug this and/or for myself to remove certain apps that are unsupported (not reported). I will try to start looking around /var/log with a proper ssh session. But if anybody has a link to a wiki or something it will be great.

Cheers,

__rob__

edit retag flag offensive close delete

2 Answers

Sort by » oldest newest most voted
14

answered 2019-04-29 22:49:20 +0300

DrYak gravatar image

updated 2019-05-31 21:49:20 +0300

LOGS

Please pay attention that Jolla's Sailfish OS is systemd-based, and (unlike most of your usuall GNU/Linux desktop distributions) has no logger deamon enabled.

Thus you'll find the /var/log directory mostly empty.

Instead, you'll need to use journalctl. journalctl --follow in an SSH terminal is a great way to get information about what's currently happening in the system, journalctl --since '20 min ago' is another example of something useful to quickly investigate what just happened.

Note again that (also unlike most of your usuall GNU/Linux desktops) journald persistence is completely turned off. So not only do you need to create a /var/log/journal directory, but you'll also need to edit /etc/systemd/journald.conf and change Storage=volatile to Storage=auto (or Storage=persist ) to have your log survive accross reboots.

Android

The android application compatibility layer Alien-Dalvik has changed a bit on the XA2 compared to older hardware.

Because Android 8.1 Oreo doesn't use a JVM-like dalvik JIT like the previous Android 4.4 Kitkat used before, Android application aren't isolated from the rest of Sailfish at the level of the Java VM. Instead, the whole AOSP userland runs inside an LXC container.

The container is aliendalvik, see in /var/lib/lxc/ (the AOSP system itself is stored in the read-only SqaushFS compressed image /opt/alien/system.img).

To enter inside the (already running) container :

lxc-attach -n aliendalvik -- /system/bin/sh

The various deamons that make the translation between the Sailfish OS host and the AlienDalvik should already output some useful information in the system-wide journald logs. (Mostly about missing APIs)

To get the Android's own specific logs, use the (libhybris specific) log from outside the container:

/system/bin/logcat

or

/usr/libexec/droid-hybris/system/bin/logcat

But this only display the Android kernel logs.

To get alien-dalvik's logs, you need to run logcat in the context of the (already running) LXC container:

lxc-attach -n aliendalvik --  /system/bin/logcat

or

lxc-attach -n aliendalvik -- /system/bin/sh
/system/bin/logcat

WARNING Unpacking system.img file with unsquashfs and then repacking it (as happens when either installing signature spoofing for microG or installing Google's official proprietary Play Services) does break some attributes inside system.img, and you'll get this error message:

logcat read failure

and journalctl log entries such as:

May 02 15:01:24 Sailfish init: starting service 'logd'...
May 02 15:01:24 Sailfish init: Created socket '/dev/socket/logd', mode 666, user 1036, group 1036
May 02 15:01:24 Sailfish init: Created socket '/dev/socket/logdr', mode 666, user 1036, group 1036
May 02 15:01:24 Sailfish init: property_set("ro.boottime.logd", "17627153292115") failed: property already set
May 02 15:01:24 Sailfish init: Created socket '/dev/socket/logdw', mode 222, user 1036, group 1036
May 02 15:01:24 Sailfish init: Opened file '/proc/kmsg', flags 0
May 02 15:01:24 Sailfish init: Opened file '/dev/kmsg', flags 1
May 02 15:01:24 Sailfish logd: failed to set CAP_SETGID, CAP_SYSLOG or CAP_AUDIT_CONTROL (1)
May 02 15:01:24 Sailfish init: Sending signal 9 to service 'logd' (pid 6141) process group...
May 02 15:01:24 Sailfish init: Successfully killed process cgroup uid 1036 pid 6141 in 0ms

Google Play Services

Lots of Android apps (anything more fancy than WhatsApp) will require Google's proprietary services to work successfully.

Basically, you have two ways:

  • Use a tool like opengapps to fetch and install Google's own proprietary service, the Play Store, etc.

    There should be some tutorials floating somewhere on this forum for XA2's 8.1 Pie

  • Use FDroid (a repository of opensource software), MicroG (an open source re-implementation of the proprietary server), Yalp (a client that can fetch APKs from the official Play Store) and FakeStore (for the few android APPs that will show error message when they don't see the official Play Store).

    See this thread and more specifically the docker tool mentionned in that answer.

    That's what I use (but I still can't manage to get GPS working inside the Android Apps running on aliendalvik. :-( Though I use the Sailfish native "Pure Maps" app, so it isn't critical for me).

Warning modifying system.img this way causes breakage on the logging daemon (logd). The workaround I've found is to use loop-mount and rsync -avPSHAX instead of unsquashfs.

edit flag offensive delete publish link more

Comments

4

lxc-attach -n aliendalvik /system/bin/logcat works nicely ...

coderus ( 2019-04-29 23:26:50 +0300 )edit

@coderus: It tried again

# lxc-attach -n aliendalvik --  /system/bin/logcat
logcat read failure

and got an error again. I must be doing something wrong...

DrYak ( 2019-04-30 11:24:10 +0300 )edit

aliendalvik isnt started? :D

coderus ( 2019-04-30 12:56:17 +0300 )edit

It's constantly up (due to friends relying on WhatsApp :eyeroll: ).

Though, on journalctl --follow, I'm constantly getting, things such as:

May 02 15:01:24 Sailfish init: starting service 'logd'...
May 02 15:01:24 Sailfish init: Created socket '/dev/socket/logd', mode 666, user 1036, group 1036
May 02 15:01:24 Sailfish init: Created socket '/dev/socket/logdr', mode 666, user 1036, group 1036
May 02 15:01:24 Sailfish init: property_set("ro.boottime.logd", "17627153292115") failed: property already set
May 02 15:01:24 Sailfish init: Created socket '/dev/socket/logdw', mode 222, user 1036, group 1036
May 02 15:01:24 Sailfish init: Opened file '/proc/kmsg', flags 0
May 02 15:01:24 Sailfish init: Opened file '/dev/kmsg', flags 1
May 02 15:01:24 Sailfish logd: failed to set CAP_SETGID, CAP_SYSLOG or CAP_AUDIT_CONTROL (1)
May 02 15:01:24 Sailfish init: Sending signal 9 to service 'logd' (pid 6141) process group...
May 02 15:01:24 Sailfish init: Successfully killed process cgroup uid 1036 pid 6141 in 0ms

Seems that for me the Android logger daemon is non functioning. Except for the system.img file patched for signature spoofing for MicroG, the whole aliendalvik layer I'm running is stock (including the LXC config) so it shouldn't be missing capabilities ?! My phone is XA2 Plus DualSim (H4413)

Except for GPS and logs, everything else seems to work okay under Aliendalvik.

DrYak ( 2019-05-02 16:29:20 +0300 )edit

Did get to investigate the logd problem : this happens whenever system.img has been un-packed and repacked. This causes the above logd errors and logcat doesn't work anymore.

Problem: currently, I need to unpack and repack system.img as part of the signature spoofing for MicroG (and the openGapps people need to do it too in order to install those inside the image).

On my specific case, it works if instead of unpacking the system.img, I loop-mount it and rsync -avPSHAX (to make sure to get every last damn file property stays the same) then the spoofing patching works (but this won't solve the problem for people using yeoldgroove's docker).

So this points to some attributes (xattrs) getting lost when unpacking the normal unsquashfs root.

DrYak ( 2019-05-31 21:38:33 +0300 )edit
0

answered 2019-05-19 13:26:21 +0300

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

updated 2019-05-19 13:26:21 +0300

ETW gravatar image

@DrYak: Did you gain any progress in getting MicroG running on the XA2?

I patched the system.img not only with MicroG but also installed GmsCore into the priv-app and set various permissions to allow the GmsCore included NLP to be installed as location service - unfortunately to no success ...

edit flag offensive delete publish link more

Comments

Exactly same here.

Neither installing in priv-app (repacking system.img with squashfs), nor authorising non-priv-app to register location services (the patch mentionned in the issue of the haystack github did apply without error) did any help.

Luckily, it's not much impacting to me, as native apps such as Pure Maps works perfectly for my mapping needs (and Laufhelden for sports-tracking), and most of the Android vehicle sharing (Catch-a-Car, Lime, Flash, etc.) also work simply by scanning a QR-code on the vehicle, no need of location. (Also, Uber works in the browser)

And my main use for Android is the 2FA app that my bank forces me to use, and the chat network that all my friend insist on using (they are all on WhatsApp. Thank you network effect. Thank you Facebook for banning any 3rd party WhatsApp re-implementation)

Still, it's a problem, and will probably impact other users. I would be happy if anyone could find a solution to get UnifiedNLP working...

I personnally DO NOT want to have the official proprietary Google Play Services. That includes ideological reasons (I prefere open-source whenever possible), privacy reasons (I'm not that much comfortable with a service broadcasting my position every couple of minutes as the services were discovered to do) and practical reasons (the above-mentionned privacy-invading feature of Google comes at a significant power cost. I would like my battery not to die for the sole profit of some other company).

DrYak ( 2019-05-19 20:21:56 +0300 )edit

Note: on the other hand, XDA-developers forum are littered with people having the same problems UnifiedNLP failing to register in the same way on LineageOS 14.1 (which is 7 Nougat based : the first generation where registering this gets complicated).

DrYak ( 2019-05-31 21:51:16 +0300 )edit

Just a linky to the current howto of microG on SFOS 3.1 which solves several problem getting NLP to work.

DrYak ( 2019-09-03 15:26:18 +0300 )edit
Login/Signup to Answer

Question tools

Follow
7 followers

Stats

Asked: 2019-04-29 19:33:45 +0300

Seen: 1,922 times

Last updated: May 31 '19