Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"adb root" command returns "adbd cannot run as root in production builds" even on an emulator?

Tags:

android

adb

I'm trying to run the adb root command on an emulator; this is the only device I have attached:

$ adb devices
List of devices attached
emulator-5554   device

However, I'm getting the following error message:

$ adb root
adbd cannot run as root in production builds

I've tried following this answer, adb shell su works but adb root does not, to solve my problem:

By design adb root command works in development builds only (i.e. eng and userdebug which have ro.debuggable=1 by default). Alternatively you could use modified adbd binary (which does not check for ro.debuggable)

It is not clear to me, however, how I can change the build into a development build instead of a production one?

Update I've found some additional instructions which lead me to believe that for this to work, you need to make your emulator a 'writable system' (cf. How to make system partition in AVD in emulator writable). However, if I try

$ emulator -avd Nexus_5X_API_28 -writable-system
emulator: WARNING: System image is writable
emulator: ERROR: Running multiple emulators with the same AVD is an experimental feature.
Please use -read-only flag to enable this feature.

I'm not really sure how to parse this error message; does this mean that the system image is already writable?

like image 488
Kurt Peek Avatar asked Jan 28 '23 01:01

Kurt Peek


1 Answers

I checked some emulator provided by Google. They are all user binary, not engineer binary. You can check it yourself by using "adb shell" command. If command line starts with "#", it's engineer build. If it starts with "$", it's user build. For example:

  • jackpot2lte:/ # => engineer build
  • jackpot2lte:/ $ => user build

Only engineer build can give you root permission. You can not change user build to engineer build but you can 'root' it. Please check "How to get root access on Android emulator?" for more information.

like image 110
Nguyen Duc An Avatar answered Jan 29 '23 14:01

Nguyen Duc An