After being annoyed with my previous ROM, I thought I'd install ICS on my SGS2 (until CM9 comes out). But, sadly, it now reboots several times a day without any real reason. The device is just lying there on the table doing nothing and every now and then the screen turns on and I can watch it reboot.

So, how would I start to analyse this issue? Obviously I could try to flash different ROMs like a mad man until the issue resolves itself, but I would prefer a more sensible approach.

5 Answers
5

You can install the android SDK and use DDMS to monitor the logcat. The thing with a logcat, it is cleared when the device reboots, but you may be able to get an idea of what is crashing if you are monitoring it before it reboots.

You can probably also find unofficial CM9 nightlies for the Galaxy S2, but I am not sure what issues still exist for that device.

I had a similar random-rebooting problem, and after one such reboot, I hooked up the phone to my laptop and ran "adb bugreport" on it. I got what looked like useful information, and attached it to the bug. So I think at least some log information survives a reboot.

Oh wow, that generates a TON of output. I'll run it again after the next reboot and see what it spits out.
–
Oliver SalzburgJan 30 '12 at 19:07

I've been going crazy trying to figure out a random reboot on one of my test phones. I'm not the OP, but this is extremely helpful, thanks for posting it!
–
amyFeb 5 '12 at 9:22

My answer is three years old. Since then, Android has gotten a built-in way of submitting (what I assume are) crash reports: Settings / About phone / Send feedback about this device. I used that a number of times on Android 5.0, and when 5.1 came out, I got a little note from Google saying "thanks for helping us make 5.1 more stable" ... and it hasn't rebooted since I upgraded to 5.1!
–
offby1Apr 6 at 19:56

The first thing I would try to do is to retrieve the logs of the errors via ADB, and/or crash dumps.

Retrieving the logs is tricky, since the log cache gets erased on reboot. If the phone reboots even while sitting on a charger, try running adb logcat continuously (you will need Android SDK and USB drivers installed and configured on your PC.) When the phone reboots, look at the last several pages in the command prompt window for any errors or abnormalities.

If you can't reproduce the reboots while the phone is hooked up to USB, I suggest installing an app like aLogcat, and setting it up to write logs to the SD Card on an interval. Hopefully you will get lucky and catch the errors that way.

You can also try pulling out the crash dumps via the following commands:

su
cat /proc/last_kmsg > /mnt/sdcard/last_kmsg

This should create a file named "last_kmsg" on your SD Card that contains last few debugging messages from the kernel. Open it with any text editor and see if anything obvious shows up.

You can try aLogrec, and if you like it, the donate version. Written by the same programmer that wrote aLogcat, it continuously records the log (logcat) to your SD card. I haven't tested it for how it reacts with restart from a crash, but I tested with a manual restart and the recorded log survived the restart and could see the shutdown sequence being logged. One downside is the log does not include timestamps.

My T-mobile S II had been crashing (restarting) when using basic features - ending a call (once), taking a picture (once) or using navigation (3 times). I upgraded from ICS 4.0.3 to 4.0.4. So far it has been good. I wish I had known about aLogrec while I was having these restarts.

I had the same problem but in the few minutes it gave me each time I experimented and found that it stopped crashing if I went to the network update in the settings, even though there is no update available. It now works but I'd annoying needing to do that every time.