Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adbd cannot run as root in production builds #425

Closed
peyer opened this issue Jul 30, 2018 · 31 comments
Closed

adbd cannot run as root in production builds #425

peyer opened this issue Jul 30, 2018 · 31 comments

Comments

@peyer
Copy link

peyer commented Jul 30, 2018

@topjohnwu So much thanks for your Magisk firstly. I have rooted my PIXEL already following your provided method successfully. It looked below when I used command of adb shell
sailfish:/ $ su
sailfish:/ #
However, I still received hint like adbd cannot run as root in production builds after I tried command of adb reboot, even I have downloaded app of adb insecure, and enabled insecure adbd and restarted adb server, it also infoed me adbd cannot run as root in production builds.
How can I do next to fix it?

@topjohnwu
Copy link
Owner

It is an issue of the adbd insecure app, not mine.
ADB reboot should work without root, not even requiring an unlocked bootloader.

@Didgeridoohan
Copy link
Contributor

Didgeridoohan commented Jul 31, 2018

@peyer It's probably caused by MagiskHide changing ro.debuggable to 0. It needs to be set to 1 for adb root to work.

You can either disable MagiskHide (and reboot), or change just that prop back to 1 with a boot script or MagiskHide Props Config (it's in the Magisk repo).

@peyer
Copy link
Author

peyer commented Aug 13, 2018

@topjohnwu @Didgeridoohan Sorry about reply you so late. I have used MagiskHide Props Config to change ro.debuggable and ro.secure, it still could not work. So I push executable file to /sdcard/ , then copy them to /data/local/tmp.

@yuhuazhu
Copy link

@topjohnwu @Didgeridoohan Sorry about reply you so late. I have used MagiskHide Props Config to change ro.debuggable and ro.secure, it still could not work. So I push executable file to /sdcard/ , then copy them to /data/local/tmp.

I don't know how to configure system properties in the config.prop file. I have to change the ro.debuggable value to 1 in the hide_utils.c file. Recompile and flash zip, you can use the adb root command on your computer.

@ashu123mae
Copy link

ashu123mae commented May 26, 2020

Goto folder path : /Users/RKumar/Library/Android/sdk/tools
Run : adb root
I do get - adbd is already running as root
Note : But still not able to open PROD build, says device comprised. There is a checking in the source code from dev team, requested the new .apk file with disabled rooted device. And able to launch the app on Androd emulator successfully.
API 26 version : Oreo_Android 8.0

@avelyne
Copy link

avelyne commented Aug 28, 2020

@ashu123mae same on my side. I've rooted a Pixel 4 (Android 11) using Magisk and hit into the same error: "adbd cannot run as root in production builds". I've tried to use adbd insecure app on Google Play but no luck either.

@bsed
Copy link

bsed commented Sep 11, 2020

adbd cannot run as root in production builds

@matianhe3
Copy link

@ashu123mae same on my side. I've rooted a Pixel 4 (Android 11) using Magisk and hit into the same error: "adbd cannot run as root in production builds". I've tried to use adbd insecure app on Google Play but no luck either.

me too

@xzhan96
Copy link

xzhan96 commented May 17, 2021

anybody find a useful method?

@xzhan96
Copy link

xzhan96 commented May 17, 2021

@ashu123mae same on my side. I've rooted a Pixel 4 (Android 11) using Magisk and hit into the same error: "adbd cannot run as root in production builds". I've tried to use adbd insecure app on Google Play but no luck either.

me too

me too

@meichen8050753
Copy link

@ashu123mae same on my side. I've rooted a Pixel 4 (Android 11) using Magisk and hit into the same error: "adbd cannot run as root in production builds". I've tried to use adbd insecure app on Google Play but no luck either.

me too

me too

me too

@nazmul91977
Copy link

#425 (comment)

@matianhe3
Copy link

anybody find a useful method?

flash a dev system. example my Pixel 4 flash lineage OS.

@caseone
Copy link

caseone commented Sep 1, 2021

@ashu123mae same on my side. I've rooted a Pixel 4 (Android 11) using Magisk and hit into the same error: "adbd cannot run as root in production builds". I've tried to use adbd insecure app on Google Play but no luck either.

me too

me too

me too

me too

@cortomalese
Copy link

Me too in my FP4 (Android 11)

@Alexmego
Copy link

Me too in my pixel 3 (Android 12)

@themarkib
Copy link

Any new solution for this?

@sssupercoder
Copy link

@ashu123mae same on my side. I've rooted a Pixel 4 (Android 11) using Magisk and hit into the same error: "adbd cannot run as root in production builds". I've tried to use adbd insecure app on Google Play but no luck either.

me too

me too

me too

me too

me too

@xiaoxiaocainiao
Copy link

@ashu123mae same on my side. I've rooted a Pixel 4 (Android 11) using Magisk and hit into the same error: "adbd cannot run as root in production builds". I've tried to use adbd insecure app on Google Play but no luck either.

me too

me too

me too

me too

me too

me too

@XiaZhouZero
Copy link

XiaZhouZero commented Aug 26, 2022

Me too in my pixel 3 (Android 12). After I set the ro.debuggable to 1 by MagiskHidePropsConf, adb root finally get stuck and expired.

 $ adb root
restarting adbd as root
timeout expired while waiting for device

@XiaZhouZero
Copy link

Me too in my pixel 3 (Android 12). After I set the ro.debuggable to 1 by MagiskHidePropsConf, adb root finally get stuck and expired.

 $ adb root
restarting adbd as root
timeout expired while waiting for device

Hi folks, I guess I just solved this problem.

  • First, I rebuilt the AOSP for pixel3 from scratch.
$ lunch aosp_blueline-userdebug
  • Second, I flashed all the things into Pixel3.
$ fastboot flashall -w
  • Finally
$ adb root
adbd is already running as root

I hope it works for you. ;)

