New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AppCleaner fails to read specific app folders in private storage #413

Closed
JERW86 opened this Issue Jun 15, 2016 · 23 comments

Comments

3 participants
@JERW86

JERW86 commented Jun 15, 2016

edit(d4rken): Seen on SD Maid v4.2.5

@d4rken Ever since the latest Play Store update, the AppCleaner function doesn't seem to "clean" apps. When I run SD Maid Pro Quick Access, AppCleaner always says 0.00B deleted. I have attached the debug log file and my phone info is as follows:

Phone: SGH-i747 (AT&T Samsung GS3)
Rom: Official CM13 20160613 nightly
Android Version: 6.0.1
SuperSu Version: 2.65
sdmaid_logfile_1465946605577.txt

I hope this can be fixed. Thank you for looking in to it.

@d4rken

This comment has been minimized.

Owner

d4rken commented Jun 15, 2016

One a first look what stands out is that we are getting permission denied errors for these folders, despite still getting the information.

1465946658752 V/SDM:StreamHarvester: Error:find: /data/user/0/com.textra/code_cache: Permission denied
1465946658752 V/SDM:StreamHarvester: Error:find: /data/user/0/com.textra/app_exopackage_dex_opt: Permission denied
1465946658753 V/SDM:StreamHarvester: Error:find: /data/user/0/com.textra/files: Permission denied
1465946658754 V/SDM:StreamHarvester: Error:find: /data/user/0/com.textra/shared_prefs: Permission denied
1465946658755 V/SDM:StreamHarvester: Error:find: /data/user/0/com.textra/app_ACRA-approved: Permission denied
1465946658756 V/SDM:StreamHarvester: Error:find: /data/user/0/com.textra/app_ACRA-unapproved: Permission denied
1465946658757 V/SDM:StreamHarvester: Error:find: /data/user/0/com.textra/databases: Permission denied
1465946658757 V/SDM:StreamHarvester: Error:find: /data/user/0/com.textra/app_data: Permission denied
1465946658758 V/SDM:StreamHarvester: Error:find: /data/user/0/com.textra/cache: Permission denied
1465946658759 V/SDM:StreamHarvester: Output:777:symbolic link:45839:114703:0:0:22:512:0:1465916397:'/data/user/0/com.textra/lib' -> '/system/lib/com.textra'
1465946658760 V/SDM:StreamHarvester: Output:777:directory:45839:114963:10124:10124:4096:512:8:1465848995:/data/user/0/com.textra/xposed
1465946658761 V/SDM:StreamHarvester: Output:771:directory:45839:114964:10124:10124:4096:512:8:1465942419:/data/user/0/com.textra/code_cache
1465946658764 V/SDM:StreamHarvester: Output:771:directory:45839:114966:10124:10124:4096:512:8:1465527590:/data/user/0/com.textra/app_exopackage_dex_opt
1465946658765 V/SDM:StreamHarvester: Output:771:directory:45839:114967:10124:10124:4096:512:8:1465942732:/data/user/0/com.textra/files
1465946658765 V/SDM:StreamHarvester: Output:771:directory:45839:114994:10124:10124:4096:512:8:1465753183:/data/user/0/com.textra/shared_prefs
1465946658766 V/SDM:StreamHarvester: Output:771:directory:45839:115010:10124:10124:4096:512:8:1465527591:/data/user/0/com.textra/app_ACRA-approved
1465946658768 V/SDM:StreamHarvester: Output:771:directory:45839:115011:10124:10124:4096:512:8:1465527591:/data/user/0/com.textra/app_ACRA-unapproved
1465946658769 V/SDM:StreamHarvester: Output:771:directory:45839:115012:10124:10124:4096:512:8:1465527591:/data/user/0/com.textra/databases
1465946658769 V/SDM:StreamHarvester: Output:771:directory:45839:115021:10124:10124:4096:512:8:1465527591:/data/user/0/com.textra/app_data
1465946658770 V/SDM:StreamHarvester: Output:775:regular file:45839:115023:10124:10124:3772:512:8:1465527591:/data/user/0/com.textra/at.cfg
1465946658771 V/SDM:StreamHarvester: Output:771:directory:45839:115024:10124:10124:4096:512:8:1465527591:/data/user/0/com.textra/cache

I see the deletion task being submitted, but the shell opens and closes as if it were empty.
Can you record another log, but this time using the AppCleaner direct from its own page?

@d4rken

This comment has been minimized.

