[Android Q&A, Help & Troubleshooting] nachoparker:
Hello,

I have a debian image from which I run she 'sshd' daemon by means of busybox's chroot.

While it is running my phone does not sleep and my battery drains very fast.

As soon as I close the process it goes back to it's proper behaviour.

I check wether it is sleeping using Wakelock Detector. I go from almost 0% to 100% awake time if I run sshd.

In Wakelock Detector, "Android OS" takes up most of the time, like 50%. It is only around 5% when normal.

This also happens with other binaries, for example if I chroot VNC server.

Debian and scripts are in /sdcard/debian/ ... which is part of the /data partition anyway in my device.

My system:

Nexus 4
Cyanogenmod 10.1.2-mako ( Android 4.2.2 )
No gapps
Busybox 1.21

The script I run to launch the SSH daemon: (as root)

#!/system/xbin/bash

DIR=/sdcard/debian
IMG=$DIR/debian.img
MNTPOINT=/data/local/mnt
BBOX=/system/xbin/busybox

MNTCNT=`$BBOX mount | $BBOX grep $MNTPOINT | $BBOX wc -l`

if [ $MNTCNT == 0 ]; then

$BBOX mount "$IMG" "$MNTPOINT"
$BBOX mount -t devpts devpts "$MNTPOINT"/dev/pts
$BBOX mount -t proc proc "$MNTPOINT"/proc
$BBOX mount -t sysfs sysfs "$MNTPOINT"/sys
$BBOX mount --bind /sdcard "$MNTPOINT"/sdcard

fi

export PATH=$PATH:/bin:/usr/local/bin:/usr/bin:/sbin:/usr/sbin
export HOME=/root

echo "montar SD con: "
echo sshfs -p 2222 root@android:/sdcard/ /mntpoint

$BBOX chroot "$MNTPOINT" /usr/sbin/sshd -p 2222

I have checked for weird wakelocks using 'dumpsys alerts' and reading '/proc/wakelocks', but I fail to find a culprit. I have checked the relevant code in busybox sources but again I do not see anything related to acquiring a wakelock.

As far as I know, android uses the 'oportunistic suspend' mechanism, so that it goes to sleep as soon as it can, unless some wakelock is explicitly being held by a process. I cannot find that wakelock and I do not know of other possible cause. I am at a loss here.

I will now attach /proc/wakelocks and dumpsys output for both situations (after some five minutes with the screen off)

SSHD RUNNING, dumpsys alarm:

Current Alarm Manager state:

Realtime wakeup (now=2013-11-25 23:01:30):
RTC_WAKEUP #9: Alarm{415e5b48 type 0 os.tools.scriptmanager}
type=0 when=+1d3h58m29s585ms repeatInterval=0 count=0
operation=PendingIntent{415fa310: PendingIntentRecord{41612270 os.tools.scriptmanager broadcastIntent}}
RTC_WAKEUP #8: Alarm{415865a0 type 0 com.koushikdutta.rommanager}
type=0 when=+1d0h3m48s738ms repeatInterval=86400000 count=0
operation=PendingIntent{41574bc8: PendingIntentRecord{4155af48 com.koushikdutta.rommanager broadcastIntent}}
RTC_WAKEUP #7: Alarm{410ef8b0 type 0 com.android.providers.calendar}
type=0 when=+21h50m52s748ms repeatInterval=0 count=0
operation=PendingIntent{412e7680: PendingIntentRecord{412f0b30 com.android.providers.calendar broadcastIntent}}
RTC_WAKEUP #6: Alarm{412ab408 type 0 com.android.deskclock}
type=0 when=+8h3m29s585ms repeatInterval=0 count=0
operation=PendingIntent{4127e500: PendingIntentRecord{4127e4a8 com.android.deskclock broadcastIntent}}
RTC_WAKEUP #5: Alarm{4149a640 type 0 com.android.deskclock}
type=0 when=+8h3m29s585ms repeatInterval=0 count=0
operation=PendingIntent{40fae468: PendingIntentRecord{414ab880 com.android.deskclock broadcastIntent}}
RTC_WAKEUP #4: Alarm{41007ea8 type 0 com.android.deskclock}
type=0 when=+8h3m29s585ms repeatInterval=0 count=0
operation=PendingIntent{4120f3b8: PendingIntentRecord{4126dd60 com.android.deskclock broadcastIntent}}
RTC_WAKEUP #3: Alarm{41242208 type 0 com.whatsapp}
type=0 when=+4h58m29s585ms repeatInterval=86400000 count=0
operation=PendingIntent{410ee5c8: PendingIntentRecord{41360aa0 com.whatsapp broadcastIntent}}
RTC_WAKEUP #2: Alarm{4142d778 type 0 com.zapta.apps.maniana}
type=0 when=+59m29s585ms repeatInterval=86400000 count=0
operation=PendingIntent{41126c60: PendingIntentRecord{41464820 com.zapta.apps.maniana broadcastIntent}}
RTC_WAKEUP #1: Alarm{41107f78 type 0 com.whatsapp}
type=0 when=+58m29s585ms repeatInterval=86400000 count=0
operation=PendingIntent{41117a40: PendingIntentRecord{41298d70 com.whatsapp broadcastIntent}}
RTC_WAKEUP #0: Alarm{40fc8800 type 0 com.cyanogenmod.lockclock}
type=0 when=+19m53s396ms repeatInterval=0 count=0
operation=PendingIntent{40ff3008: PendingIntentRecord{413e16b8 com.cyanogenmod.lockclock startService}}
RTC #3: Alarm{4150fed0 type 1 android}
type=1 when=+12h58m29s585ms repeatInterval=0 count=0
operation=PendingIntent{415cf0b0: PendingIntentRecord{415bf420 android broadcastIntent}}
RTC #2: Alarm{414191d0 type 1 com.google.android.inputmethod.latin}
type=1 when=+1h3m48s738ms repeatInterval=3600000 count=0
operation=PendingIntent{410fdac0: PendingIntentRecord{41419130 com.google.android.inputmethod.latin broadcastIntent}}
RTC #1: Alarm{415b6800 type 1 com.android.calendar}
type=1 when=+58m29s585ms repeatInterval=0 count=0
operation=PendingIntent{4163e538: PendingIntentRecord{4136bc78 com.android.calendar broadcastIntent}}
RTC #0: Alarm{41593c40 type 1 org.mozilla.firefox}
type=1 when=+3m48s392ms repeatInterval=43200000 count=0
operation=PendingIntent{4121c3a0: PendingIntentRecord{414d9148 org.mozilla.firefox broadcastIntent}}

Elapsed realtime wakeup (now=+11m11s656ms):
ELAPSED_WAKEUP #7: Alarm{414af208 type 2 android}
type=2 when=+1d0h3m48s344ms repeatInterval=86400000 count=0
operation=PendingIntent{411380d0: PendingIntentRecord{414af168 android broadcastIntent}}
ELAPSED_WAKEUP #6: Alarm{4154a460 type 2 android}
type=2 when=+1d0h3m48s344ms repeatInterval=86400000 count=0
operation=PendingIntent{41295e78: PendingIntentRecord{4154a3c0 android broadcastIntent}}
ELAPSED_WAKEUP #5: Alarm{41208518 type 2 android}
type=2 when=+4h3m48s344ms repeatInterval=14400000 count=0
operation=PendingIntent{41344de0: PendingIntentRecord{41208478 android broadcastIntent}}
ELAPSED_WAKEUP #4: Alarm{412f5c70 type 2 android}
type=2 when=+1h49m45s195ms repeatInterval=0 count=0
operation=PendingIntent{40ee91b0: PendingIntentRecord{40f99680 android broadcastIntent}}
ELAPSED_WAKEUP #3: Alarm{413703c0 type 2 android}
type=2 when=+1h3m48s344ms repeatInterval=3600000 count=0
operation=PendingIntent{41310750: PendingIntentRecord{41370320 android broadcastIntent}}
ELAPSED_WAKEUP #2: Alarm{41612f90 type 2 android}
type=2 when=+18m30s114ms repeatInterval=0 count=0
operation=PendingIntent{40efaea0: PendingIntentRecord{40efacb0 android broadcastIntent}}
ELAPSED_WAKEUP #1: Alarm{410057e0 type 2 com.whatsapp}
type=2 when=+4m3s267ms repeatInterval=285000 count=1
operation=PendingIntent{410ceea8: PendingIntentRecord{4131fda0 com.whatsapp startService}}
ELAPSED_WAKEUP #0: Alarm{412d6870 type 2 org.dmfs.carddav.sync}
type=2 when=+3m48s344ms repeatInterval=604800000 count=0
operation=PendingIntent{4140b8d8: PendingIntentRecord{413b2d00 org.dmfs.carddav.sync broadcastIntent}}
ELAPSED #5: Alarm{41443cb8 type 3 android}
type=3 when=+23h49m45s204ms repeatInterval=0 count=0
operation=PendingIntent{41236c50: PendingIntentRecord{416301a0 android broadcastIntent}}
ELAPSED #4: Alarm{41562150 type 3 com.android.phone}
type=3 when=+8h3m48s344ms repeatInterval=28800000 count=0
operation=PendingIntent{4155f660: PendingIntentRecord{415914a0 com.android.phone broadcastIntent}}
ELAPSED #3: Alarm{4116a5d8 type 3 com.whatsapp}
type=3 when=+48m48s344ms repeatInterval=3600000 count=1
operation=PendingIntent{41177f40: PendingIntentRecord{412c34a0 com.whatsapp broadcastIntent}}
ELAPSED #2: Alarm{41305310 type 3 android}
type=3 when=+3m48s344ms repeatInterval=1800000 count=0
operation=PendingIntent{41580fe0: PendingIntentRecord{415ba420 android broadcastIntent}}
ELAPSED #1: Alarm{415788b8 type 3 android}
type=3 when=+1m7s510ms repeatInterval=0 count=0
operation=PendingIntent{414a95b0: PendingIntentRecord{4155e9a0 android broadcastIntent}}
ELAPSED #0: Alarm{42305460 type 3 android}
type=3 when=+29s541ms repeatInterval=0 count=0
operation=PendingIntent{415f9bf0: PendingIntentRecord{40f0eef0 android broadcastIntent}}

Broadcast ref count: 0

Top Alarms:
+8s398ms running, 1 wakeups, 1 alarms: com.android.providers.calendar
act=com.android.providers.calendar.intent.CalendarProvider2
+6s948ms running, 0 wakeups, 1 alarms: com.whatsapp
act=ALARM_ACTION
+1s197ms running, 0 wakeups, 10 alarms: android
act=android.intent.action.TIME_TICK
+25ms running, 2 wakeups, 2 alarms: com.whatsapp
act=com.whatsapp.MessageService.KEEP_ALIVE cmp={com.whatsapp/com.whatsapp.messaging.MessageService}
+15ms running, 1 wakeups, 1 alarms: com.whatsapp
act=ALARM_AVAILABLE_TIMEOUT
+7ms running, 2 wakeups, 2 alarms: com.cyanogenmod.lockclock
cmp={com.cyanogenmod.lockclock/com.cyanogenmod.lockclock.weather.WeatherUpdateService}

Alarm Stats:
android +1s197ms running, 0 wakeups:
+1s197ms 0 wakes 10 alarms: act=android.intent.action.TIME_TICK
com.android.providers.calendar +8s398ms running, 1 wakeups:
+8s398ms 1 wakes 1 alarms: act=com.android.providers.calendar.intent.CalendarProvider2
com.cyanogenmod.lockclock +7ms running, 2 wakeups:
+7ms 2 wakes 2 alarms: cmp={com.cyanogenmod.lockclock/com.cyanogenmod.lockclock.weather.WeatherUpdateService}
com.whatsapp +6s988ms running, 3 wakeups:
+6s948ms 0 wakes 1 alarms: act=ALARM_ACTION
+25ms 2 wakes 2 alarms: act=com.whatsapp.MessageService.KEEP_ALIVE cmp={com.whatsapp/com.whatsapp.messaging.MessageService}
+15ms 1 wakes 1 alarms: act=ALARM_AVAILABLE_TIMEOUT

SSHD NOT RUNNING, dumpsys alarm:

Current Alarm Manager state:

Realtime wakeup (now=2013-11-25 23:01:30):
RTC_WAKEUP #9: Alarm{415e5b48 type 0 os.tools.scriptmanager}
type=0 when=+1d3h58m29s585ms repeatInterval=0 count=0
operation=PendingIntent{415fa310: PendingIntentRecord{41612270 os.tools.scriptmanager broadcastIntent}}
RTC_WAKEUP #8: Alarm{415865a0 type 0 com.koushikdutta.rommanager}
type=0 when=+1d0h3m48s738ms repeatInterval=86400000 count=0
operation=PendingIntent{41574bc8: PendingIntentRecord{4155af48 com.koushikdutta.rommanager broadcastIntent}}
RTC_WAKEUP #7: Alarm{410ef8b0 type 0 com.android.providers.calendar}
type=0 when=+21h50m52s748ms repeatInterval=0 count=0
operation=PendingIntent{412e7680: PendingIntentRecord{412f0b30 com.android.providers.calendar broadcastIntent}}
RTC_WAKEUP #6: Alarm{412ab408 type 0 com.android.deskclock}
type=0 when=+8h3m29s585ms repeatInterval=0 count=0
operation=PendingIntent{4127e500: PendingIntentRecord{4127e4a8 com.android.deskclock broadcastIntent}}
RTC_WAKEUP #5: Alarm{4149a640 type 0 com.android.deskclock}
type=0 when=+8h3m29s585ms repeatInterval=0 count=0
operation=PendingIntent{40fae468: PendingIntentRecord{414ab880 com.android.deskclock broadcastIntent}}
RTC_WAKEUP #4: Alarm{41007ea8 type 0 com.android.deskclock}
type=0 when=+8h3m29s585ms repeatInterval=0 count=0
operation=PendingIntent{4120f3b8: PendingIntentRecord{4126dd60 com.android.deskclock broadcastIntent}}
RTC_WAKEUP #3: Alarm{41242208 type 0 com.whatsapp}
type=0 when=+4h58m29s585ms repeatInterval=86400000 count=0
operation=PendingIntent{410ee5c8: PendingIntentRecord{41360aa0 com.whatsapp broadcastIntent}}
RTC_WAKEUP #2: Alarm{4142d778 type 0 com.zapta.apps.maniana}
type=0 when=+59m29s585ms repeatInterval=86400000 count=0
operation=PendingIntent{41126c60: PendingIntentRecord{41464820 com.zapta.apps.maniana broadcastIntent}}
RTC_WAKEUP #1: Alarm{41107f78 type 0 com.whatsapp}
type=0 when=+58m29s585ms repeatInterval=86400000 count=0
operation=PendingIntent{41117a40: PendingIntentRecord{41298d70 com.whatsapp broadcastIntent}}
RTC_WAKEUP #0: Alarm{40fc8800 type 0 com.cyanogenmod.lockclock}
type=0 when=+19m53s396ms repeatInterval=0 count=0
operation=PendingIntent{40ff3008: PendingIntentRecord{413e16b8 com.cyanogenmod.lockclock startService}}
RTC #3: Alarm{4150fed0 type 1 android}
type=1 when=+12h58m29s585ms repeatInterval=0 count=0
operation=PendingIntent{415cf0b0: PendingIntentRecord{415bf420 android broadcastIntent}}
RTC #2: Alarm{414191d0 type 1 com.google.android.inputmethod.latin}
type=1 when=+1h3m48s738ms repeatInterval=3600000 count=0
operation=PendingIntent{410fdac0: PendingIntentRecord{41419130 com.google.android.inputmethod.latin broadcastIntent}}
RTC #1: Alarm{415b6800 type 1 com.android.calendar}
type=1 when=+58m29s585ms repeatInterval=0 count=0
operation=PendingIntent{4163e538: PendingIntentRecord{4136bc78 com.android.calendar broadcastIntent}}
RTC #0: Alarm{41593c40 type 1 org.mozilla.firefox}
type=1 when=+3m48s392ms repeatInterval=43200000 count=0
operation=PendingIntent{4121c3a0: PendingIntentRecord{414d9148 org.mozilla.firefox broadcastIntent}}

Elapsed realtime wakeup (now=+11m11s656ms):
ELAPSED_WAKEUP #7: Alarm{414af208 type 2 android}
type=2 when=+1d0h3m48s344ms repeatInterval=86400000 count=0
operation=PendingIntent{411380d0: PendingIntentRecord{414af168 android broadcastIntent}}
ELAPSED_WAKEUP #6: Alarm{4154a460 type 2 android}
type=2 when=+1d0h3m48s344ms repeatInterval=86400000 count=0
operation=PendingIntent{41295e78: PendingIntentRecord{4154a3c0 android broadcastIntent}}
ELAPSED_WAKEUP #5: Alarm{41208518 type 2 android}
type=2 when=+4h3m48s344ms repeatInterval=14400000 count=0
operation=PendingIntent{41344de0: PendingIntentRecord{41208478 android broadcastIntent}}
ELAPSED_WAKEUP #4: Alarm{412f5c70 type 2 android}
type=2 when=+1h49m45s195ms repeatInterval=0 count=0
operation=PendingIntent{40ee91b0: PendingIntentRecord{40f99680 android broadcastIntent}}
ELAPSED_WAKEUP #3: Alarm{413703c0 type 2 android}
type=2 when=+1h3m48s344ms repeatInterval=3600000 count=0
operation=PendingIntent{41310750: PendingIntentRecord{41370320 android broadcastIntent}}
ELAPSED_WAKEUP #2: Alarm{41612f90 type 2 android}
type=2 when=+18m30s114ms repeatInterval=0 count=0
operation=PendingIntent{40efaea0: PendingIntentRecord{40efacb0 android broadcastIntent}}
ELAPSED_WAKEUP #1: Alarm{410057e0 type 2 com.whatsapp}
type=2 when=+4m3s267ms repeatInterval=285000 count=1
operation=PendingIntent{410ceea8: PendingIntentRecord{4131fda0 com.whatsapp startService}}
ELAPSED_WAKEUP #0: Alarm{412d6870 type 2 org.dmfs.carddav.sync}
type=2 when=+3m48s344ms repeatInterval=604800000 count=0
operation=PendingIntent{4140b8d8: PendingIntentRecord{413b2d00 org.dmfs.carddav.sync broadcastIntent}}
ELAPSED #5: Alarm{41443cb8 type 3 android}
type=3 when=+23h49m45s204ms repeatInterval=0 count=0
operation=PendingIntent{41236c50: PendingIntentRecord{416301a0 android broadcastIntent}}
ELAPSED #4: Alarm{41562150 type 3 com.android.phone}
type=3 when=+8h3m48s344ms repeatInterval=28800000 count=0
operation=PendingIntent{4155f660: PendingIntentRecord{415914a0 com.android.phone broadcastIntent}}
ELAPSED #3: Alarm{4116a5d8 type 3 com.whatsapp}
type=3 when=+48m48s344ms repeatInterval=3600000 count=1
operation=PendingIntent{41177f40: PendingIntentRecord{412c34a0 com.whatsapp broadcastIntent}}
ELAPSED #2: Alarm{41305310 type 3 android}
type=3 when=+3m48s344ms repeatInterval=1800000 count=0
operation=PendingIntent{41580fe0: PendingIntentRecord{415ba420 android broadcastIntent}}
ELAPSED #1: Alarm{415788b8 type 3 android}
type=3 when=+1m7s510ms repeatInterval=0 count=0
operation=PendingIntent{414a95b0: PendingIntentRecord{4155e9a0 android broadcastIntent}}
ELAPSED #0: Alarm{42305460 type 3 android}
type=3 when=+29s541ms repeatInterval=0 count=0
operation=PendingIntent{415f9bf0: PendingIntentRecord{40f0eef0 android broadcastIntent}}

Broadcast ref count: 0

Top Alarms:
+8s398ms running, 1 wakeups, 1 alarms: com.android.providers.calendar
act=com.android.providers.calendar.intent.CalendarProvider2
+6s948ms running, 0 wakeups, 1 alarms: com.whatsapp
act=ALARM_ACTION
+1s197ms running, 0 wakeups, 10 alarms: android
act=android.intent.action.TIME_TICK
+25ms running, 2 wakeups, 2 alarms: com.whatsapp
act=com.whatsapp.MessageService.KEEP_ALIVE cmp={com.whatsapp/com.whatsapp.messaging.MessageService}
+15ms running, 1 wakeups, 1 alarms: com.whatsapp
act=ALARM_AVAILABLE_TIMEOUT
+7ms running, 2 wakeups, 2 alarms: com.cyanogenmod.lockclock
cmp={com.cyanogenmod.lockclock/com.cyanogenmod.lockclock.weather.WeatherUpdateService}

Alarm Stats:
android +1s197ms running, 0 wakeups:
+1s197ms 0 wakes 10 alarms: act=android.intent.action.TIME_TICK
com.android.providers.calendar +8s398ms running, 1 wakeups:
+8s398ms 1 wakes 1 alarms: act=com.android.providers.calendar.intent.CalendarProvider2
com.cyanogenmod.lockclock +7ms running, 2 wakeups:
+7ms 2 wakes 2 alarms: cmp={com.cyanogenmod.lockclock/com.cyanogenmod.lockclock.weather.WeatherUpdateService}
com.whatsapp +6s988ms running, 3 wakeups:
+6s948ms 0 wakes 1 alarms: act=ALARM_ACTION
+25ms 2 wakes 2 alarms: act=com.whatsapp.MessageService.KEEP_ALIVE cmp={com.whatsapp/com.whatsapp.messaging.MessageService}
+15ms 1 wakes 1 alarms: act=ALARM_AVAILABLE_TIMEOUT
nacho@desktop# ps: 0 # ~ $ cat wakes_ok
Current Alarm Manager state:

Realtime wakeup (now=2013-11-25 22:47:32):
RTC_WAKEUP #9: Alarm{4170baa0 type 0 os.tools.scriptmanager}
type=0 when=+1d4h12m27s70ms repeatInterval=0 count=0
operation=PendingIntent{417285b0: PendingIntentRecord{41730f50 os.tools.scriptmanager broadcastIntent}}
RTC_WAKEUP #8: Alarm{41424a30 type 0 com.koushikdutta.rommanager}
type=0 when=+22h16m16s385ms repeatInterval=86400000 count=0
operation=PendingIntent{41430478: PendingIntentRecord{4142b358 com.koushikdutta.rommanager broadcastIntent}}
RTC_WAKEUP #7: Alarm{4189fb98 type 0 com.android.providers.calendar}
type=0 when=+20h3m26s514ms repeatInterval=0 count=0
operation=PendingIntent{419f1d50: PendingIntentRecord{4197b708 com.android.providers.calendar broadcastIntent}}
RTC_WAKEUP #6: Alarm{4171c888 type 0 com.android.deskclock}
type=0 when=+8h17m27s70ms repeatInterval=0 count=0
operation=PendingIntent{413cb518: PendingIntentRecord{4171c798 com.android.deskclock broadcastIntent}}
RTC_WAKEUP #5: Alarm{41983b58 type 0 com.android.deskclock}
type=0 when=+8h17m27s70ms repeatInterval=0 count=0
operation=PendingIntent{4137e6b8: PendingIntentRecord{41983ab8 com.android.deskclock broadcastIntent}}
RTC_WAKEUP #4: Alarm{4159ed68 type 0 com.android.deskclock}
type=0 when=+8h17m27s70ms repeatInterval=0 count=0
operation=PendingIntent{415b7fd0: PendingIntentRecord{415b3348 com.android.deskclock broadcastIntent}}
RTC_WAKEUP #3: Alarm{41719ba0 type 0 com.whatsapp}
type=0 when=+5h12m27s70ms repeatInterval=86400000 count=0
operation=PendingIntent{418c95e8: PendingIntentRecord{4195c738 com.whatsapp broadcastIntent}}
RTC_WAKEUP #2: Alarm{4192e508 type 0 com.zapta.apps.maniana}
type=0 when=+1h13m27s70ms repeatInterval=86400000 count=0
operation=PendingIntent{41a6bae8: PendingIntentRecord{417e8df0 com.zapta.apps.maniana broadcastIntent}}
RTC_WAKEUP #1: Alarm{41734908 type 0 com.whatsapp}
type=0 when=+1h12m27s70ms repeatInterval=86400000 count=0
operation=PendingIntent{417b4120: PendingIntentRecord{41760640 com.whatsapp broadcastIntent}}
RTC_WAKEUP #0: Alarm{41a72a50 type 0 com.cyanogenmod.lockclock}
type=0 when=+27m38s648ms repeatInterval=0 count=0
operation=PendingIntent{415c3920: PendingIntentRecord{41981530 com.cyanogenmod.lockclock startService}}
RTC #3: Alarm{419242e8 type 1 android}
type=1 when=+13h12m27s70ms repeatInterval=0 count=0
operation=PendingIntent{419d8370: PendingIntentRecord{419d8338 android broadcastIntent}}
RTC #2: Alarm{41881f30 type 1 org.mozilla.firefox}
type=1 when=+10h16m17s23ms repeatInterval=43200000 count=1
operation=PendingIntent{419111f8: PendingIntentRecord{41644f90 org.mozilla.firefox broadcastIntent}}
RTC #1: Alarm{4141dfe8 type 1 com.android.calendar}
type=1 when=+1h12m27s70ms repeatInterval=0 count=0
operation=PendingIntent{41631a40: PendingIntentRecord{417225b0 com.android.calendar broadcastIntent}}
RTC #0: Alarm{4193dfd8 type 1 com.google.android.inputmethod.latin}
type=1 when=+16m16s384ms repeatInterval=3600000 count=1
operation=PendingIntent{41734740: PendingIntentRecord{4193dda0 com.google.android.inputmethod.latin broadcastIntent}}

Elapsed realtime wakeup (now=+1h58m42s985ms):
ELAPSED_WAKEUP #7: Alarm{4198e5e8 type 2 org.dmfs.carddav.sync}
type=2 when=+6d22h16m17s15ms repeatInterval=604800000 count=1
operation=PendingIntent{419a02f0: PendingIntentRecord{4198e448 org.dmfs.carddav.sync broadcastIntent}}
ELAPSED_WAKEUP #6: Alarm{419e0bd8 type 2 android}
type=2 when=+22h16m17s15ms repeatInterval=86400000 count=0
operation=PendingIntent{41367678: PendingIntentRecord{419e0b38 android broadcastIntent}}
ELAPSED_WAKEUP #5: Alarm{4173a758 type 2 android}
type=2 when=+22h16m17s15ms repeatInterval=86400000 count=0
operation=PendingIntent{4173a748: PendingIntentRecord{4173a6a8 android broadcastIntent}}
ELAPSED_WAKEUP #4: Alarm{41b31028 type 2 android}
type=2 when=+2h16m17s15ms repeatInterval=14400000 count=0
operation=PendingIntent{41b31018: PendingIntentRecord{41b30f78 android broadcastIntent}}
ELAPSED_WAKEUP #3: Alarm{41a2e5d8 type 2 android}
type=2 when=+26m23s505ms repeatInterval=0 count=0
operation=PendingIntent{4178f6c0: PendingIntentRecord{41828678 android broadcastIntent}}
ELAPSED_WAKEUP #2: Alarm{419dc3e0 type 2 android}
type=2 when=+17m10s130ms repeatInterval=0 count=0
operation=PendingIntent{4160b628: PendingIntentRecord{4160b260 android broadcastIntent}}
ELAPSED_WAKEUP #1: Alarm{416846a8 type 2 android}
type=2 when=+16m17s15ms repeatInterval=3600000 count=1
operation=PendingIntent{41684698: PendingIntentRecord{416845f8 android broadcastIntent}}
ELAPSED_WAKEUP #0: Alarm{414d6688 type 2 com.whatsapp}
type=2 when=+3m27s726ms repeatInterval=285000 count=1
operation=PendingIntent{414d6678: PendingIntentRecord{41852570 com.whatsapp startService}}
ELAPSED #5: Alarm{41920548 type 3 android}
type=3 when=+23h57m38s545ms repeatInterval=0 count=0
operation=PendingIntent{417ecc78: PendingIntentRecord{418c9320 android broadcastIntent}}
ELAPSED #4: Alarm{418f5a60 type 3 com.android.phone}
type=3 when=+6h16m17s15ms repeatInterval=28800000 count=0
operation=PendingIntent{41a57190: PendingIntentRecord{41861fb0 com.android.phone broadcastIntent}}
ELAPSED #3: Alarm{41894448 type 3 android}
type=3 when=+16m17s15ms repeatInterval=1800000 count=1
operation=PendingIntent{41400de8: PendingIntentRecord{4185f338 android broadcastIntent}}
ELAPSED #2: Alarm{4221bd80 type 3 android}
type=3 when=+3m2s102ms repeatInterval=0 count=0
operation=PendingIntent{4156e4a0: PendingIntentRecord{41698da8 android broadcastIntent}}
ELAPSED #1: Alarm{41408568 type 3 com.whatsapp}
type=3 when=+1m17s15ms repeatInterval=3600000 count=1
operation=PendingIntent{417f0f70: PendingIntentRecord{4174b478 com.whatsapp broadcastIntent}}
ELAPSED #0: Alarm{419b6f30 type 3 android}
type=3 when=+27s62ms repeatInterval=0 count=0
operation=PendingIntent{419df2b0: PendingIntentRecord{419df278 android broadcastIntent}}

Broadcast ref count: 0

Top Alarms:
+26s256ms running, 0 wakeups, 118 alarms: android
act=android.intent.action.TIME_TICK
+8s174ms running, 1 wakeups, 1 alarms: com.android.providers.calendar
act=com.android.providers.calendar.intent.CalendarProvider2
+7s615ms running, 0 wakeups, 2 alarms: com.whatsapp
act=ALARM_ACTION
+682ms running, 0 wakeups, 4 alarms: android
act=com.android.server.action.NETWORK_STATS_POLL
+554ms running, 0 wakeups, 10 alarms: android
act=com.android.server.ThrottleManager.action.POLL
+468ms running, 22 wakeups, 22 alarms: com.whatsapp
act=com.whatsapp.MessageService.KEEP_ALIVE cmp={com.whatsapp/com.whatsapp.messaging.MessageService}
+441ms running, 1 wakeups, 1 alarms: org.dmfs.carddav.sync
cmp={org.dmfs.carddav.sync/org.dmfs.carddav.syncadapter.AutoSyncBroadcastReceiver}
+116ms running, 1 wakeups, 1 alarms: android
act=android.appwidget.action.APPWIDGET_UPDATE cmp={net.cactii.flash2/net.cactii.flash2.TorchWidgetProvider}
+71ms running, 0 wakeups, 1 alarms: org.mozilla.firefox
cmp={org.mozilla.firefox/org.mozilla.gecko.background.announcements.AnnouncementsStartReceiver}
+50ms running, 2 wakeups, 2 alarms: com.whatsapp
act=ALARM_AVAILABLE_TIMEOUT

Alarm Stats:
com.android.providers.calendar +8s174ms running, 1 wakeups:
+8s174ms 1 wakes 1 alarms: act=com.android.providers.calendar.intent.CalendarProvider2
org.mozilla.firefox +71ms running, 0 wakeups:
+71ms 0 wakes 1 alarms: cmp={org.mozilla.firefox/org.mozilla.gecko.background.announcements.AnnouncementsStartReceiver}
com.cyanogenmod.lockclock +17ms running, 3 wakeups:
+17ms 3 wakes 3 alarms: cmp={com.cyanogenmod.lockclock/com.cyanogenmod.lockclock.weather.WeatherUpdateService}
android +27s108ms running, 7 wakeups:
+26s256ms 0 wakes 118 alarms: act=android.intent.action.TIME_TICK
+682ms 0 wakes 4 alarms: act=com.android.server.action.NETWORK_STATS_POLL
+554ms 0 wakes 10 alarms: act=com.android.server.ThrottleManager.action.POLL
+116ms 1 wakes 1 alarms: act=android.appwidget.action.APPWIDGET_UPDATE cmp={net.cactii.flash2/net.cactii.flash2.TorchWidgetProvider}
+29ms 1 wakes 1 alarms: act=com.android.internal.policy.impl.PhoneWindowManager.DELAYED_KEYGUARD
+28ms 4 wakes 4 alarms: act=android.net.wifi.DHCP_RENEW
+26ms 1 wakes 1 alarms: act=android.content.syncmanager.SYNC_ALARM
org.dmfs.carddav.sync +441ms running, 1 wakeups:
+441ms 1 wakes 1 alarms: cmp={org.dmfs.carddav.sync/org.dmfs.carddav.syncadapter.AutoSyncBroadcastReceiver}
com.google.android.inputmethod.latin +23ms running, 0 wakeups:
+23ms 0 wakes 1 alarms: act=com.android.inputmethod.latin.personalization.DICT_DECAY cmp={com.google.android.inputmethod.latin/com.android.inputmethod.latin.personalization.DictionaryDecayBroadcastReciever}
com.whatsapp +8s177ms running, 29 wakeups:
+7s615ms 0 wakes 2 alarms: act=ALARM_ACTION
+468ms 22 wakes 22 alarms: act=com.whatsapp.MessageService.KEEP_ALIVE cmp={com.whatsapp/com.whatsapp.messaging.MessageService}
+50ms 2 wakes 2 alarms: act=ALARM_AVAILABLE_TIMEOUT
+44ms 5 wakes 5 alarms: act=com.whatsapp.MessageService.RECONNECT cmp={com.whatsapp/com.whatsapp.messaging.MessageService}

I would really like to find a solution to this... might it be some kernel mechanism I am not aware of?

I can run openSSH server included in Busybox no problem, the device sleeps just fine, the problem comes when I run debian's openSSH using chroot.

Any help would be greatly appreciated.

Nacho