@bozheng946448185
Copy link

Does anyone have a better plan ? My phonexiao mi mix2 can not do "adb root" ,

@Joy9Lee
Copy link

Joy9Lee commented Mar 5, 2023

#!/system/bin/sh
su -c "resetprop ro.debuggable 1"
su -c "resetprop service.adb.root 1"
su -c "magiskpolicy --live 'allow adbd adbd process setcurrent'"
su -c "magiskpolicy --live 'allow adbd su process dyntransition'"
su -c "magiskpolicy --live 'permissive { su }'"
su -c "kill -9 ps -A | grep adbd | awk '{print $2}' "

https://liwugang.github.io/2021/07/11/magisk_enable_adbr_root.html

@pnthai88
Copy link

'''
root@DebbieDavidson5646:# adb root
adbd cannot run as root in production builds
root@DebbieDavidson5646:
# adb shell props

Loading... Please wait.

MagiskHide Props Config v6.1.2
by Didgeridoohan @ XDA Developers

=====================================
Updating fingerprints list

Checking list version.
Fingerprints list up-to-date.

Checking for module update.
No update available.

MagiskHide Props Config v6.1.2
by Didgeridoohan @ XDA Developers

=====================================
Select an option below.

1 - Edit device fingerprint (active)
2 - Force BASIC key attestation
3 - Device simulation (active)
4 - Edit MagiskHide props (active)
5 - Add/edit custom props (active)
6 - Delete prop values
7 - Script settings
8 - Collect logs
u - Perform module update check
r - Reset all options/settings
b - Reboot device
e - Exit

See the module readme or the
support thread @ XDA for details.

Enter your desired option: 5

MagiskHide Props Config v6.1.2
by Didgeridoohan @ XDA Developers

=====================================
Custom props (active)
Select an option below:

Set or edit custom prop values for your device.

Currently set props (pick to edit):

post-fs-data boot stage
1 - ro.boot.serialno
2 - ro.kernel.androidboot.serialno
3 - ro.product.board
4 - ro.product.device
5 - ro.serialno

late_start service boot stage
6 - ro.boot.serialno
7 - ro.kernel.androidboot.serialno
8 - ro.product.board
9 - ro.product.device
10 - ro.serialno

n - New custom prop
r - Reset all custom props
b - Go back to main menu
e - Exit

See the module readme or the
support thread @ XDA for details.

Enter your desired option: n

MagiskHide Props Config v6.1.2
by Didgeridoohan @ XDA Developers

=====================================
New custom prop

Enter the prop to set. Example:
ro.sf.lcd_density

b - Go back
e - Exit

Enter your desired option: ro.debuggable

MagiskHide Props Config v6.1.2
by Didgeridoohan @ XDA Developers

=====================================
ro.debuggable

ro.debuggable is
one of the sensitive props that can be
set by the MagiskHide props option.

Are you sure you want to proceed?

y - Yes
n - No
e - Exit

Enter your desired option: y

MagiskHide Props Config v6.1.2
by Didgeridoohan @ XDA Developers

=====================================
ro.debuggable

Enter the value you want to set
ro.debuggable to,
or select from the options below.

The currently set value is:
0
Please enter the new value.

b - Go back
e - Exit

Enter your desired option: 1

MagiskHide Props Config v6.1.2
by Didgeridoohan @ XDA Developers

=====================================
ro.debuggable

This will set ro.debuggable to:

1

Pick an option below to change
what boot stage the prop will
be set in, or set/reset a delay:

1 - Default (current)
2 - post-fs-data
3 - late_start service
4 - Both boot stages
d - Delay

Do you want to continue?

Enter y(es), n(o), e(xit)
or an option from above: 4

MagiskHide Props Config v6.1.2
by Didgeridoohan @ XDA Developers

=====================================
ro.debuggable

This will set ro.debuggable to:

1

Pick an option below to change
what boot stage the prop will
be set in, or set/reset a delay:

1 - Default
2 - post-fs-data
3 - late_start service
4 - Both boot stages (current)
d - Delay

Do you want to continue?

Enter y(es), n(o), e(xit)
or an option from above: y

Working. Please wait...

Working. Please wait...

Working. Please wait...

Working. Please wait...

MagiskHide Props Config v6.1.2
by Didgeridoohan @ XDA Developers

=====================================
Reboot - ro.debuggable

Reboot for changes to take effect.

Do you want to reboot now (y/n)?

Enter y(es), n(o) or e(xit): y

Rebooting...
root@DebbieDavidson5646:# adb root
root@DebbieDavidson5646:
# adb root
adbd is already running as root
root@DebbieDavidson5646:# adb root
adbd is already running as root
root@DebbieDavidson5646:
#
'''