Owner

d4rken commented Jun 15, 2016

Does the AppCleaner find results though? From the permission denied errors it would seem that it can't read the cache folder at all in some cases, but in others it works again, i.e.:

1465946625329 V/SDM:StreamHarvester: Output:600:regular file:45839:115946:10041:10041:7979:512:16:1465862248:/data/data/org.cyanogenmod.gello.browser/cache/Cache/6fda2a6033da780f_0
1465946625329 V/SDM:StreamHarvester: Output:600:regular file:45839:115947:10041:10041:43341:512:88:1465862249:/data/data/org.cyanogenmod.gello.browser/cache/Cache/903845b22bdd5400_0
1465946625330 V/SDM:StreamHarvester: Output:600:regular file:45839:115948:10041:10041:28700:512:64:1465862249:/data/data/org.cyanogenmod.gello.browser/cache/Cache/30dc0e68a0ff35ab_0

The difference seems to be whether the location is searched via /data/data or /data/user/0.

Do you have any Link2SD or other mount/symlink stuff going on?

Try to also record a real logcat of SD Maids AppCleaner scan. This might be an SELinux issue. Set SD Maids debug level to "2" before recording the logcat.

@JERW86

This comment has been minimized.

JERW86 commented Jun 17, 2016

I have recorded a log using adb on the app cleaner screen with debug mode set to "2".
The command I used was: adb -d logcat ed.thedarken.sdm:v > SDMaid v4.2.5 AppCleaner log.txt
[SDMaid v4.2.5 AppCleaner Not Cleaning Log.txt](https://github.com/d4rken/sdmaid-public/files/321210/SDMaid.v4.2.5.AppCleaner Log.txt)

The only thing that I can think of is I have "Mount namespace separation" enabled in SuperSu, This is the default. I don't have anything else mounted/symlinked

@d4rken

This comment has been minimized.

Owner

d4rken commented Jun 17, 2016

Can you answer whether it doesn't find files or wheather it just doesn't delete them?
From the logs I would assume it doesn't find files, but we should try to be on the same page here.

The logfile is good 👍. It doesn't show an obvious link to SELinux, but its obvious it's taking actions in some cases.
The easiest thing we can try at this point is to just turn it off (set to permissive) and see if that fixes it.
If the change helps, you could try to switch to the latest SuperSU version. According to the log you have v2.65 and I think there are version after that which change how SELinux is handled.
Try changing SELinux to permissive first though, so have a definite answer to the issue.
This link might help you with that:
http://forum.xda-developers.com/g2-mini/general/guide-how-to-set-selinux-to-permissive-t3329439

@JERW86

This comment has been minimized.

JERW86 commented Jun 17, 2016

it finds only a few small files and deletes them, but it should find a lot more since I use my phone a lot and have not cleaned it in a few days. It found maybe a couple mb and cleaned them.
After I sent the log, I used 3c toolbox pro cleanup/ optimization feature and it found 100MB+ and cleaned it, which makes more sense.

I will try setting SELinux to permissive and get back to you.

@JERW86

This comment has been minimized.

JERW86 commented Jun 18, 2016

I was able to set SELinux to permissive using a zip from post 2 in the link you gave me, but it did not help. AppCleaner registered 2 apps that needed to be "cleaned". The apps were lookout anti-virus and Security (8.00kb) https://play.google.com/store/apps/details?id=com.lookout&hl=en and the default phone app (4.00kb) when I "cleaned" the apps it looked like it had done it, but I saw a message at the bottom of the screen that said "0,00B deleted" So I believe the files have not been deleted.

Futhermore, the AppCleaner should have registered more apps that needed to be "cleaned". I took another log of this, too. I hope it helps.
SDMaid_v4.2.5_AppCleaner_Permissive_Log.txt

Do you want me to do anything else before setting SELinux to Enforcing, upgrading SuperSu and trying again?

@rsngfrce

This comment has been minimized.

rsngfrce commented Jun 18, 2016

I am having the same issue and have been corresponding with Darken about it by email, now moving that here.

Samsung Galaxy S4 (SPH-L720), rooted, Cyanogenmod 13 nightly 20160617-jfltespr (just updated to this version from a May version, no noticeable difference with SD Maid.) SD Maid v4.2.5, SD Maid Pro v4.0.6.

I have found that going back to SD Maid v4.2.4 makes no difference, but going back to v4.1.6 results in AppCleaner finding the expected files again.

Darken, in respresponse to your questions, I am aware of the AppCleaner settings in the new version. I have all Defaults turned on and all the Others turned off (because I don't know that I want those deleted). Regarding the log files I sent you, what log level should I have Catlog set to? It was set to Debug for the logs I sent, I tried changing it to Verbose, but that creates extremely large files. I did have the Debug level in SD Maid set to 2 for those logs, but I did not restart the app after setting that, which I guess may be the problem with the logs.

I have SELinux set to Enforcing, but that is nothing new.

@d4rken

This comment has been minimized.

Owner

d4rken commented Jun 18, 2016

If SD Maid is set to verbose but catlog not, then SD Maids verbose output
will be lost too 😉.
Several MB large files are normal in verbose mode.

But at this point more logs won't really help. Try the suggestion I gave in
my last post. We still need to identify the core cause.
Am 18.06.2016 09:09 schrieb "rsngfrce" notifications@github.com:

I am having the same issue and have been corresponding with Darken about
it by email, now moving that here.

Samsung Galaxy S4 (SPH-L720), rooted, Cyanogenmod 13 nightly
20160617-jfltespr (just updated to this version from a May version, no
noticeable difference with SD Maid.) SD Maid v4.2.5, SD Maid Pro v4.0.6.

I have found that going back to SD Maid v4.2.4 makes no difference, but
going back to v4.1.6 results in AppCleaner finding the expected files
again.

Darken, in respresponse to your questions, I am aware of the AppCleaner
settings in the new version. I have all Defaults turned on and all the
Others turned off (because I don't know that I want those deleted).
Regarding the log files I sent you, what log level should I have Catlog set
to? It was set to Debug for the logs I sent, I tried changing it to
Verbose, but that creates extremely large files. I did have the Debug level
in SD Maid set to 2 for those logs, but I did not restart the app after
setting that, which I guess may be the problem with the logs.

I have SELinux set to Enforcing, but that is nothing new.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#413 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/ABX1_RTuzB0T01kT0vz4TJ5nM7pKWOmSks5qM5mMgaJpZM4I160M
.

@rsngfrce

This comment has been minimized.

rsngfrce commented Jun 18, 2016

I don't want to install SuperSU on top of Cyanogenmod, but using the app SELinuxModeChanger to set SELinux to Permissive does not solve the issue.

I see Opera listed during the scan, but no results come up even though there are cache files. If I switch back to v4.1.6, AppCleaner finds them (I don't have backups of the versions between 4.1.6 and 4.2.3). I am stuck thinking that something obviously changed in the app that is causing this (maybe stating the obvious).

@ghost

This comment has been minimized.

ghost commented Jun 18, 2016

Do you have any Link2SD or other mount/symlink stuff going on?

0 is a symlink in /data/user which points to /data/data

@JERW86

This comment has been minimized.

JERW86 commented Jun 18, 2016

@randomname1234 The only thing I can think of is "Mount namespace separation" is checked in SuperSu 2.65. this is the default. I have not linked any folders or files.

@ghost

This comment has been minimized.

ghost commented Jun 18, 2016

@JERW86 I'm not saying you linked that folder. It is android which came with that symlink, It was introduced with multiple user accounts.

This is the commit

And this is a brief explanation from f-droid repository:

There is the first user (OWNER) created on initial device setup. This user has app data path /data/data. It contains emulated storage /storage/emulated/0 . By default, only this user has exclusive root access (in lolipop) and is numbered 0.
When subsequent users are created, they get numbered from 10, 11, 12, 13.... . And their app data path will be /data/user/10 , /data/user/11 ,/data/user/12 ... respectively. There is also app data path/data/user/0 which just symlinks to the contents of /data/data . These users get emulated storage /storage/emulated/10 , /storage/emulated/11 ... respectively.

That symlink was introduced for backward compatibility
If you want other article, here and here

@d4rken

This comment has been minimized.

Owner

d4rken commented Jun 18, 2016

Ah sorry I forgot to send the post I was referring to! 😦
Yeah still getting same errors in the logs with SELInux set to permissive...
Do all of you have Xposed?
Do you have any xposed modules that could interfere?

Try running this with root from terminal emulator @JERW86 (everyone else can use the same command, just has to adopt the path for an app you have that shows the issues.

/data/data/eu.thedarken.sdm/files/busybox find \/data\/user\/0\/com\.android\.vending  -mindepth 1 
/data/data/eu.thedarken.sdm/files/busybox find \/data\/user\/0\/com\.fsck\.k9  -mindepth 1

@JERW86
SD Maids find gets Permission denied for many subdirectories, if 3c toolbox just uses the toplevel directory and doesn't check content, then it probably would not show any issues.

@randomname1234
/data/user/0 linking to /data/data is normal and not the issue here as SD Maid manages to get the content of it and also the content of the app folder, but only the top level directory, not any subdirectories, see this log piece.

@rsngfrce APKMirror has all old versions: www.apkmirror.com/apk/darken/sd-maid/
v4.2.0 was the big one in terms of AppCleaner changes, were we went from a single monolithic filter to the modularized ones we have now.

If we narrow it down to a change between two specific versions it's easier for me to investigate, but it is very weird that it doesn't work for you guys, but for others it works. I mean i flashed CM13 to my N7(2012) and installed a bunch of apps which fails on your devices, but they show just fine on mine....

@d4rken d4rken added the bug label Jun 18, 2016

@d4rken d4rken changed the title from v4.2.5. AppCleaner doesn't "clean" to AppCleaner fails to read specific app folders in private storage Jun 18, 2016

@rsngfrce

This comment has been minimized.

rsngfrce commented Jun 18, 2016

I do have Xposed installed, but not any modules that I believe should interfere. I will try to narrow down which version AppCleaner stopped working correctly in.

@d4rken

This comment has been minimized.

Owner

d4rken commented Jun 18, 2016

I understand it 😄.
The directories that fail, have o=+r, meaning read access on the parent folder for other (everyone).
This causes SD Maids check to think that this location doesn't need root to be read (which is true for the parent dir), but the child dirs have stricter permission causing the non root shell to fail to read them.

I'm pretty sure this is the what is causing it. I don't know yet why the permission are different on some folders while not on others.

Furthermore looking at the logs again:
@rsngfrce The folders which fail on your device have 755, meaning just the extra read permission.
@JERW86 The folders which fail on your device have 777 meaning write access!!.

Any idea where these different permissions come from? The default should be 751 for all private app data dirs. You can check which apps are affected by browsing /data/data with an explorer that shows permissions (e.g. SD Maid 😛 )

@rsngfrce

This comment has been minimized.

rsngfrce commented Jun 18, 2016

I did notice that certain of the folders had the extra read permission and thought that was causing the issue, but I found that AppCleaner DID find some of the folders with the extra read permission (top level). I also tried removing the extra read permission from the Opera top level folder (so the permissions were the same as the folders it seemed to be finding), but AppCleaner still did not find it.

This is a screenshot of the results from v4.1.6:
416

This is a screenshot of the results from 4.2.0:
420

So it does appear this change happened between those two versions.

@d4rken

This comment has been minimized.

Owner

d4rken commented Jun 18, 2016

@rsngfrce Can you get me another log where you changed the permissions and it still fails to find them on v4.2.5?

@rsngfrce

This comment has been minimized.

rsngfrce commented Jun 18, 2016

Actually, I just confirmed that all the folders that 4.2.0 finds don't have the extra read permission, so I am doing some more investigation.

@rsngfrce

This comment has been minimized.

rsngfrce commented Jun 18, 2016

Removing the extra read permission from the top level Opera folder DOES result in v4.2.0 and 4.2.5 finding it! 😁 I don't know why this didn't work the first time I tried it, but I was only switching between versions then without uninstalling first.

So... I can manually change all the permissions if necessary, but I don't know why they are different for some folders (or what might cause them to change back).

@d4rken

This comment has been minimized.

Owner

d4rken commented Jun 18, 2016

You don't have to change them for SD Maid. I'm already making code changes to deal with this.
Nonetheless it would be good to know why some have different permissions. Script? Backups? Flashing? Xposed? Android itself, but then why only those and not others?

@rsngfrce

This comment has been minimized.

rsngfrce commented Jun 18, 2016

I wish I knew and if I come up with an answer I will let you know, but I am used to odd things happening with my phone unfortunately. 😵

@rsngfrce

This comment has been minimized.

rsngfrce commented Jun 18, 2016

I've looked at the folders that have the read permission and I just can't find any obvious connection between them!!

@d4rken

This comment has been minimized.

Owner

d4rken commented Jun 18, 2016

If you ever find out, please let me know.
If you want to confirm whether the fix I commited fixed it, mail to support and I'll give you a test build.

@d4rken d4rken closed this Jun 18, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment