Android support (aliendalvik.service) has stopped working

REPRODUCIBILITY (% or how often): 100%
BUILD ID = OS VERSION (Settings > About product): 4.3.0.12 (Suomenlinna)
HARDWARE (XA2, X10, X10 II, …): Xperia XA2 - Dual SIM
UI LANGUAGE: English
REGRESSION: (compared to previous public release: Yes, No, ?): ?

DESCRIPTION:

Android support no longer starts (it was working yesterday, I have updated nothing between it working and it stopping)

PRECONDITIONS:

None

STEPS TO REPRODUCE:

  1. Turn on phone

EXPECTED RESULT:

Android support starts (or can be started).

ACTUAL RESULT:

Android support cannot be started either from settings (start and stop both greyed out)
Also cannot be started by systemctl start aliendalvik.service

ADDITIONAL INFORMATION:

root@Sailfish nemo]# systemctl status -l aliendalvik
● aliendalvik.service - Alien Dalvik
   Loaded: loaded (/usr/lib/systemd/system/aliendalvik.service; disabled; vendor preset: enabled)
  Drop-In: /usr/lib/systemd/system/aliendalvik.service.d
           └─01-prevent-start.conf
   Active: failed (Result: exit-code) since Thu 2022-02-03 23:28:22 GMT; 7min ago
  Process: 29042 ExecStopPost=/usr/sbin/stop-aliendalvik.sh (code=exited, status=0/SUCCESS)
  Process: 29040 ExecStopPost=/usr/libexec/lxc/lxc-net stop (code=exited, status=0/SUCCESS)
  Process: 29018 ExecStartPost=/usr/sbin/alien-post-startup.sh (code=exited, status=20)
  Process: 28109 ExecStart=/usr/sbin/start-aliendalvik.sh (code=killed, signal=TERM)
  Process: 28104 ExecStartPre=/usr/libexec/lxc/lxc-net start (code=exited, status=0/SUCCESS)
  Process: 28100 ExecStartPre=/usr/sbin/start-aliendalvik-preinit.sh (code=exited, status=0/SUCCESS)
  Process: 28097 ExecStartPre=/usr/bin/start-aliendalvik-preinit.sh (code=exited, status=0/SUCCESS)
 Main PID: 28109 (code=killed, signal=TERM)

I have journal output of the timeperiod when the service is being started. A lot of it seems to be complaints about a read-only filesystem, I’ll try and add it in a followup comment.

Did some more digging.

If I start the aliendalvik container with:

systemctl start lxc@aliendalvik.service

Then check that it’s running:

[root@Sailfish nemo]# lxc-info -n aliendalvik
Name:           aliendalvik
State:          RUNNING
PID:            19266
IP:             192.168.0.213
IP:             2001:4d48:ad5c:ef00:3a78:62ff:fe3e:3de
IP:             fdb6:d7d8:c914:0:3a78:62ff:fe3e:3de
CPU use:        11.91 seconds
Memory use:     418.67 MiB
KMem use:       0 bytes

I can shell into it - so let’s do some digging. We know the alien-post-startup script is failing so let’s look at that, starting with the script contents:

[root@Sailfish nemo]# cat /usr/sbin/alien-post-startup.sh  | grep -vE '^#|^$'
lxc-attach -n aliendalvik -- /system/bin/sh -c "source /etc/mkshrc; settings put global device_provisioned 1"
lxc-attach -n aliendalvik -- /system/bin/sh -c "source /etc/mkshrc; settings put system accelerometer_rotation 1"

Now shelling in to the lxc container:

[root@Sailfish nemo]# lxc-attach -n aliendalvik -- /system/bin/sh
# source /etc/mkshrc 
:/ # settings put system accelerometer_rotation 1
cmd: Can't find service: settings

Ok, interesting. What can cmd find?

 :/ # cmd
 cmd: No service specified; use -l to list all services

20|:/ # cmd -l
Currently running services:
  alien.launcher
  android.security.keystore
  apexservice
  ashmem_device_service
  dnsresolver
  drm.drmManager
  gpu
  idmap
  incident
  installd
  media.audio_flinger
  media.drm
  media.extractor
  media.metrics
  media.player
  media.resource_manager
  netd
  stats
  storaged
  storaged_pri
  suspend_control
  vold

So no “settings” service.

1 Like

Well, looks like android support broke even harder this time (I had to scrub all my android support and start fresh last time).

This time it broke again and the lxc container won’t start at all - no container config found apparently. Still digging into why the android config breaks semi-regularly. I may have to
set up a daily snapshot of the android related directories.

I’m curious what you did last year to get it to find settings? And are you still on 4.3.0?

Sadly I had no more time to spare chasing the problem so I think I removed the .android directory and set things up again from scratch.

I’m on the current 4.5.x.x release now.

I can’t 100% confirm that it’s related but each time android support has failed I’ve run fsck from the hybris recovery image and it’s found and fixed problems.

So far this time:

   Active: failed (Result: exit-code) since Sun 2023-05-21 19:44:16 BST; 15h ago
  Process: 13001 ExecStopPost=/usr/libexec/appsupport/stop-aliendalvik.sh (code=exited, status=0/SUCCESS)
  Process: 12956 ExecStartPost=/usr/libexec/appsupport/alien-post-startup.sh (code=exited, status=20)
  Process: 12283 ExecStart=/usr/libexec/appsupport/start-aliendalvik.sh (code=killed, signal=TERM)

So I’m going to step through the post-startup scriupt and see if I can figure out why it’s failing.

Ok, looks like the same dead end as before. obscured by lxc-start happening in a nondefault location.

settings put …

which translates to

cmd settings put …

which still results in cmd: Can’t find service: settings

Backed up .android to a new name, restarted. Android support started working again. Have compared .android and .android.bak but a preliminary scan doesn’t throw up any obvious candidates.

And it’s started failing again. No filesystem corruption this time.

Just a no-progress note. It looks like something in /home/.android/data gets corrupted from time to time, buit it’s really not clear what that something is. Moving /home/.android to another location allows the system to recover, albeit at the cost of having to rteinstall all your android apps and losing all data in things like Signal or Whatsapp, which is less than ideal.

ahoy @fledermaus,

Yesterday I had android support stopped working too for second time in few days. What worked for me was to free space on the /home partition. The android problem started when I was under 500 - 600Mb free space. When I removed some data, android support started without even restart the device. I hope this tip will help.

Hi. I’ll check to see what space I have - I don’t think I was low on space but always good to have another possibility. Thanks.

Stopped working again. 6.7 GB free on /home, so it’s not out of space.

If anyone knows how to extract applications from a backed up .android and reinstall them in a working .android I would love to know.

How do other people handle this? Just live with the android support dying every few months and reionstalling everything?

Android has always been working reliably for me.

Did you say it works after scrubbing, then doesn’t after reinstalling all your apps?

[ I’m currently using the SFOS app to post and cannot properly view code blocks. ]

It works after scrubbing, and also aftyer then reinstalling apps.

At some point after installing apps it stops working - usually a few months, but on one occasion less than a day, with the user-visible symptom being that android support never starts - it just times out.

Digging deeper the logs always show lxc-start failing, as a result of:

settings put …
which translates to
cmd settings put …
which results in
cmd: Can’t find service: settings

In fact, now that I think about it, I seem to recall my android apps losing their configuration, or at least some of it, shortly before the problem manifested (reverting back to their default settings) - which would seem to line up with the settings service or its data-store becoming corrupted somehow.