ViperOne + ElementalX dofstrim wakelock issue - solved
I am using unlocked and activated HTC One M7 sprint edition in GSM network, rooted. ViperOne appeared to be the best ROM for my device, along with brilliant ElementalX kernel. but as some other people I've suffered from dotfstrim kernel wakelock that usually came at nights when phone was charged and sleeping on the table.
I've found that trim file system service could be made manually using fstrim tool and starting from 4.3 trim events processed at the volume daemon (vold) triggered by idle maintenance event. that event is interesting thing, triggered only when battery charge is > 80% and phone was not active for more than 73 minutes, but not more than once per day. now I was almost sure that dofstrim orphaned wakelock was left by that event processing.
instead of waiting for next event, I did more research and found that event can be fired anytime by shell command:
voila! wakelock was there. knowing that idle maintenance running vold internal procedure for trim, I've checked daemon sources and found the following:
#define FSTRIM_WAKELOCK "dofstrim"
SLOGI("Finished fstrim work.\n");
so wakelock was set before trim process but never released. logfile shown me following:
E/Vold (32356): failed to open /fstab.m7
E/Vold (32356): Error reading configuration (No such file or directory)... continuing anyways
I/fstrim (32356): Starting fstrim work...
...and then.. boom!
F/libc (31832): Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1), thread 32353 (vold)
I/DEBUG ( 248): Build fingerprint: 'htc/sprint_wwe/m7wls:4.4.2/KOT49H/325784.5:user/release-keys'
I/DEBUG ( 248): AM write failure (32 / Broken pipe)
I/DEBUG ( 248): Write to AM fail, close AM fd
I/DEBUG ( 248): Revision: '4'
I/DEBUG ( 248): pid: 31832, tid: 32353, name: vold >>> /system/bin/vold <<<
I/DEBUG ( 248): debuggerd: checkTellHTCSettings
I/DEBUG ( 248): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000000
I/DEBUG ( 248): r0 2a01abd5 r1 fffffff0 r2 00000003 r3 00000000
I/DEBUG ( 248): r4 2a02017c r5 2a025290 r6 00000000 r7 b6b28d08
I/DEBUG ( 248): r8 00000000 r9 2a018bf6 sl b6c282d4 fp b6fac2f4
I/DEBUG ( 248): ip 00000003 sp b6b28ce8 lr b6fd1de1 pc 2a00f6ca cpsr 200b0030
so vold crashed but orphaned wakelock remained and prevents phone from sleeping ((
in theory problem caused by additional protected partition that exists on sprint model only but I had no time for vold recompiling so I've created a quite straightforward hex patch that simply removes trim process. so wakelock released and everyone's happy. just a note. vold will not run trim anymore so it must be done manually from shell by fstrim tool or from UI by LagFix app like once per week.
attached archive contains new (patched) and old (original) vold files that you have to upload to device using adb or any other method:
adb push vold /system/bin/vold
make sure you have fixed vold permissions from terminal like
chmod 755 /system/bin/vold
or you risk to stop on boot screen.
ps. this night my phone spent only 2% of battery for 7 hours. radio + wifi was on. so it was sleeping well ))