[Android Apps and Games] pollazht:
Hi,

I am running LP 5.1 on a Moto E 2015.

I have some problems when I update apps which I have linked with your app.

It seems to update fine, but when I reboot the system the update reappears in play store.

Every time I update and reboot I get the app's folder with increased number suffix as can been seen in the following photo:

This numbering scheme applies to apk, app-lib and dex.

Also, (by pressing the info button at the upper right corner of Apps2SD's App Detail view) I noticed that when I update, Apk/Dex/Lib with the proper number suffix are linked as they should, but after a reboot I see that the pre-update folders are linked back. Let me use an example:

I have

/data/app/com.shazam.android-2/base.apk linked to /data/sdext2/apk/com.shazam.android-2/base.apk
/data/dalvik-cache/arm/data@app@com.shazam.android-2@base.apk@classes.dex linked to /data/sdext2/dalvik-cache/arm/data@app@com.shazam.android-2@base.apk@classes.dex
/data/app/com.shazam.android-2/lib linked to /data/sdext2/app-lib/com.shazam.android-2/lib

After 1st update, in app info, "2" in above folders is replaced by "1" as it should (folders with the "2" suffix failed to be deleted).

After reboot after 1st update , in app info, suffix is reverted to "2" in above folders.

After 2nd update, in app info, "2" in above folders is replaced by "3" as it should (folders with the "2" and "1" suffix are not deleted).

After reboot after 2nd update , in app info, suffix is reverted to "2" in above folders.

And the suffix keeps increasing until I use one of the methods mentioned below.

With logcat I can see there is selinux trouble:

W/PackageManager( 1130): type=1400 audit(0.0:257): avc: denied { unlink } for uid=1000 name="lib" dev="mmcblk0p44" ino=329108 scontext=u:r:system_server:s0 tcontext=u:object_r:apk_data_file:s0 tclass=lnk_file permissive=0
W/FileUtils( 1087): Failed to delete /data/app/com.shazam.android-2/lib
W/FileUtils( 1087): Failed to delete /data/app/com.shazam.android-2/base.apk
W/PackageManager( 1130): type=1400 audit(0.0:258): avc: denied { unlink } for uid=1000 name="base.apk" dev="mmcblk0p44" ino=329103 scontext=u:r:system_server:s0 tcontext=u:object_r:apk_data_file:s0 tclass=lnk_file permissive=0
E/installd( 307): Couldn't unlink /data/dalvik-cache/arm/data@app@com.shazam.android-2@base.apk@classes.dex: Permission denied
W/installd( 307): type=1400 audit(0.0:259): avc: denied { unlink } for uid=1012 name="data@app@com.shazam.android-2@base.apk@classes.dex" dev="mmcblk0p44" ino=323921 scontext=u:r:installd:s0 tcontext=u:object_r:dalvikcache_data_file:s0 tclass=lnk_file permissive=0
W/PackageManager( 1087): Couldn't remove dex file for package: at location /data/app/com.shazam.android-2/base.apk, retcode=-1

To make the update work as it is supposed to, I usually have to delete apk/libs/dex from apps2sd and original location folders.

In some cases I also have to unlink apk/libs.

Alternatively, I could disable selinux temporarily or unlink apk/libs before updating an app.

This is not a bug with newer versions, as I recall having the same problem since the beginnings of apps2sd (maybe I should have reported sooner but it is not easily reproducible, as I have to wait for apps to update)

Everything else works fine with your app (mounting without soft reboot etc), I only have problems when I update apps.

So, is there a way to solve this without permanently disabling selinux ? Also, do you know why Packagemanager is denied unlinking / deleting the shortcuts created with your app ?

If you require additional info or explanation, I will be glad to help.

Thanks in advance.