topjohnwu / Magisk

The Magic Mask for Android
GNU General Public License v3.0
47.59k stars 12.08k forks source link

adbd cannot run as root in production builds #425

Closed peyer closed 6 years ago

peyer commented 6 years ago

@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 commented 6 years ago

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

Didgeridoohan commented 6 years ago

@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 commented 6 years ago

@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 commented 5 years ago

@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 commented 4 years ago

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 commented 4 years ago

@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 commented 4 years ago

adbd cannot run as root in production builds

matianhe3 commented 3 years ago

@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 commented 3 years ago

anybody find a useful method?

xzhan96 commented 3 years ago

@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 commented 3 years ago

@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 commented 3 years ago

https://github.com/topjohnwu/Magisk/issues/425#issuecomment-902514089

matianhe3 commented 3 years ago

anybody find a useful method?

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

caseone commented 3 years ago

@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 commented 2 years ago

Me too in my FP4 (Android 11)

Alexmego commented 2 years ago

Me too in my pixel 3 (Android 12)

themarkib commented 2 years ago

Any new solution for this?

sssupercoder commented 2 years ago

@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 commented 2 years ago

@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 commented 2 years ago

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 commented 2 years ago

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.

bozheng946448185 commented 1 year ago

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

Joy9Lee commented 1 year ago

!/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 commented 1 year ago

''' 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 commented 1 year ago

''' 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 commented 1 year ago

''' 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 commented 11 months ago

!/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 commented 11 months ago

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

zalox commented 6 months ago

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 commented 5 months ago

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 commented 4 months ago

@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.