just set ro.debuggable to 1 then it's working

@pnthai88
Copy link

''' root@DebbieDavidson5646:# adb root adbd cannot run as root in production builds root@DebbieDavidson5646:# adb shell props
Loading... Please wait.
MagiskHide Props Config v6.1.2 by Didgeridoohan @ XDA Developers

=====================================

Updating fingerprints list
Checking list version. Fingerprints list up-to-date.
Checking for module update. No update available.
MagiskHide Props Config v6.1.2 by Didgeridoohan @ XDA Developers

=====================================

Select an option below.
1 - Edit device fingerprint (active) 2 - Force BASIC key attestation 3 - Device simulation (active) 4 - Edit MagiskHide props (active) 5 - Add/edit custom props (active) 6 - Delete prop values 7 - Script settings 8 - Collect logs u - Perform module update check r - Reset all options/settings b - Reboot device e - Exit
See the module readme or the support thread @ XDA for details.
Enter your desired option: 5
MagiskHide Props Config v6.1.2 by Didgeridoohan @ XDA Developers

=====================================

Custom props (active)
Select an option below:
Set or edit custom prop values for your device.
Currently set props (pick to edit):
post-fs-data boot stage 1 - ro.boot.serialno 2 - ro.kernel.androidboot.serialno 3 - ro.product.board 4 - ro.product.device 5 - ro.serialno
late_start service boot stage 6 - ro.boot.serialno 7 - ro.kernel.androidboot.serialno 8 - ro.product.board 9 - ro.product.device 10 - ro.serialno
n - New custom prop r - Reset all custom props b - Go back to main menu e - Exit
See the module readme or the support thread @ XDA for details.
Enter your desired option: n
MagiskHide Props Config v6.1.2 by Didgeridoohan @ XDA Developers

=====================================

New custom prop
Enter the prop to set. Example: ro.sf.lcd_density
b - Go back e - Exit
Enter your desired option: ro.debuggable
MagiskHide Props Config v6.1.2 by Didgeridoohan @ XDA Developers

=====================================

ro.debuggable
ro.debuggable is one of the sensitive props that can be set by the MagiskHide props option.
Are you sure you want to proceed?
y - Yes n - No e - Exit
Enter your desired option: y
MagiskHide Props Config v6.1.2 by Didgeridoohan @ XDA Developers

=====================================

ro.debuggable
Enter the value you want to set ro.debuggable to, or select from the options below.
The currently set value is: 0 Please enter the new value.
b - Go back e - Exit
Enter your desired option: 1
MagiskHide Props Config v6.1.2 by Didgeridoohan @ XDA Developers

=====================================

ro.debuggable
This will set ro.debuggable to:
1
Pick an option below to change what boot stage the prop will be set in, or set/reset a delay:
1 - Default (current) 2 - post-fs-data 3 - late_start service 4 - Both boot stages d - Delay
Do you want to continue?
Enter y(es), n(o), e(xit) or an option from above: 4
MagiskHide Props Config v6.1.2 by Didgeridoohan @ XDA Developers

=====================================

ro.debuggable
This will set ro.debuggable to:
1
Pick an option below to change what boot stage the prop will be set in, or set/reset a delay:
1 - Default 2 - post-fs-data 3 - late_start service 4 - Both boot stages (current) d - Delay
Do you want to continue?
Enter y(es), n(o), e(xit) or an option from above: y
Working. Please wait...
Working. Please wait...
Working. Please wait...
Working. Please wait...
MagiskHide Props Config v6.1.2 by Didgeridoohan @ XDA Developers

=====================================

Reboot - ro.debuggable
Reboot for changes to take effect.
Do you want to reboot now (y/n)?
Enter y(es), n(o) or e(xit): y
Rebooting... root@DebbieDavidson5646:# adb root root@DebbieDavidson5646:# adb root adbd is already running as root root@DebbieDavidson5646:# adb root adbd is already running as root root@DebbieDavidson5646:# '''
just set ro.debuggable to 1 then it's working

