[Universal] [Flashable] [Logcat] [Guide] So your test ROM build didn't boot

Search This thread

USA-RedDragon

Senior Member
Mar 22, 2013
569
1,641
0
Moore, OK
Hello all,

I've noticed the lack of a guide for pulling ADB logs for developers. Being a developer, I wanted a quick link to send people to, rather than reexplaining.

If you are looking for a GENERAL explanation on how to get a logcat, or setup your computer for pulling a logcat, look at this amazing guide here:
http://forum.xda-developers.com/showthread.php?t=2274119

Consider this guide an extension for the above thread, making an easy how-to for developers to point people to.

What this guide is NOT:
- A guide on how to pull a logcat in general
- A guide on how to setup adb on a computer

This guide is/will:
-Assume you know how to connect via adb
-Assume you have installed drivers and adb
-A way to show common users to get the logs the developers need

So I personally build for devices I don't own. A LOT. So, should it bootloop(specifically this) or not boot at all, I NEED these logs to help fix the problem. Most users are willing to do so..... as long as you teach them. So this is my one-size-fits-all guide to this.

Note: Later, I will do a write-up on how to pull kernel logs as an extension to this in the second post

To pull a logcat during a bootloop, you need to have adb permissive. This can be done several ways. I have added to the build.prop manually before but that was in TWRP and is a pain to guide users on. It's SUPPOSED to be done with the ramdisk, but I can't ask users to pull their ramdisk and edit it and reflash. So I have made a flashable zip to extract ramdisk and add a permissive adb property to default.prop

The zip will be in the downloads below, all you need to do is flash it when you see a ROM is bootlooping.

Note: Some kernels may not work with this, and it's based off of Anykernel. If the zip fails, don't worry, it has a fallback that it will add same thing to build.prop, and that should usually work.

After flashing, hook the phone/tablet up to your computer and run this in your Terminal:
On Linux:
Code:
adb logcat >  ~/log.txt
That will store logcat into your home folder.
On Windows:
Code:
adb logcat >  %UserProfile%/Desktop/log.txt
That will store logcat on your Desktop.

How do I stop logging?
You can either stop logging by hitting [CTRL] + C in the terminal or by unplugging device.

How do I know when to stop logging?
Usually, you can safely stop logging after about one minute for MOST problems, BUT I believe 5 minutes of logging would be the best bet to stop logging, so all the errors are caught.

How do I get the log to the developer?
You can get a log to a developer by Dropbox, Google Drive, or a file sharing site, but personally I like pasting sites like hastebin.com, pastebin.com, or paste.ubuntu.com. This is a developers/users personal preference though. Personally, I really, really like hastebin. For a pasting site, just open it in your browser and open the log with notepad or equivalent, and do [CTRL] + A and [CTRL] + C to copy the whole log, then paste onto the site. Then share the link the site gives you with the developer.

How do I get the log, when I didn't even get to the boot animation?
Usually, this is a kernel problem, and is almost deserving of it's own write-up, and instructions will be available in the second post.

Thank you all, and should you see a problem, or need more questions answered, please tell me so in replies.

Keep it cool,
Jacob(USA-RedDragon)
 

Attachments

  • LogcatFlasher-0.1.zip
    877.7 KB · Views: 5,474

USA-RedDragon

Senior Member
Mar 22, 2013
569
1,641
0
Moore, OK
So your kernel didn't boot. Well dang. This can be one of the worst problems. So, I'm going to HOPE you have TWRP, since CWM is pretty much dead.

This is more advanced, because you have to use Terminal command in TWRP.

Now, don't be daunted by this, since it's terminal commands, it's quite easy.

As a general rule of thumb(there are different devices with different kernel logs, though), 3.10 kernels(pretty much anything in the last 2 years) have a log in /sys/fs/pstore/console-ramoops and 3.4 and prior kernels have /proc/last_kmsg.

You can see kernel version in Settings -> About Phone

So to pull these logs, you need to be in TWRP DIRECTLY after a failed boot.

Go to Advanced->Terminal Command and type these commands in. One will fail the other will work. Should both of them fail, restart and try to boot again, then go back to TWRP.

Code:
cp /proc/last_kmsg /sdcard/kernellog.txt
Code:
cp /sys/fs/pstore/console-ramoops /sdcard/kernellog.txt

