[HOWTO] Enable adb logcat on first boot without authentication (debugging boot loops)

This how-to is meant for people building/editing ROM’s and got stuck in a bootloop (the phone, not the people :slight_smile: ). To debug this we need to have β€œadb logcat”. To enable this modify the following files:

Edit: system/core/adb/daemon/main.cpp
example: /srv/src/PIE/system/core/adb/daemon/main.cpp
β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”

// if (ALLOW_ADBD_NO_AUTH && !android::base::GetBoolProperty(β€œro.adb.secure”, false)) {
// auth_required = false;
// }
auth_required = false;
β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”

Edit: system.prop in your device tree
example: /srv/src/PIE/device/leeco/s2/system.prop
β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”

persist.service.adb.enable=1                                                    
persist.service.debuggable=1
persist.sys.usb.config=mtp,adb

β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”

Build and flash the ROM.

Now type adb logcat in a terminal and boot the phone, hopefully you get to see the error.

PS: the main.cpp is kind of a hack, there must be a β€œconfig” way to do it, but I did not find it yet.

2 Likes