Thank you so much! Worked like a charm!

i'm glad to see it working

@FahadBinHussain
Copy link

''' root@DebbieDavidson5646:# adb root adbd cannot run as root in production builds root@DebbieDavidson5646:# adb shell props
Loading... Please wait.
MagiskHide Props Config v6.1.2 by Didgeridoohan @ XDA Developers

=====================================

Updating fingerprints list
Checking list version. Fingerprints list up-to-date.
Checking for module update. No update available.
MagiskHide Props Config v6.1.2 by Didgeridoohan @ XDA Developers

=====================================

Select an option below.
1 - Edit device fingerprint (active) 2 - Force BASIC key attestation 3 - Device simulation (active) 4 - Edit MagiskHide props (active) 5 - Add/edit custom props (active) 6 - Delete prop values 7 - Script settings 8 - Collect logs u - Perform module update check r - Reset all options/settings b - Reboot device e - Exit
See the module readme or the support thread @ XDA for details.
Enter your desired option: 5
MagiskHide Props Config v6.1.2 by Didgeridoohan @ XDA Developers

=====================================

Custom props (active)
Select an option below:
Set or edit custom prop values for your device.
Currently set props (pick to edit):
post-fs-data boot stage 1 - ro.boot.serialno 2 - ro.kernel.androidboot.serialno 3 - ro.product.board 4 - ro.product.device 5 - ro.serialno
late_start service boot stage 6 - ro.boot.serialno 7 - ro.kernel.androidboot.serialno 8 - ro.product.board 9 - ro.product.device 10 - ro.serialno
n - New custom prop r - Reset all custom props b - Go back to main menu e - Exit
See the module readme or the support thread @ XDA for details.
Enter your desired option: n
MagiskHide Props Config v6.1.2 by Didgeridoohan @ XDA Developers

=====================================

New custom prop
Enter the prop to set. Example: ro.sf.lcd_density
b - Go back e - Exit
Enter your desired option: ro.debuggable
MagiskHide Props Config v6.1.2 by Didgeridoohan @ XDA Developers

=====================================

ro.debuggable
ro.debuggable is one of the sensitive props that can be set by the MagiskHide props option.
Are you sure you want to proceed?
y - Yes n - No e - Exit
Enter your desired option: y
MagiskHide Props Config v6.1.2 by Didgeridoohan @ XDA Developers

=====================================

ro.debuggable
Enter the value you want to set ro.debuggable to, or select from the options below.
The currently set value is: 0 Please enter the new value.
b - Go back e - Exit
Enter your desired option: 1
MagiskHide Props Config v6.1.2 by Didgeridoohan @ XDA Developers

=====================================

ro.debuggable
This will set ro.debuggable to:
1
Pick an option below to change what boot stage the prop will be set in, or set/reset a delay:
1 - Default (current) 2 - post-fs-data 3 - late_start service 4 - Both boot stages d - Delay
Do you want to continue?
Enter y(es), n(o), e(xit) or an option from above: 4
MagiskHide Props Config v6.1.2 by Didgeridoohan @ XDA Developers

=====================================

ro.debuggable
This will set ro.debuggable to:
1
Pick an option below to change what boot stage the prop will be set in, or set/reset a delay:
1 - Default 2 - post-fs-data 3 - late_start service 4 - Both boot stages (current) d - Delay
Do you want to continue?
Enter y(es), n(o), e(xit) or an option from above: y
Working. Please wait...
Working. Please wait...
Working. Please wait...
Working. Please wait...
MagiskHide Props Config v6.1.2 by Didgeridoohan @ XDA Developers

=====================================

Reboot - ro.debuggable
Reboot for changes to take effect.
Do you want to reboot now (y/n)?
Enter y(es), n(o) or e(xit): y
Rebooting... root@DebbieDavidson5646:# adb root root@DebbieDavidson5646:# adb root adbd is already running as root root@DebbieDavidson5646:# adb root adbd is already running as root root@DebbieDavidson5646:# '''
just set ro.debuggable to 1 then it's working

