Android DDMS v22.0.1 unable to generate a systrace using Droid Razor 4.1.2-ThrowExceptions

Exception or error:

I’ve selected several of the trace tags and when I run the trace (from DDMS) I get the following output:

Unexpected error while collecting system trace. Unable to find trace start marker 'TRACE:':
error opening /sys/kernel/debug/tracing/options/overwrite: 
No such file or directory (2)

error openi(cuts off the error here)

indeed there is no debug file in the kernel directory, but which mechanism will generate the necessary path?

How to solve:

It looks like your cellphone is running a boot(kernel) image that does not support systrace.

“error opening /sys/kernel/debug/tracing/options/overwrite: No such file or directory (2)”

This error message means adb daemon (the adb module running on device side) could not find /sys/kernel/debug/tracing/options/overwrite on your device’s file system. systrace works over adb and communicates with kernel though sysfs nodes under /sys/kernel/debug/tracing. If these nodes are not exposed on you phone for whatever reason, systrace just will not work.

So you should first get a shell on your device using:

adb shell

Then browse to confirm if /sys exists at all and if /sys/kernel/debug/tracing exists.

If they are there which is extremely unlikely, you have to debug to figure out how come systrace think the nodes were not there. Otherwise, you need to flash a different boot image which has systrace support, because sysfs is controlled by kernel(mostly by configurations at compile time) and init.rc , both of which are part of boot image.

Flashing a different boot image might involve unlocking/rooting the device. You probably have to go to fan sites like xdadeveloper for information and image. Another option is to download the source of kernel for your device, compile kernel and make the boot image yourself. Linux is under GPL thus manufacturer of your device is obligated to release the source code of the specialized kernel they use.



You may need to slightly modify the kernel image(boot.img). The following work find for me, just for your reference.

  1. open terminal and enter: $adb shell
  2. (1) $su (2) $mount -t debugfs none /sys/kernel/debug. Now you should be able to see many directories under /sys/kernel/debug/. (You may cd into /sys/kernel/debug to confirm this)
  3. Enter: $dd if=/dev/block/platform/msm_sdcc.1/by-name/boot of=/sdcard/boot.img to generate the boot.img kernel image from your device.
  4. Use AndroidImageKitchen to unpack the boot.img and find the default.prop within Ramdisk folder. Then change ro.debuggable=0 to ro.debuggable=1. Repack the boot.img and flash boot it to your device.
  5. Once the device boot, under terminal, enter: $adb root and message like: $restarting adbd as root may pop up. Disconnect the USB and connect again.
  6. cd to the systrace folder, e.g. ~/androidSDK/platform-tools/systrace and use:
    python --time=10 -o mynewtrace.html sched gfx view wm
  7. Now you may able to generate your own systrace files.

Leave a Reply

Your email address will not be published. Required fields are marked *