1

I can't read the logcat from my phone. As an Android Developer, this is terrible for me. The message that I'm getting is:

logcat read failure

Looking the sources, it seems like a generic error:

Code from the source (Github, logcat.cpp)

while (!g_maxCount || (g_printCount < g_maxCount)) {
    struct log_msg log_msg;
    log_device_t* d;
    int ret = android_logger_list_read(logger_list, &log_msg);

    if (ret == 0) {
        logcat_panic(false, "read: unexpected EOF!\n");
    }

    if (ret < 0) {
        if (ret == -EAGAIN) {
            break;
        }

        if (ret == -EIO) {
            logcat_panic(false, "read: unexpected EOF!\n");
        }
        if (ret == -EINVAL) {
            logcat_panic(false, "read: unexpected length.\n");
        }
        logcat_panic(false, "logcat read failure");
    }

My phone is rooted and has the bootloader unlocked. I'm using stock kernel. I've no clues. Any ideas, something to try?

Thanks in advance

  • 1
    Flaggers: Despite containing code, this is not a development question -- logcat is a command-line utility that is useful to all power users. – Matthew Read May 24 '16 at 4:09
  • It's too bad that the return value is just dropped completely if it's not one of those three, it ought to be printed. In any case, when did this start happening? Does it persist after a reboot? – Matthew Read May 24 '16 at 4:10
  • Thanks @Matthew. It started when I rooted it, and yes, it persists after a reboot (have been one month without logcat). – webo80 May 24 '16 at 7:25
  • Hmm, could be some filesystem permissions that were messed up by the rooting. SuperSU or a recovery like CWM or TWRP should have a "Fix permissions" option that you could try, although sometimes it makes things worse. – Matthew Read May 24 '16 at 20:37
  • I'll try it, thanks. Hope not to make things worse ;) – webo80 May 25 '16 at 8:49
1

Are you using a custom rom ? I have the same problem, here is how I solved it partially: Download this: https://drive.google.com/file/d/0B7Mx2p0Jd24Jcm9fNEV6d0xDV1E/view

Put this file to root/system/bin an rename it to logd. Attribut -rwxr-xr-x (755) an reboot your Phone. After that logging works. This file has been deleted because it consumes a lot of battery. After logging, rename the file in logd.xxx and restart your phone. Thereafter, the battery consumption is reduced again.

More Description http://forum.xda-developers.com/g4/help/guide-disable-logd-process-battery-drain-t3308921#post65168793

then download a logcat reader app from playstore. Unfortunately, logcat from computer still don't work :( I'm still searching a solution for logcat from computer

  • even from computer ? Personally I can't get it working on my computer – n0tis Jun 15 '16 at 16:18
  • no, not from the computer... only with the alogcat app – webo80 Jun 16 '16 at 11:04
  • :( tell me if one day you get it working from computer.... If you are interested, I have asked the question in this xda thread: forum.xda-developers.com/g4/development/… no response so far :/ – n0tis Jun 16 '16 at 13:14
  • OK, i'll tell you. Mine is not working, but have you tried to access a shell (adb shell) and execute the 'logcat' command? – webo80 Jun 17 '16 at 11:49
  • 1
    @n0tis @webo80 This is an old question, I know, but I recently encountered this same problem. The fix? After logd is copied to /system/bin, run chcon u:object_r:logd_exec:s0 /system/bin/logd. That should load it with the correct SELinux context. – kirbyfan64sos Dec 4 '16 at 21:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.