Thank you so much! Worked like a charm!

i'm glad to see it working

Apologies for reaching out again, but it seems that the previous solution did not resolve the issue. I encountered a new error while attempting to run adb root. The error message states: "restarting adbd as root" followed by "timeout expired while waiting for device."

Furthermore, upon manual inspection of the build.prop file, I noticed that the ro.debuggable value remains unchanged. I am curious to understand the root cause of this issue. Could it be due to the project's (https://github.com/Magisk-Modules-Repo/MagiskHidePropsConf) inactivity or discontinuation?

image

@myuyu
Copy link

myuyu commented Nov 6, 2023

#!/system/bin/sh su -c "resetprop ro.debuggable 1" su -c "resetprop service.adb.root 1" su -c "magiskpolicy --live 'allow adbd adbd process setcurrent'" su -c "magiskpolicy --live 'allow adbd su process dyntransition'" su -c "magiskpolicy --live 'permissive { su }'" su -c "kill -9 ps -A | grep adbd | awk '{print $2}' "

https://liwugang.github.io/2021/07/11/magisk_enable_adbr_root.html

su -c "resetprop ro.debuggable 1"
su -c "resetprop service.adb.root 1"
su -c "magiskpolicy --live 'allow adbd adbd process setcurrent'"
su -c "magiskpolicy --live 'allow adbd su process dyntransition'"
su -c "magiskpolicy --live 'permissive { su }'"
su -c "kill -9 `ps -A | grep adbd | awk '{print $2}'` "

@FahadBinHussain
Copy link

For those of you who are here to edit the Android hosts file, you can use Magisk systemless host.

@zalox
Copy link

zalox commented Apr 6, 2024

Because I'm lazy. Here is the command in one line.

su -c "resetprop ro.debuggable 1";su -c "resetprop service.adb.root 1";su -c "magiskpolicy --live 'allow adbd adbd process setcurrent'";su -c "magiskpolicy --live 'allow adbd su process dyntransition'";su -c "magiskpolicy --live 'permissive { su }'";su -c "kill -9 `ps -A | grep adbd | awk '{print $2}'` "

@javaeryang
Copy link

Because I'm lazy. Here is the command in one line.

su -c "resetprop ro.debuggable 1";su -c "resetprop service.adb.root 1";su -c "magiskpolicy --live 'allow adbd adbd process setcurrent'";su -c "magiskpolicy --live 'allow adbd su process dyntransition'";su -c "magiskpolicy --live 'permissive { su }'";su -c "kill -9 `ps -A | grep adbd | awk '{print $2}'` "

hi, i run these commands, it works, but after then, i can't install apk by adb
adb: failed to install ff.apk: cmd: Failure calling service package: Failed transaction (2147483646)

@zalox
Copy link

zalox commented May 13, 2024

@javaeryang What are you attempting to do? Are you sure you need to run adbd as root for installing an apk? I had to this to get access to protected system files over the adb.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests