Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,731,698 Members 50,088 Now Online
XDA Developers Android and Mobile Development Forum

[KERNEL] adb "cannot run as root in production builds" fix

Tip us?
 
Hexabit
Old
#1  
Junior Member - OP
Thanks Meter 10
Posts: 4
Join Date: Oct 2010
Default [KERNEL] adb "cannot run as root in production builds" fix

Discovering "adb shell" gave joy, experiencing the shell as minimal bash with awful line handling (backspace and command recall) gave annoyance, experiencing "adb root" refusing access gave frustration.

After some tracking, it turns out that adbd behaviour is determined by the property "ro.debuggable" which is set during system init. The initial value is located in the file "/default.prop". In JP6 it is set to 0 resulting is adbd refusing access. However, set to 1, "adbd root" will give the much better response of "restarting adbd as root".

Once set, the property value cannot be changed. To get this fixed you need to change the contents of the file default.prop which is located in the initial ramdisk image.

Optionally, you can put a replacement shell in /sbin of in ramdisk image so that when connected "exec bash" will make things more relaxing. I attached the version I am using, which is statically linked with ncurses/readline.

There is also a simple patch to unlock adbd if you dislike opening and rebuilding the ramdisk image. However, you do need binoffset which is located in the scripts directory of the linux source tree.

Code:
ofs=`scripts/binoffset initramfs.cpio \`echo -n 'debuggable=0' | od -t u1 -An\` 2>/dev/null`
echo 'debuggable=1' | dd bs=1 seek=$ofs conv=notrunc of=initramfs.cpio
Attached Files
File Type: rar bash.rar - [Click for QR Code] (527.3 KB, 3266 views)
The Following 4 Users Say Thank You to Hexabit For This Useful Post: [ Click to Expand ]
 
xchargerx
Old
#2  
Junior Member
Thanks Meter 0
Posts: 4
Join Date: Feb 2008
Location: Moose Jaw
Default Thanks...any help though?

Hi....thanks for the fix....could you point me to a decent howto on editting the initial ramdisk?

Thanks

M
 
FredericGervais
Old
#3  
Junior Member
Thanks Meter 6
Posts: 18
Join Date: Jul 2011
Default it doesn't sound simple

i will try to figure that one out ...
 
doekoe87
Old
#4  
Member
Thanks Meter 2
Posts: 47
Join Date: May 2009
Location: Rotterdam
Dear Hexabit,
I know it's an old topic.

But do you know how can I use this Fix on a windows 7?
tried searching for binoffset software/script..couldn't find anything

I have a Flytouch 3 tablet, rooted(Z4) with terminal emulator and root explorer.
is there a way to use you bash.rar to unlock adb access?
thanks for the help
 
Ricky Divjakovski
Old
#5  
Ricky Divjakovski's Avatar
Recognized Contributor
Thanks Meter 5200
Posts: 3,589
Join Date: Feb 2013
Location: Sydney

 
DONATE TO ME
Quote:
Originally Posted by doekoe87 View Post
Dear Hexabit,
I know it's an old topic.

But do you know how can I use this Fix on a windows 7?
tried searching for binoffset software/script..couldn't find anything

I have a Flytouch 3 tablet, rooted(Z4) with terminal emulator and root explorer.
is there a way to use you bash.rar to unlock adb access?
thanks for the help
you have to split the kernel, then decompile the ramdisk and edit default.prop and change ro.debuggable to 1, then recompile and flash
Like my blog on facebook, add me to your circles, follow me on twitter or donate to me with paypal
 
teoking
Old
#6  
Junior Member
Thanks Meter 0
Posts: 11
Join Date: Feb 2011
Location: Beijing
Default confuse but giving me a clue

I use unpackbootimg in my ubuntu pc.
The adb root works not properly after set debuggable=1.

When I saw your thread that told the adbd should be unlocked too, then I replace the adbd with a unlocked one. It works!
Thanks for your help.
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


XDA PORTAL POSTS

[APK] Chrome Beta 37 Brings First Traces of Material Design

With Android L on the horizon, it’s no surprise that Google’s … more

Immersive Mode on Unrooted Devices with GMD Full Screen Immersive Mode

Everyone likes screen real estate–no question about that. The … more

Android Wear App Review: EchoWear Song Search – XDA Developer TV

Yesterday on XDA Developer TV, Producer AdamOutler tore down a Samsung … more