So, you built a rom, and something went wrong. It’s stuck at the boot logo, or it does boot up, but doesn’t do “xyz” action, or it crashes right after you get to the home screen. You’ve played this game before, you pull logs, and all you can see is line after line of errors. Where do you start?

This happens to me all the time. It can be really tough trying to figure out which error is the one that brought the system down, but there are a few key tips to help you unlock the real problem.

  • Look for the key phrases, like “beginning of crash”

Typically, this phrase is when things are going downhill fast. Oft, when things are at this point, the following data will repeat itself and may or may not be helpful, as it may or may not be able to finish writing down the issue. Typically, the lines just before and after this phrase are your biggest clue. Here’s an example:

08-14 15:55:22.357 1468 1468 E System : ******************************************
08-14 15:55:22.358 1468 1468 E System : ************ Failure starting system services
08-14 15:55:22.358 1468 1468 E System : java.lang.IllegalStateException: Signature|privileged permissions not in privapp-permissions whitelist: {com.android.systemui: android.permission.NAVIGATION_EDITOR, org.omnirom.omnistyle: android.permission.CHANGE_OVERLAY_PACKAGES, com.android.systemui: android.permission.PACKAGE_USAGE_STATS, com.android.settings: android.permission.ACCESS_FONT_MANAGER, com.android.settings: android.permission.NAVIGATION_EDITOR, com.android.systemui: android.permission.FORCE_STOP_PACKAGES, com.android.launcher3: android.permission.STATUS_BAR}
08-14 15:55:22.358 1468 1468 E System : at com.android.server.pm.permission.PermissionManagerService.systemReady(PermissionManagerService.java:2005)
08-14 15:55:22.358 1468 1468 E System : at com.android.server.pm.permission.PermissionManagerService.access$100(PermissionManagerService.java:89)
08-14 15:55:22.358 1468 1468 E System : at com.android.server.pm.permission.PermissionManagerService$PermissionManagerInternalImpl.systemReady(PermissionManagerService.java:2052)
08-14 15:55:22.358 1468 1468 E System : at com.android.server.pm.PackageManagerService.systemReady(PackageManagerService.java:21423)
08-14 15:55:22.358 1468 1468 E System : at com.android.server.SystemServer.startOtherServices(SystemServer.java:1791)
08-14 15:55:22.358 1468 1468 E System : at com.android.server.SystemServer.run(SystemServer.java:464)
08-14 15:55:22.358 1468 1468 E System : at com.android.server.SystemServer.main(SystemServer.java:309)
08-14 15:55:22.358 1468 1468 E System : at java.lang.reflect.Method.invoke(Native Method)
08-14 15:55:22.358 1468 1468 E System : at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:495)
08-14 15:55:22.358 1468 1468 E System : at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:838)
08-14 15:55:22.359 1468 1468 D SystemServerTiming: MakePackageManagerServiceReady took to complete: 514ms
08-14 15:55:22.359 1468 1468 E Zygote : System zygote died with exception
08-14 15:55:22.359 1468 1468 E Zygote : java.lang.IllegalStateException: Signature|privileged permissions not in privapp-permissions whitelist: {com.android.systemui: android.permission.NAVIGATION_EDITOR, org.omnirom.omnistyle: android.permission.CHANGE_OVERLAY_PACKAGES, com.android.systemui: android.permission.PACKAGE_USAGE_STATS, com.android.settings: android.permission.ACCESS_FONT_MANAGER, com.android.settings: android.permission.NAVIGATION_EDITOR, com.android.systemui: android.permission.FORCE_STOP_PACKAGES, com.android.launcher3: android.permission.STATUS_BAR}
08-14 15:55:22.359 1468 1468 E Zygote : at com.android.server.pm.permission.PermissionManagerService.systemReady(PermissionManagerService.java:2005)
08-14 15:55:22.359 1468 1468 E Zygote : at com.android.server.pm.permission.PermissionManagerService.access$100(PermissionManagerService.java:89)
08-14 15:55:22.359 1468 1468 E Zygote : at com.android.server.pm.permission.PermissionManagerService$PermissionManagerInternalImpl.systemReady(PermissionManagerService.java:2052)
08-14 15:55:22.359 1468 1468 E Zygote : at com.android.server.pm.PackageManagerService.systemReady(PackageManagerService.java:21423)
08-14 15:55:22.359 1468 1468 E Zygote : at com.android.server.SystemServer.startOtherServices(SystemServer.java:1791)
08-14 15:55:22.359 1468 1468 E Zygote : at com.android.server.SystemServer.run(SystemServer.java:464)
08-14 15:55:22.359 1468 1468 E Zygote : at com.android.server.SystemServer.main(SystemServer.java:309)
08-14 15:55:22.359 1468 1468 E Zygote : at java.lang.reflect.Method.invoke(Native Method)
08-14 15:55:22.359 1468 1468 E Zygote : at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:495)
08-14 15:55:22.359 1468 1468 E Zygote : at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:838)
08-14 15:55:22.360 1468 1468 D AndroidRuntime: Shutting down VM
——— beginning of crash
08-14 15:55:22.361 1468 1468 E AndroidRuntime: *** FATAL EXCEPTION IN SYSTEM PROCESS: main
08-14 15:55:22.361 1468 1468 E AndroidRuntime: java.lang.IllegalStateException: Signature|privileged permissions not in privapp-permissions whitelist: {com.android.systemui: android.permission.NAVIGATION_EDITOR, org.omnirom.omnistyle: android.permission.CHANGE_OVERLAY_PACKAGES, com.android.systemui: android.permission.PACKAGE_USAGE_STATS, com.android.settings: android.permission.ACCESS_FONT_MANAGER, com.android.settings: android.permission.NAVIGATION_EDITOR, com.android.systemui: android.permission.FORCE_STOP_PACKAGES, com.android.launcher3: android.permission.STATUS_BAR}
08-14 15:55:22.361 1468 1468 E AndroidRuntime: at com.android.server.pm.permission.PermissionManagerService.systemReady(PermissionManagerService.java:2005)
08-14 15:55:22.361 1468 1468 E AndroidRuntime: at com.android.server.pm.permission.PermissionManagerService.access$100(PermissionManagerService.java:89)
08-14 15:55:22.361 1468 1468 E AndroidRuntime: at com.android.server.pm.permission.PermissionManagerService$PermissionManagerInternalImpl.systemReady(PermissionManagerService.java:2052)
08-14 15:55:22.361 1468 1468 E AndroidRuntime: at com.android.server.pm.PackageManagerService.systemReady(PackageManagerService.java:21423)
08-14 15:55:22.361 1468 1468 E AndroidRuntime: at com.android.server.SystemServer.startOtherServices(SystemServer.java:1791)
08-14 15:55:22.361 1468 1468 E AndroidRuntime: at com.android.server.SystemServer.run(SystemServer.java:464)
08-14 15:55:22.361 1468 1468 E AndroidRuntime: at com.android.server.SystemServer.main(SystemServer.java:309)
08-14 15:55:22.361 1468 1468 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
08-14 15:55:22.361 1468 1468 E AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:495)
08-14 15:55:22.361 1468 1468 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:838)
08-14 15:55:22.368 1468 1856 V FontService: CurrentFontPreviewDir absolute path = /data/system/theme/font_previews/com.custom.fonts/Inconsolata
08-14 15:55:22.369 1468 1468 I Process : Sending signal. PID: 1468 SIG: 9

Other great phrases to watch for are:

  1. crash
  2. fail
  3. not found
  4. error
  5. fatal

Usually these phrases will be what you are looking for.

I highlighted the “beginning of crash” line in bold and underlined it to make it easier for you to read. Here we see that the preceding 20-ish lines and following 20-ish lines are all about how the system is struggling with a fatal error, because there are permission issues. (I’ll talk more about solving this next post.)

That’s fine and dandy if you have an actual crash, but doesn’t help if you just have errors in the log and something isn’t functioning correctly. Or sometimes you can have a crash, but there is no “tattle-tale” information that shows you what the problem is. You just start going back through all the “E” errors in the log trying to find one that is the culprit.

  • Compare your log to another to sort out minor errors.

This is not always a viable option, but it has been helpful for me in the past. For instance, recently I purchased an Xperia XA2 Ultra. It had a LineageOS Pie build, but no Resurrection Remix Pie, so I decided to make one. RR didn’t finish booting, but there were a lot of errors in the file, and it was difficult to pinpoint which one was the main culprit.

Take for example, this line:

E Sensors : sns_reg_conf_la.c(766):cei_project_id = BY25

Is it a big deal, or not?

So, I took a logcat of the good, booting, functional LineageOS Pie rom, and a logcat of the bad, not booting RR rom, and compared them with diffuse. Turns out that the above line is in both files, so it’s not too big of a concern right now (but I should fix it later).

lin_rr

This can be very tedious, though, as 28 thousand lines is a lot to sort through. Fortunately, Linux has some handy commands to help you with that. First, I cut the time out of the files:

$ cut -c31- linfirstbootedit.txt |tee linNoTime.txt
$ cut -c31- rrFirstBootedit.txt |tee rrNoTime.txt

Now I had the files without the time at the beginning, which makes them easier to sort. Then, I sorted them and compared them, pulling only the different lines.

comm -23 <(sort rrNoTime.txt) <(sort linNoTime.txt) > Just_rr_Uniq.txt

The sort function puts them in alphanumeric order. Once the two files are sorted, they are compared, and I only take the output of the RR log file that is unique. Now I have eliminated all errors that were in both files. Thus, any errors that were in LineageOS were okay for booting (not okay totally, but didn’t prevent function).

Now I have a list of just the unique lines. Now I can just grab the errors:

cat Just_rr_Uniq.txt |grep ^” E”

And viola! Now I am only looking at the errors that are unique to the RR rom. That cut my file from 28000 lines to a simple 1280! Whatever these errors are, they would be a good place to start looking, since they only happen on the rom that doesn’t work properly.

It’s also good to keep your original logcat untouched, so you can reference it later. Note that the grep’d, sorted, and cut file will be missing key information around the error you are looking at. Hopefully that helps you get pointed in the right direction.

Linux – keep it simple.

Leave a Reply

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