[4.5.0.24] AppSupport unable to start

REPRODUCIBILITY: 100%
OS VERSION: 4.5.0.24
HARDWARE: XA2
UI LANGUAGE: Polish
REGRESSION: ?

DESCRIPTION:

AppSupport does not start, the logs mention aptoide is being installed but it crashes. Restarting does not help, restarting the phone does not help.

PRECONDITIONS:

Just being me.

STEPS TO REPRODUCE:

  1. Start AppSupport in any way

EXPECTED RESULT:

AppSupport starts and stays on.

ACTUAL RESULT:

AppSupport starts and only stays on for like 2 seconds, then crashes (unable to start). Apparently not enough for any app to show up.

MODIFICATIONS:

I have Chum GUI installed and I admit I played a bit with the AppSupport, but looking at the logs I am quite sure I did not break anything myself.

ADDITIONAL INFORMATION:

These suspicious logs consistently appear in logcat:

01-09 08:42:02.691   160   312 I AlienService: Installing /data/aas-staging/app/incoming/cm.aptoide.pt.apk
01-09 08:42:02.693   160   604 D AlarmManagerService: Kernel timezone updated to -60 minutes west of GMT
01-09 08:42:02.694   160   604 D AlienAudioControlService: set AlienAudioControlListener
--
01-09 08:42:03.139   682   682 D NetworkSecurityConfig: No Network Security Config specified, using platform default
01-09 08:42:03.145   682   682 D ExternalStorage: After updating volumes, found 0 active roots
01-09 08:42:03.175   160   312 E AlienService: IOException on package transfer
01-09 08:42:03.175   160   312 E AlienService: java.io.IOException: Failed to allocate 20714491 because only 0 allocatable
01-09 08:42:03.175   160   312 E AlienService: 	at com.android.server.StorageManagerService.allocateBytes(StorageManagerService.java:3899)
01-09 08:42:03.175   160   312 E AlienService: 	at android.os.storage.StorageManager.allocateBytes(StorageManager.java:2278)
01-09 08:42:03.175   160   312 E AlienService: 	at android.os.storage.StorageManager.allocateBytes(StorageManager.java:2335)
01-09 08:42:03.175   160   312 E AlienService: 	at com.android.server.pm.PackageInstallerSession.doWriteInternal(PackageInstallerSession.java:988)
01-09 08:42:03.175   160   312 E AlienService: 	at com.android.server.pm.PackageInstallerSession.openWrite(PackageInstallerSession.java:930)
01-09 08:42:03.175   160   312 E AlienService: 	at android.content.pm.PackageInstaller$Session.openWrite(PackageInstaller.java:1025)
01-09 08:42:03.175   160   312 E AlienService: 	at com.android.server.AlienService.alien_handle_installPackage(AlienService.java:315)
01-09 08:42:03.175   160   312 E AlienService: 	at com.android.server.AlienService.access$000(AlienService.java:76)
01-09 08:42:03.175   160   312 E AlienService: 	at com.android.server.AlienService$AlienServiceHandler.handleMessage(AlienService.java:116)
01-09 08:42:03.175   160   312 E AlienService: 	at android.os.Handler.dispatchMessage(Handler.java:106)
01-09 08:42:03.175   160   312 E AlienService: 	at android.os.Looper.loop(Looper.java:223)
01-09 08:42:03.175   160   312 E AlienService: 	at android.os.HandlerThread.run(HandlerThread.java:67)
01-09 08:42:03.175   160   312 E AlienService: 	at com.android.server.ServiceThread.run(ServiceThread.java:44)
--------- beginning of crash
01-09 08:42:03.177   160   312 E AndroidRuntime: *** FATAL EXCEPTION IN SYSTEM PROCESS: AlienService
01-09 08:42:03.177   160   312 E AndroidRuntime: java.lang.SecurityException: Files still open
01-09 08:42:03.177   160   312 E AndroidRuntime: 	at com.android.server.pm.PackageInstallerSession.assertNoWriteFileTransfersOpenLocked(PackageInstallerSession.java:1112)
--
01-09 08:42:03.177   160   312 E AndroidRuntime: 	at com.android.server.pm.PackageInstallerSession.commit(PackageInstallerSession.java:1125)
01-09 08:42:03.177   160   312 E AndroidRuntime: 	at android.content.pm.PackageInstaller$Session.commit(PackageInstaller.java:1243)
01-09 08:42:03.177   160   312 E AndroidRuntime: 	at com.android.server.AlienService.alien_handle_installPackage(AlienService.java:335)
01-09 08:42:03.177   160   312 E AndroidRuntime: 	at com.android.server.AlienService.access$000(AlienService.java:76)
01-09 08:42:03.177   160   312 E AndroidRuntime: 	at com.android.server.AlienService$AlienServiceHandler.handleMessage(AlienService.java:116)
01-09 08:42:03.177   160   312 E AndroidRuntime: 	at android.os.Handler.dispatchMessage(Handler.java:106)
01-09 08:42:03.177   160   312 E AndroidRuntime: 	at android.os.Looper.loop(Looper.java:223)

Why does it try to install aptoide? Can I prevent it? The file in question has a very very recent mtime, but there is an exact copy nearby, with a 2021 mtime.

If all else fails I will surely try reflashing, but I would love to avoid that.

Workaround: I renamed the original file and it works again! Not sure if I broke something else. Why could it happen? Power loss during package update? But why 2021 all of a sudden?

Code:

mv /home/.android/data/aas-staging/app/packaged/cm.aptoide.pt.apk{,nah}

As I guessed the workaround only allows AppSupport to start. All package installations are still broken. I can live with that I think, but this time it might be my fault indeed, as I installed several packages through pm command line. Is there any way to clear Android pm state somehow?

Here: Removing Android AppSupport | Sailfish OS Documentation

It sounds like you need the Brutal way

It is completely resolved now. Sorry for not checking all the usual problems. Googling the error lead to noticing my home partition was low on free space (at first I though 400 MiB is enough, but I guess I was wrong). I cleared all the app caches, and it helped, 800 MiB is enough.

Idea for improvement: AppSupport could skip installing aptoide, or detect the failure if low on space? I had to first launch AppSupport so that I could clear all Android app caches in settings.
Idea for QA: maybe it might be worth to test software in low disk space conditions?