MatteCarra / AccA

Acc app allows to edit acc config file and add a tile to start and stop acc deamon
GNU General Public License v3.0
1.19k stars 85 forks source link

acca install acc failed on android 4.1.1 and 4.1.2 #152

Closed CrazyBoyFeng closed 3 years ago

CrazyBoyFeng commented 3 years ago

logcat:

--------- beginning of /dev/log/main
E/Lights  (  269): write_int failed to open sys/class/leds/rk29_key_led/brightness
D/AudioHardware(   96): AudioHardware pcm playback is exiting standby.
D/AudioHardware(   96): openPcmOut_l() mPcmOpenCnt: 0
D/dalvikvm(18800): GC_CONCURRENT freed 333K, 10% free 8309K/9223K, paused 12ms+3ms, total 41ms
D/dalvikvm(18800): GC_CONCURRENT freed 381K, 9% free 8403K/9223K, paused 11ms+12ms, total 41ms
D/dalvikvm(18800): GC_FOR_ALLOC freed 287K, 9% free 8470K/9223K, paused 22ms, total 22ms
W/System.err(18800): java.lang.Exception: ACC installation failed
W/System.err(18800):    at mattecarra.accapp.acc.Acc$installLocalAccModule$2.invokeSuspend(Acc.kt:142)
W/System.err(18800):    at mattecarra.accapp.acc.Acc$installLocalAccModule$2.invoke(Acc.kt)
W/System.err(18800):    at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:91)
W/System.err(18800):    at kotlinx.coroutines.BuildersKt__Builders_commonKt.withContext(Builders.common.kt:160)
W/System.err(18800):    at kotlinx.coroutines.BuildersKt.withContext(Unknown Source)
W/System.err(18800):    at mattecarra.accapp.acc.Acc.installLocalAccModule(Acc.kt:129)
W/System.err(18800):    at mattecarra.accapp.acc.Acc$installBundledAccModule$2.invokeSuspend(Acc.kt:94)
W/System.err(18800):    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
W/System.err(18800):    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:56)
W/System.err(18800):    at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
W/System.err(18800):    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:738)
W/System.err(18800):    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
W/System.err(18800):    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)
D/dalvikvm(18800): GC_CONCURRENT freed 957K, 13% free 8098K/9287K, paused 11ms+2ms, total 32ms
D/dalvikvm(18800): WAIT_FOR_CONCURRENT_GC blocked 13ms
D/dalvikvm(18800): GC_CONCURRENT freed 374K, 12% free 8216K/9287K, paused 1ms+12ms, total 27ms

/data/adb/acc-data/logs/ was not existed, so I created them then restart acca, but the ./logs/ was empty, either.

CrazyBoyFeng commented 3 years ago

acca.apk let me upload /data/adb/acc-data/logs/, but it was not existed, and I found /sdcard/vr25/acc/logs/install-tarball.sh.log install-tarball.sh.log

VR-25 commented 3 years ago

It seems to be a busybox problem. That version might be too old. You can download the appropriate busybox binary for your CPU architecture and place it in /data/adb/bin/ (filename busybox with permissions set to 0700 or 0755). Magisk's and Osm0sis' busybox are great. You can find those here on GitHub.

CrazyBoyFeng commented 3 years ago

I used meefik/busybox 1.31.1 before, whose version is the same as osm0sis just because it is easy to install.
I found acc's install log said it located busybox at \system\bin\ but I clearly install it to \system\xbin, I think this may be the cause of the error.
So I ln /system/xbin/busybox /system/bin/busybox, and start acca, failed either. /sdcard/vr25/acc/logs/install-tarball.sh.log:

18: [ -x /dev/.busybox/ls ]
19: mkdir -p /dev/.busybox
20: chmod 0700 /dev/.busybox
21: [ -f /data/adb/bin/busybox ]
24: [ -f /data/adb/magisk/busybox ]
27: which busybox
27: >/dev/null 
0: which busybox
28: eval /system/xbin/busybox --install -s /dev/.busybox
0: /system/xbin/busybox --install -s /dev/.busybox
36: export PATH=/data/adb/bin:/dev/.busybox:/sbin:/vendor/bin:/system/sbin:/system/bin:/system/xbin
0: id -u
41: [ 0 -ne 0 ]
46: umask 0000
47: set -e
50: [ -f //install-tarball.sh ]
0: readlink -f /data/data/mattecarra.accapp/files
50: cd /data/data/mattecarra.accapp/files
68: trap copy_log EXIT
71: rm -rf acc[-_]*/
71: 2>/dev/null 
72: tar -xf acc_bundle.tar.gz
0: get_ver acc_bundle.tar.gz acc_v2020.10.15_(202010150)
77: sed -n /^versionCode=/s/.*=//p acc_bundle.tar.gz/module.prop
77: 2>/dev/null 
77: echo 0
78: bundled_ver=0
0: get_ver /data/adb/vr25/acc
77: sed -n /^versionCode=/s/.*=//p /data/adb/vr25/acc/module.prop
77: 2>/dev/null 
79: regular_ver=202010080
79: 2>/dev/null 

Then I think maybe the meefik's busybox is incompatible, so I follow your instructions, install Magisk-Modules-Repo/busybox-ndk to /data/adb/bin/busybox, then I start acca, failed either, and the install-tarball.sh.log:

18: [ -x /dev/.busybox/ls ]
36: export PATH=/data/adb/bin:/dev/.busybox:/sbin:/vendor/bin:/system/sbin:/system/bin:/system/xbin
0: id -u
41: [ 0 -ne 0 ]
46: umask 0000
47: set -e
50: [ -f //install-tarball.sh ]
0: readlink -f /data/data/mattecarra.accapp/files
50: cd /data/data/mattecarra.accapp/files
68: trap copy_log EXIT
71: rm -rf acc[-_]*/
71: 2>/dev/null 
72: tar -xf acc_bundle.tar.gz
0: get_ver acc_bundle.tar.gz acc_v2020.10.15_(202010150)
77: sed -n /^versionCode=/s/.*=//p acc_bundle.tar.gz/module.prop
77: 2>/dev/null 
77: echo 0
78: bundled_ver=0
0: get_ver /data/adb/vr25/acc
77: sed -n /^versionCode=/s/.*=//p /data/adb/vr25/acc/module.prop
77: 2>/dev/null 
79: regular_ver=202010080
79: 2>/dev/null 
SmallAndSoft commented 3 years ago

acc install fails for me too on Nexus 5 Lineage OS 14.1 (Android 7.1.2) with Magisk busybox 1.31.1 AccA reports that daemon is running even though logs say that acc is not found. AccA crashes when I switch to profiles tab.

VR-25 commented 3 years ago

How about the latest acc release?

CrazyBoyFeng commented 3 years ago

Thanks for your work. I will take the time to test it. Then report back by the end of this week.

CrazyBoyFeng commented 3 years ago

Result: Install failed AccA version: 1.0.33 from GitHub Device: ZTE U970 (The previous Android 4.1.1 was Vido N70S. That device was not with me recently.) Android: 4.1.2 Kernel: 2.6.39.5 Root: SuperSU Busybox:

logcat.txt /data/adb/vr25/acc-data/logs/install.log /data/adb/vr25/acc-data/logs/install-tarball.sh.log

VR-25 commented 3 years ago

According to the logs, the issue is related to busybox, chcon: not found. The question is, how come a recent busybox build not include chcon? I'll be investigating this further.

VR-25 commented 3 years ago

Move /data/adb/bin/ to /data/adb/vr25/ and try again. You should have the path /data/adb/vr25/bin/busybox.

P.S., after that, remove /dev/.vr25/busybox/ or reboot.

CrazyBoyFeng commented 3 years ago

I moved /data/adb/bin/busybox to /data/adb/vr25/bin/busybox and reboot, then chcon: not found either: install.log install-tarball.sh.log

VR-25 commented 3 years ago

Does /dev/.vr25/busybox/chcon exist? Either way, run echo > /dev/.vr25/busybox/chcon and try installing acc again.

CrazyBoyFeng commented 3 years ago

/dev/.vr25/busybox/chcon does not exist. ls /dev/.vr25/busybox

I tried echo > /dev/.vr25/busybox/chcon, error: No install.log install-tarball.sh.log

CrazyBoyFeng commented 3 years ago

Does the chcon require selinux? I tried busybox-arm-selinux. This time there is chcon. But another error chcon: can't obtain security context occured: install.log install-tarball.sh.log

VR-25 commented 3 years ago
#!/system/bin/sh
# put me in a file named chcon
# place that dummy chcon in /system/bin, /system/xbin or any other directory that is in PATH
# set proper permissions
exit 0

Remove busybox-arm-selinux and reboot after putting the dummy chcon in place.

CrazyBoyFeng commented 3 years ago

Now: Magisk-Modules-Repo/busybox-ndk/busybox-arm 1.33.1 at /data/adb/vr25/bin/busybox with permission 0755 Dummy /system/xbin/chcon with permission 0755 /dev/.vr25/busybox/chcon does not exist.

Try install failed. install.log does not exist. install-tarball.sh.log

By the way, after running echo > /dev/.vr25/busybox/chcon, install.log doesn't exist either, sorry for the previous mistake.

CrazyBoyFeng commented 3 years ago

I tried reinstall after rebooting, this time it seemed the acc installed successful: logs.zip

But acca crashed: logcat.txt

acca have some compatibility problem with the API level 16. I know a little about android app development, I'll try to debug it if I have time.

Do you think the current issue is considered solved? If you don't think you need to follow up, either close it.

VR-25 commented 3 years ago

I tried reinstall after rebooting, this time it seemed the acc installed successful: logs.zip

Great! I took a look at the logs. Things seem right this time. Now you only have to deal with the lack of known charging switches for this device. acc -p is a nice tool for that. It generates a list of potential charging switches. You'll have to look at each and test those that [remotely] resemble a charging switch. I'll have a closer look at the power supply log later and provide more suggestions if I find anything relevant.

But acca crashed: logcat.txt

acca have some compatibility problem with the API level 16. I know a little about android app development, I'll try to debug it if I have time.

That's also a job for @MatteCarra and @squabbi. Perhaps there's room for me too. Will see...

Do you think the current issue is considered solved? If you don't think you need to follow up, either close it.

Yes, it's solved. The next acc will recognize this and automatically emulate chcon.

Thanks for the collaboration!

CrazyBoyFeng commented 3 years ago

I spent some time discovering that acca's crash on api 16 seemed to be related to some dependency library. Due to the difficulty of modifying the dependency library, and the complexity of this project, I gave up on finding the cause of the problem. I will try to write a new, simple app that runs for the old device.

VR-25 commented 3 years ago

I spent some time discovering that acca's crash on api 16 seemed to be related to some dependency library. Due to the difficulty of modifying the dependency library, and the complexity of this project, I gave up on finding the cause of the problem. I will try to write a new, simple app that runs for the old device.

Looking forward to this. Contact me if you need any assistance/tips regarding the use of acc as a back-end.