Now you can restore your backup and boot normally. Once you've booted up, you can either share the files with Google Drive or Dropbox or whatever in Android, or you can pull them to your computer with these Terminal commands:
On Linux:
Code:
adb pull /sdcard/kernellog.txt ~/kernellog.txt
That will store log into your home folder.
On Windows:
Code:
adb pull /sdcard/kernellog.txt %UserProfile%/Desktop/kernellog.txt
That will store log onto your Desktop.

Then share log like you would in the above post
 
Last edited:

rachit011

Senior Member
Jun 19, 2015
87
12
0
I flashed logcatflasher zip via twrp and connected my device. I wrote command for windows but there was no logging in the terminal
 

HACK3DANDR0ID

Senior Member
May 25, 2017
1,158
323
0
41
New Jersey
I am currently testing out Custom ROMs for DEVs and I cannot find how to take a Log if I cannot Boot the device or get into TWRP. With newer devices, for example, I am currently working on a OnePlus 6, with A/B Partitions. If the device does not boot on A, it is supposed to Boot on B, so with this application, how to take a Log before the device switches Partitions and Boots on the Partition that CAN Boot?
 

Sutan99

Member
Aug 11, 2018
27
1
13
Brebes
box-mit.blogspot.com
So your kernel didn't boot. Well dang. This can be one of the worst problems. So, I'm going to HOPE you have TWRP, since CWM is pretty much dead.

This is more advanced, because you have to use Terminal command in TWRP.

Now, don't be daunted by this, since it's terminal commands, it's quite easy.

As a general rule of thumb(there are different devices with different kernel logs, though), 3.10 kernels(pretty much anything in the last 2 years) have a log in /sys/fs/pstore/console-ramoops and 3.4 and prior kernels have /proc/last_kmsg.

You can see kernel version in Settings -> About Phone

So to pull these logs, you need to be in TWRP DIRECTLY after a failed boot.

Go to Advanced->Terminal Command and type these commands in. One will fail the other will work. Should both of them fail, restart and try to boot again, then go back to TWRP.

Code:
cp /proc/last_kmsg /sdcard/kernellog.txt
Code:
cp /sys/fs/pstore/console-ramoops /sdcard/kernellog.txt

Now you can restore your backup and boot normally. Once you've booted up, you can either share the files with Google Drive or Dropbox or whatever in Android, or you can pull them to your computer with these Terminal commands:
On Linux:
Code:
adb pull /sdcard/kernellog.txt ~/kernellog.txt
That will store log into your home folder.
On Windows:
Code:
adb pull /sdcard/kernellog.txt %UserProfile%/Desktop/kernellog.txt
That will store log onto your Desktop.

Then share log like you would in the above post
sorry but in my device wasn't have this "/sys/fs/pstore/console-ramoops" I was browse, and did not found it... only have "sys/fs/..." if I try, still work it or not?
 
Apr 19, 2019
34
9
0
I have a couple of questions and I'm hoping that this forum can provide a response.

1. adb logcat not found
I have a linux laptop and have installed platform tools and have used fastboot, adb sideload quite a bit. But adb logcat just does not work.
see below while inside TWRP

5x $ adb devices
List of devices attached
00ca0a5e7fe31c03 recovery
5x $ adb logcat
/sbin/sh: exec: line 1: logcat: not found
5x $ adb shell
~ # logcat
/sbin/sh: logcat: not found

whats missing?

2. When should adb logcat be run if I wanted to capture logs when my phone keeps spinning on google animation? Can i run adb logcat > foo while I'm in recovery and then reboot from recovery or is there a different method?

thanks
 
Apr 19, 2019
34
9
0
I was hoping that someone could respond to the right way to capture logs during bootloop.
My problem:
Trying to capture logs on a bootloop of andrid 10 pixel experience on nexus 5x.

What I have do so far?

Flashed the ROM and zip and rebooted. No logcat seen.

My specific question.
OP says this.

After flashing, hook the phone/tablet up to your computer and run this in your Terminal:
On Linux:
Code:
adb logcat > ~/log.txt


My problem is that when the phone is rebooting, adb devices does not show anything and thus adb logcat always displays a <waiting for device> message. Thus, how can any log be captured to debug the problem?
 

Top Liked Posts

  • There are no posts matching your filters.
  • 23
    Hello all,

    I've noticed the lack of a guide for pulling ADB logs for developers. Being a developer, I wanted a quick link to send people to, rather than reexplaining.

    If you are looking for a GENERAL explanation on how to get a logcat, or setup your computer for pulling a logcat, look at this amazing guide here:
    http://forum.xda-developers.com/showthread.php?t=2274119

    Consider this guide an extension for the above thread, making an easy how-to for developers to point people to.

    What this guide is NOT:
    - A guide on how to pull a logcat in general
    - A guide on how to setup adb on a computer

    This guide is/will:
    -Assume you know how to connect via adb
    -Assume you have installed drivers and adb
    -A way to show common users to get the logs the developers need

    So I personally build for devices I don't own. A LOT. So, should it bootloop(specifically this) or not boot at all, I NEED these logs to help fix the problem. Most users are willing to do so..... as long as you teach them. So this is my one-size-fits-all guide to this.

    Note: Later, I will do a write-up on how to pull kernel logs as an extension to this in the second post

    To pull a logcat during a bootloop, you need to have adb permissive. This can be done several ways. I have added to the build.prop manually before but that was in TWRP and is a pain to guide users on. It's SUPPOSED to be done with the ramdisk, but I can't ask users to pull their ramdisk and edit it and reflash. So I have made a flashable zip to extract ramdisk and add a permissive adb property to default.prop

    The zip will be in the downloads below, all you need to do is flash it when you see a ROM is bootlooping.

    Note: Some kernels may not work with this, and it's based off of Anykernel. If the zip fails, don't worry, it has a fallback that it will add same thing to build.prop, and that should usually work.

    After flashing, hook the phone/tablet up to your computer and run this in your Terminal:
    On Linux:
    Code:
    adb logcat >  ~/log.txt
    That will store logcat into your home folder.
    On Windows:
    Code:
    adb logcat >  %UserProfile%/Desktop/log.txt
    That will store logcat on your Desktop.

    How do I stop logging?
    You can either stop logging by hitting [CTRL] + C in the terminal or by unplugging device.

    How do I know when to stop logging?
    Usually, you can safely stop logging after about one minute for MOST problems, BUT I believe 5 minutes of logging would be the best bet to stop logging, so all the errors are caught.

    How do I get the log to the developer?
    You can get a log to a developer by Dropbox, Google Drive, or a file sharing site, but personally I like pasting sites like hastebin.com, pastebin.com, or paste.ubuntu.com. This is a developers/users personal preference though. Personally, I really, really like hastebin. For a pasting site, just open it in your browser and open the log with notepad or equivalent, and do [CTRL] + A and [CTRL] + C to copy the whole log, then paste onto the site. Then share the link the site gives you with the developer.

    How do I get the log, when I didn't even get to the boot animation?
    Usually, this is a kernel problem, and is almost deserving of it's own write-up, and instructions will be available in the second post.

    Thank you all, and should you see a problem, or need more questions answered, please tell me so in replies.

    Keep it cool,
    Jacob(USA-RedDragon)
    14
    So your kernel didn't boot. Well dang. This can be one of the worst problems. So, I'm going to HOPE you have TWRP, since CWM is pretty much dead.

    This is more advanced, because you have to use Terminal command in TWRP.

    Now, don't be daunted by this, since it's terminal commands, it's quite easy.

    As a general rule of thumb(there are different devices with different kernel logs, though), 3.10 kernels(pretty much anything in the last 2 years) have a log in /sys/fs/pstore/console-ramoops and 3.4 and prior kernels have /proc/last_kmsg.

    You can see kernel version in Settings -> About Phone

    So to pull these logs, you need to be in TWRP DIRECTLY after a failed boot.

    Go to Advanced->Terminal Command and type these commands in. One will fail the other will work. Should both of them fail, restart and try to boot again, then go back to TWRP.

    Code:
    cp /proc/last_kmsg /sdcard/kernellog.txt
    Code:
    cp /sys/fs/pstore/console-ramoops /sdcard/kernellog.txt

    Now you can restore your backup and boot normally. Once you've booted up, you can either share the files with Google Drive or Dropbox or whatever in Android, or you can pull them to your computer with these Terminal commands:
    On Linux:
    Code:
    adb pull /sdcard/kernellog.txt ~/kernellog.txt
    That will store log into your home folder.
    On Windows:
    Code:
    adb pull /sdcard/kernellog.txt %UserProfile%/Desktop/kernellog.txt
    That will store log onto your Desktop.

    Then share log like you would in the above post
    1
    FAQs:
    None at this time
    1
    Thank you to answer me,is there any thread or guide can help me,I don't know how to use it.

    just donwload the file and extract adbd in system/xbin (rom)

    and the command is the same as normal logcat

    sorry for my english
Our Apps
Get our official app!
The best way to access XDA on your phone
Nav Gestures
Add swipe gestures to any Android
One Handed Mode
Eases uses one hand with your phone