Adb cannot run as root in production builds как исправить

The problem is that, even though your phone is rooted, the ‘adbd’ server on the phone does not use root permissions. You can try to bypass these checks or install a different adbd on your phone or install a custom kernel/distribution that includes a patched adbd.

Or, a much easier solution is to use ‘adbd insecure’ from chainfire which will patch your adbd on the fly. It’s not permanent, so you have to run it before starting up the adb server (or else set it to run every boot). You can get the app from the google play store for a couple bucks:

https://play.google.com/store/apps/details?id=eu.chainfire.adbd&hl=en

Or you can get it for free, the author has posted a free version on xda-developers:

http://forum.xda-developers.com/showthread.php?t=1687590

Install it to your device (copy it to the device and open the apk file with a file manager), run adb insecure on the device, and finally kill the adb server on your computer:

% adb kill-server

And then restart the server and it should already be root.

Introduction

In this guide, we separated adb commands from adb shell commands and saw their differences. In this other guide, we explained the various build variants in Android; development (eng and userdebug) build and production/user build. You can go through the guides first before proceeding because we won’t be talking about them in detail here.

Some adb commands and adb shell commands require root to run, this means your device should be rooted, if not, you can’t execute such commands – a good example where commands require root is when interacting with system files and directories. In the case of adb shell, you need to grant root to the interactive shell on your Android device. This is done simply by running the adb shell command adb shell su. When it comes to adb, things are complicated here. Granting root to the interactive shell (adb shell su) only works with adb shell commands and not adb commands. In the case of adb commands, it is the adbd (adb daemon) that needs to run as root using the command adb root. The problem here is that this is only possible in development builds (eng and userdebug builds) and not with production builds (also called user builds). Since our devices all come with production builds, this means we all should get the error message adbd cannot run as root in production builds when we try to give root to the adbd using the command adb root.

How then is it possible to start the adbd with root access? This is exactly what we will be seeing in this guide. You will see the various tricks and hacks to run the adbd as root, just ride along.

Why Run adbd With Root Rights?

We are familiar with the adb pull and adb push commands. Using these commands, you can easily transfer files between a computer and the internal storage of your device. It’s also possible to do such operations with the system root directory – but adbd running as root is the thing here. If adbd is running as root (insecure mode), then you can easily make the /system partition and other ro partitions as rw using adb (the command is adb remount) and you will be able to use the adb pull and adb push commands in the system root directory as well as use other commands like adb disable-verity.

Note that if you are running a custom kernel or development Android build, it’s likely that it already implements this functionality. But if you are running a stock (made by the phone manufacturer) kernel or production build on your device, it’s obvious that adbd is running in secure mode, even if you are rooted. If the later case applies to you, then follow the methods below to run adbd in insecure mode – all you need is a rooted device.

Method 1: Using Chainfire’s adbd Insecure App

This app might only be compatible with older Android versions (maybe 5 and below). The changes the app makes are not permanent, so after a reboot, all modifications are reversed requiring you to set up the app again. For simplicity and if you want an automatic setup after each reboot, the app includes a toggle for this – but USB debugging must be ON always. Let’s see how to use this app to run adbd in root mode:

— Root your device

— Enable USB debugging

— Download and install the latest version of adbd Insecure app for free here. You can as well download the app from Play Store but it’s a paid app there – you can do this to support the developer.

— Launch the app, grant root and tick Enable insecure adbd. The patching will start right away and when done, you will see Binary: Insecure under the Current status section. If you want automatic patching after a reboot (because changes will be reversed), consider ticking Enable at boot.

— You can now test things out by running the command adb root. If you don’t get the adbd cannot run as root in production builds error or you get adbd is already running as root, then you got success. If things aren’t successful, then you have to try the next method.

— Note that if you have USB connected when the app activates or deactivates adbd root mode, you may need to unplug/replug the cable or run adb kill-server, then adb start-server on your computer before adb will work again.

— If this app fails to work and instead causes issues like your computer doesn’t recognize your device and other adb or USB debugging issues, then either reverse the patching, reboot your device or uninstall the app.

Method 2: Using ADB Root Module

This is a Magisk module that works on Android 9 and 10 (might not work on lower and higher versions). The module works on arm64 devices only.

For safety, don’t forget to disable the module once you’ve done all the things you need. Don’t use it constantly.

The module provides its own adbd binary, which is the binary obtained from AOSP sources with the following patch that disables props checks and usb auth:

diff --git a/adb/daemon/main.cpp b/adb/daemon/main.cpp
index d064d0d..a520bfd 100644
--- a/adb/daemon/main.cpp
+++ b/adb/daemon/main.cpp
@@ -51,48 +51,11 @@
 static const char* root_seclabel = nullptr;
 
 static bool should_drop_capabilities_bounding_set() {
-#if defined(ALLOW_ADBD_ROOT)
-    if (__android_log_is_debuggable()) {
-        return false;
-    }
-#endif
-    return true;
+    return false;
 }
 
 static bool should_drop_privileges() {
-#if defined(ALLOW_ADBD_ROOT)
-    // The properties that affect `adb root` and `adb unroot` are ro.secure and
-    // ro.debuggable. In this context the names don't make the expected behavior
-    // particularly obvious.
-    //
-    // ro.debuggable:
-    //   Allowed to become root, but not necessarily the default. Set to 1 on
-    //   eng and userdebug builds.
-    //
-    // ro.secure:
-    //   Drop privileges by default. Set to 1 on userdebug and user builds.
-    bool ro_secure = android::base::GetBoolProperty("ro.secure", true);
-    bool ro_debuggable = __android_log_is_debuggable();
-
-    // Drop privileges if ro.secure is set...
-    bool drop = ro_secure;
-
-    // ... except "adb root" lets you keep privileges in a debuggable build.
-    std::string prop = android::base::GetProperty("service.adb.root", "");
-    bool adb_root = (prop == "1");
-    bool adb_unroot = (prop == "0");
-    if (ro_debuggable && adb_root) {
-        drop = false;
-    }
-    // ... and "adb unroot" lets you explicitly drop privileges.
-    if (adb_unroot) {
-        drop = true;
-    }
-
-    return drop;
-#else
-    return true; // "adb root" not allowed, always drop privileges.
-#endif // ALLOW_ADBD_ROOT
+    return false;
 }
 
 static void drop_privileges(int server_port) {
@@ -183,9 +146,7 @@ int adbd_main(int server_port) {
     // descriptor will always be open.
     adbd_cloexec_auth_socket();
 
-    if (ALLOW_ADBD_NO_AUTH && !android::base::GetBoolProperty("ro.adb.secure", false)) {
-        auth_required = false;
-    }
+    auth_required = false;
 
     adbd_auth_init();
 
diff --git a/adb/services.cpp b/adb/services.cpp
index 8518f2e..24f9def 100644
--- a/adb/services.cpp
+++ b/adb/services.cpp
@@ -78,12 +78,6 @@ void restart_root_service(int fd, void *cookie) {
         WriteFdExactly(fd, "adbd is already running as rootn");
         adb_close(fd);
     } else {
-        if (!__android_log_is_debuggable()) {
-            WriteFdExactly(fd, "adbd cannot run as root in production buildsn");
-            adb_close(fd);
-            return;
-        }
-
         android::base::SetProperty("service.adb.root", "1");
         WriteFdExactly(fd, "restarting adbd as rootn");
         adb_close(fd);

The binary is required because adb root is usually disabled in compile time by most vendors.

— You should be rooted.

— Download the latest version of the module here.

— Flash it in Magisk and reboot your device.

— You can now test things out by running the command adb root. If you don’t get the adbd cannot run as root in production builds error or you get adbd is already running as root, then you got success. If things aren’t successful, then you have to try the next method.

Method 3: Editing The default.prop File

This method should work for development builds. By default, you should be able to get adbd running as root in eng and userdebug builds but in case this doesn’t happen, then this method should definitely let adbd run as root.

— You should be rooted.

— Go to the system root directory and open the file default.prop in a text or code editor. If adbd wasn’t running as root it was because ro.debuggable was set to 0. Replace 0 with 1 (i.e ro.debuggable=1) and save the file, then reboot your device.

— Test to see that adbd is now running as root. ro.debuggable=1 tells adbd it’s allowed to run as root. This may work, but if it doesn’t, it’s probably because the version of Android you’re using wasn’t compiled with the ALLOW_ADBD_ROOT flag, and the adbd code isn’t configured to check the ro.debuggable setting – which might be the case in production builds.

— Note that the default.prop file can be found in other areas like /vendor but that is not the one you need (it won’t even have the ro.debuggable setting). In my case, the required default.prop file was located as /default.prop as you can see in the photo above.

Method 4: Patching The adbd Binary To Run As Root

Using this method, you can also get luck if the others have failed – but it might only work on older Android versions. You have to extract and unpack the boot image on your device in order to get the adbd binary. You need to Google around a bit how to extract the boot image in case you don’t know – I have even written an article how it’s done if your device comes with a MediaTek chipset (see here). An easier way is downloading the stock firmware of the current build on your device – sometimes, you can come across boot images of specific devices that have been uploaded online – if you are lucky to see that of your device, the boot image should be the same build as that on your device. After getting hold of the boot image, you need to unpack it. There are many tools available for unpacking/repacking the boot image. Let’s consider the magiskboot and AIK tools here.

Magiskboot:

You can find the  magiskboot tool in the Magisk zip in some of the released Magisk versions here. In my case, I got it under Magisk v21.4 (listed as Magisk-v21.4.zip). It is also found under Magisk v21.3 (listed as Magisk-v21.3.zip) and others. You need to click on Assets below any of the sections to display a dropdown list for the download. After downloading, extract it and open the extraction folder. The tool will be located in arm and x86 subfolders – use any depending on your chipset. Not that the common subfolder contains the magisk.apk that you can install manually (as seen in photo three below – click any photo to enlarge).

Another way of getting the tool is when you rooted your device using the Magisk versions that have the Magisk zip. The tool will be installed in /data/adb/magisk [Did you know? magisk modules are installed in /data/adb/modules].

Magiskboot In /data/adb/magisk

To unpack the boot image and ramdisk, the respective commands are:

magiskboot unpack boot.img
magiskboot cpio ramdisk.cpio extract

The adbd binary is located in the sbin directory of ramdisk (might not be present on some boot images). You can then use Ghidra or Hex Editor to modify the binary as explained here. After doing everything, you need to use magiskboot to patch your ramdisk, and package up a new boot image. The repack command should create a new-boot.img file, that you can upload back to your Android device.

magiskboot cpio ramdisk.cpio "add 750 sbin/adbd patched_adbd"
magiskboot repack boot.img

AIK Tool:

The Android Image Kitchen tool will also lets you unpack the boot image. You will get the ramdisk folder containing the sbin subfolder where the adbd binary is located. You can then skip to this section to modify the binary. After that, you need to repack a new boot image that you can upload back to your Android device. See how to use the AIK tool here.

Others:

There are also many other tools that you can use to unpack/repack boot images e.g carliv image kitchen, mkbootimg, abootimg, etc

Rooted Devices:

Another way of getting the adbd binary is if you are rooted. Having a root file manager, the binary is located in /system/bin or /bin. If you don’t see it there, check /sbin. First make a backup of the binary to a save place. Now move it to the internal storage and do the editing as explained here. After editing the binary, move it back to its location and set permission as it was previously (usually 755 or rwxr-xr-x). Reboot your device. If things don’t work or you face issues, delete the edited binary and replace with the backup you made earlier. Set permission and reboot.

Patching The adbd Binary

Like this guide and this one will suggest, you can easily edit the binary in Ghidra or Hex Editor. Note that Hydra doesn’t do a great job at directly modifying ARM binaries, so consider using a generic hex editor like HxD in such a case.

— The first guide is for Android versions older than Nougat where you have to search for the Local port disabled string, or 0x7d0, which is the shell user’s id in hex. This should bring you to the part of the code where adbd switches from root to the shell user. The goal here is to comment out that code, so the program never stops running as root.

// Don't run as root if running in secure mode.
if (should_drop_privileges()) {
    drop_capabilities_bounding_set_if_needed();
    minijail_change_gid(jail.get(), AID_SHELL);
    minijail_change_uid(jail.get(), AID_SHELL);
    // minijail_enter() will abort if any priv-dropping step fails.
    minijail_enter(jail.get());
    D("Local port disabled");
}

— In the second guide (for Nougat and higher), you have to remove the calls to minijail_change_gid and minijail_change_uid. This can be done by searching for them and replacing the bytes with a series of NOP (no operation) commands i.e 00 BF.

Below is the call to minijail_change_gid in my case (your own values might be different):

To remove the call to minijail_change_gid, I had to find and replace the following series of bytes:

6D 69 6E 69 6A 61 69 6C 5F 63 68 61 6E 67 65 5F 67 69 64  <--- before
00 BF 00 BF 00 BF 00 BF 00 BF 00 BF 00 BF 00 BF 00 BF 00  <--- after

Below is the call to minijail_change_uid in my case (your own values might be different):

To remove the call to minijail_change_uid, do the same.

— You can now save the patched adbd binary. See a sample on how to use HxD here.

Method 5: Custom Kernel

This method is much more easier. You need to install a different adbd on your phone or install a custom kernel/distribution that includes a patched adbd. This can be done by searching online. Though some custom kernels don’t come with adb root, they allow you to easily patch the adbd which is usually hard to do in production builds. Sometimes, you can come across the patched stock boot image of your device online where the developer has modified adbd to run as root. But keep in mind to always use the same version of a boot image as the one on your device.

Are There Any Other Options?

If you are not able to get adbd running as root no matter how hard you’ve tried, there’s still a workaround, capable of substituting commands like adb pull and adb push (of system files/directories), and adb remount, etc. Adb shell commands are there to save you. Though adb shell commands might take much time, but you will also be able to achieve what you wanted if adbd was running as root. Let’s look at some examples below:

— To get started, you should have a rooted device and USB debugging should be enabled on your phone.

— Before doing anything, you will have to first grant root rights to the interactive shell on your Android device using adb shell su (or adb shell, then su) since you will be working with the system root directory.

— To remount ro partitions as rw, the command is mount -o rw,remount /<partition> e.g mount -o rw,remount /system and mount -o rw,remount /vendor.

— Transferring to a PC. You have to copy items from the system root directory to the internal storage first using.

cp <path-in-root>/<filename.extension> <path-on-sdcard>

Most files in the root directory don’t have file extensions, so the command should be:

cp <path-in-root>/<filename> <path-on-sdcard>

If you choose to change directory first, then the commands should be:

cd <path-in-root>
cp <filename.extension> <path-on-sdcard>

Once the item is in the sdcard, you can then pull it to your computer using the adb command:

adb pull <path-on-sdcard>/<filename.extension> <path-on-PC>

Note that copying to sdcard can also be done manually if you have a rooted device and a root file manager installed. This is way easier.

— You should be very careful when doing operations in the root directory. It’s recommended never to use the adb shell mv command (adb shell cp is safe) unless you know what your are doing.

— Transferring from a PC. This is just the reverse of the above process. adb push <path-on-PC>/<filename.extension> <path-on-sdcard> will copy the item from your computer to the sdcard of your device. Now adb shell su and then cp [or mv] <path-on-sdcard>/<filename.extension> <path-in-root> will copy [or move] the item to the root directory. See a list of adb shell commands in this article.

ADB Under Recovery

Some recovery will let you run adb commands. This can be possible on eng and userdebug builds. Some custom recoveries as well can allow adb in recovery mode. This is because custom recoveries come with a lot of modifications and provide much of their own custom binaries like adbd, sh, etc. If you unpack a custom recovery like TWRP using say AIK, you can go to the ramdisk folder then sbin to realize many of these binaries which might not be found in a stock recovery.

— A device should be listed under adb devices, either in recovery or sideload state when you run adb devices.

$ adb devices
List of devices attached
05169339CG105301    recovery

— If adb devices shows the device, but in unauthorized state, then the recovery image doesn‘t honour the USB debugging toggle and the authorizations added under normal boot (because such authorization data stays in /data, which recovery doesn’t mount), nor does it support authorizing a host device under recovery. We can use one of the following options here instead.

$ adb devices
List of devices attached
05169339CG105301    unauthorized

Eng & Userdebug Builds

— adbd service should be running as root by default under recovery in development builds if ro.debuggable=1 in prop.default. If adbd is not running as root in recovery mode, unpack the recovery image. Look inside the ramdisk folder and you will see a file named prop.default. Open it in a text or code editor. Change ro.debuggable=0 to ro.debuggable=1 and save.

Repack the image and flash to your device. You can then test to see if adbd is running as root while in recovery mode. This might not be possible in production builds.

— By default, adbd is always included into recovery image, as /system/bin/adbdinit starts adbd service automatically only in debuggable builds. This behaviour is controlled by the recovery specific /init.rc, whose source code is at bootable/recovery/etc/init.rc.

— Although recovery adb is built from the same code base as the one in the normal boot, only a subset of adb commands are meaningful under recovery, such as adb rootadb shelladb push, adb pull, etc. Since Android Q, adb shell no longer requires manually mounting /system from recovery menu.

Custom Recovery

— Custom recoveries come with numerous features. You are also able to use shell commands while using a custom recovery and your device is usually detected in adb mode from recovery. This means custom recoveries should come with numerous binaries and command files. Extracting TWRP for example and going to the sbin subfolder of ramdisk, you should be able to see many binaries including sh, adbd, etc – most of the binaries that you will find in /system/bin. These might not be present in stock recoveries. The photos below show the unpacked ramdisk > sbin directory of a stock recovery (in production build) and a custom recovery (TWRP):


Stock recovery

For stock recovery that adb doesn’t run, the only time that the device is detected in adb mode under recovery is during the sideload start.


TWRP

Take note, there’s the twrp app (me.twrp.twrpapp) in one of the photos below which is installed on your device when you choose to install the TWRP app from recovery. You can manually install the app now that you have access to it [click on any of the photos below to enlarge]. The contents in the sbin subfolder have not been shown all.

Conclusion

Like, Share & Comment 👍: We are done with our guide on how to get adbd running as root in production builds. If you find this post helpful, then scroll down to like and share. Also, drop a comment below in case of any difficulty.

Donate : Please help us to keep the site running. You can support us with whatever you have here.

Report Broken Link, Any Error, Or Wrong Information : Is a link not working, or have you found an error that needs correction, or do you believe there’s an information you have read that is wrong, report to us here. We will verify and try to update as soon as possible. Don’t forget to give us the link that is broken or to point directly to the section that needs correction. Thanks for your loyalty.

Contact 🗨: If you wish to contact the SakoPhone Team, then click here.

Join Us : Want to be part of the SakoPhone Team, join us here. Those eligible to join us are: Bloggers/Writers/Editors (to write helpful articles), Readers/Subscribers (to receive alert of every article we drop, Supporters (those who will cross-check articles and report errors, wrong details or broken links, provide helpful suggestions and information as well as increase traffic by sharing and recommending our articles to various platforms) and lastly Sponsors (those who can assist us financially with little donations to keep the site running).

The adbd cannot run as root in production builds 2022 is a standard code exception your system experiences due to the lack of root access. As a result, you must bypass the permissions checks and install a new adb shell on your machine to allow further code alterations and production builds preventing further complications.adbd cannot run as root in production builds

Nevertheless, although you can experience it when your Android device fails to comply with the adb root flag, the answers take less than a minute. Hence, we developed and wrote the most sophisticated adb root magisk debugging article to teach you how to fix the error log using standard approaches and methods without further complications.

Contents

  • When Does the Adbd Cannot Run as Root in Production Builds Bug Happen?
    • – Running a Database Without Root Privileges
  • How To Fix the Adbd Cannot Run as Root in Production Builds Exception?
    • – Running the Adequate Emulator and Entering the Adbd Command
    • – Modify the Binary Values Before Launching the Commands
  • Conclusion

When Does the Adbd Cannot Run as Root in Production Builds Bug Happen?

The adbd cannot run as root in production builds emulator code exception usually happens when your system lacks Android Studio root permissions. In addition, this code exception can obliterate your programming experience when your Android version does not comply with the root flag and configurations, displaying a warning.

Therefore, the adb root not working mistake is inevitable when your main document or application misses the root permissions for the main commands. Although this sounds irrelevant for complex projects or files, it can ruin your fully functional script regardless of how correct the other processes are.

For example, adbd insecure Android 12 builds require specific inputs and permissions to render the commands, which, if missed, raise warnings and terminate the program. As a result, we will reproduce the adbd insecure exception using advanced syntaxes and functions, although remaking the error log is sometimes challenging due to permission flaws.

On the flip side, we confirmed a similar adbd cannot run as root in production builds Windows 11 log when the Android version does not comply with the root flag and configurations.

Henceforth, the system displays a warning documenting the flaws and inconsistencies, although you have the latest version and advanced code snippets. In addition, users can experience a similar adb root Android 11 mistake due to permission checks, which should not be surprising when completing your project.

Still, let us reproduce and display the error log before teaching and applying the solutions to your document to prevent further complications.

– Running a Database Without Root Privileges

This article’s invalid chapter exemplifies the procedure of running a database without root privileges. As a result, your system confirms the inconsistencies and indicates the failed operation, although some elements are fully functional.Running a Database Without Root Privileges

So, we will show you the system’s visual output after running the emulator and opening the command prompt.

The following example provides the complete error log:

C: Users#Ji Hoon #AppData#Loca IWAndroidWSdk#platform-tools>

C: #Users#Ji Hoon #AppData#Local #AndroidWSdk#platform-tools>

C: #Users#Ji Hoon #AppData#Loca I WAndroidWSdk#platform-tools> #AndroidWSdk#platform-tools>

C: #Users#Ji Hoon #AppData#Local #AndroidWSdk#platform-tools> user sa

#Users#Ji Hoon #AppData#Loca IWAndroidWSdk#platform-tools> se sa

C: #Users#Ji Hoon #AppData#Local Dalam uca kaman Lo KAPPALOOTTO LOUTK

#Users#Ji Hoon #AppData#Local #AndroidWSdk#platform-tools> users WAPDALLO LOUTK

Users#Ji Hoon #AppData#Loca I WAndroidWSdk#platform-tools> muser sa Dalam Mo LOOTS

Users#Ji Hoon #AppData#Loca | #AndroidWSdk#platform-tools> user sa kala

Users#Ji Hoon #AppData#Loca I WAndroidWSdk#platform-tools> user sa kala

Users#Ji Hoon #AppData#Loca I WAndroidWSdk#platform-tools> user sa kala

Users#Ji Hoon #AppData#Loca | #AndroidWSdk#platform-tools> user sa kala PayOOTSK

Users#Ji Hoon #AppData#Loca I WAndroidWSdk#platform-tools> user sa kala

Users#Ji Hoon #AppData#Loca I WAndroidWSdk#platform-tools> users on IWAPDALAM LO

Users#Ji Hoon #AppData#Loca | #AndroidWSdk#platform-tools> users on IWAPDALAM LO

Users#Ji Hoon #AppData#Loca I WAndroidWSdk#platform-tools> users on IWAPDALAM LO

Users#Ji Hoon #AppData#Loca I WAndroidWSdk#platform-tools> se sa KAPPALOOTTO LOUTK

Users#Ji Hoon #AppData#Loca I WAndroidWSdk#platform-tools> se sa KAPPALOOTTO LOUTK

#Users#Ji Hoon #AppData#Local #AndroidWSdk#platform-tools> st #AndroidWSdk#platform-tools>

#Users#Ji Hoon #AppData#Local

#Users#Ji Hoon #AppData#Local muser sm

#AndroidWSdk#platform-tools>

#UsersWJi Hoon #AppData#Loca I WAndroidWSdk#platform-tools>

C: #Users#Ji Hoon #AppData#Loca | #Android#Sdk#platform-tools> WAndroidWSdk#platform-tools>Is

C: #Users#Ji Hoon #AppData#Loca I AdbWinApi.dll AdbWinUsbApi.dll dmtracedump.exe

NOTICE.txt, etcltool.exe

(adb.exe, fastboot.exe)

C: #Users#Ji Hoon #AppData#Local api TATTOFOTOMS Andron aron hprof-conv.exe

libwinpthread-1.dll make_f2fs.exe lib64 COUTSK 123 make_f2fs_casefold.exe mke2fs.conf

mke2fs.exe package.xml #Android#Sdk#platform-tools> source.properties sqlite3.exe systrace X

Although we could list other elements and values, we kept the visual output as short as possible. Still, the debugging approaches apply to all syntaxes and scripts.

How To Fix the Adbd Cannot Run as Root in Production Builds Exception?

You can fix the adbd that cannot render as root in the production code exception by unlocking the bootloader. In addition, you can overcome the error log by running the adequate emulator and entering the adbd root command. Both debugging techniques prevent further complications and obstacles.



This section confirms overcoming the mistake takes a minute and works for all scripts regardless of elements and commands. Still, we suggest unlocking the bootloader as your primary debugging choice because it does not mess up other features and inputs.

However, isolating the failed document or file before implementing the debugging method is excellent, especially with complex documents and applications.

The following list helps you unlock the bootloader and fix the mistake:

  1. Turn off your device to initiate the procedure.
  2. Power on the unit by holding the power button and volume up and down keys.
  3. The device loads and boots into the bootloader.
  4. Use a USB cable to plug the device into your computer.
  5. Start the terminal on your machine by holding Ctrl + Alt + T.
  6. Type the following command line before pressing enter: sudo fastboot oem unlock
  7. Accept the unlocking terms on your device screen after it boots up.
  8. Reboot your device by pushing the power button. Your system indicates the button’s location on the start screen.

This solution applies to all devices, although the start screen differs for each operating system. Alternatively, use the following command lines if the sixth debugging steps did not fix the issue:

adb shell setprop ro.secure 0

adb shell setprop ro.debuggable 1

adb shell setprop persist.service.adb.enable 1

adb root

This code snippet completes the debugging procedure and reenables further processes.

– Running the Adequate Emulator and Entering the Adbd Command

This article’s second solution suggests running the appropriate emulator and entering the adbd root command before launching the processes. This debugging procedure resolves the inconsistencies that failed due to the underprivileged root permissions.Adbd Cannot Run as Root in Production Builds Fixes

As a result, the old emulator fails to render the inputs and launch the command lines, although the snippet appears fully functional. So, this method requires only two steps before displaying the correct output.

The following list teaches the necessary debugging steps:

  1. Open your Android virtual devices in the studio.
  2. Select the hardware and choose a device definition.

The system displays a visual output confirming the successful procedure. The following example provides the result after choosing the device definition:

GH. Your system launches the – adb shell

C:#Users#Ji Hoon #AppData#Loca IWAndroid#Sdk#platform – tools > adb devices

List of devices attached

Emulator – 1564 offline

C:#Users#Ji Hoon #AppData#Loca IWAndroid#Sdk#platform – tools > adb devices

List of devices attached

Emulator – 1564 offline

C:#Users#Ji Hoon #AppData#Local #AndroidWSdk#platform – tools > adb devices

List of devices attached

Emulator – 7264 offline

C:#UsersWJi Hoon #AppData#Loca I WAndroidWSdk#platform – tools > adb root

restarting adbd as root

C:WUsersWJi Hoon #AppData#Local #Android#Sdk#platform – tools > adb shell

generic_x86: # cd /data/data/com.Hellow.example54

/system/bin/sh: cd: /data/data/com.Hellow.example54: No such file or directory

2 generic_x86:/ # cd /data/data

generic_x86:/data/data # Is android

com.android.apps.tag

com.android.backupconfirm

com.android.theme.color.purple

com.android.theme.color.space

com.android.theme. font.notoser ifsource X A

As you can tell, this stack trace does not display the code exception and indicates the system carried out the intended emulator without obstacles. However, if the bug persists and terminates your program, we suggest modifying the binary.

– Modify the Binary Values Before Launching the Commands

Changing the binary values before launching the commands is another excellent debugging procedure that works for all documents. However, you must create a new project and import the adbd binaries extracted from the original document.

Your program should analyze the Android source code and binary values, which are critical when completing your project. As a result, we will exemplify the Android source code you must target for the new project before listing the byte series.

The following example provides a good source code:

// Don’t run this code as root if running in a secure mode.

if (should_drop_privileges ()) {

drop_capabilities_bounding_set_if_needed();

minijail_change_gid (jail.get (), AID_SHELL);

minijail_change_uid (jail.get (), AID_SHELL);

// the minijail_enter() command will abort if any priv-dropping step fails.

minijail_enter (jail.get ());

D (“Local port disabled”);

}

Lastly, introduce the byte series to remove the calls to the UID and GID commands. You can learn more about this procedure in the following code snippet:

4f f6 fa 62 2d f0 8e f9 <- target

01 BF 002 BF 03 BF 04 BF <- replaced with NOPs

Your system should no longer experience the error log after implementing these solutions.

Conclusion

The adbd that cannot run as root in production code exception happens when your system lacks specific root permissions. So, let us remember this article’s critical points before fixing your project:

  • The bug can occur when your Android version does not comply with the root flag and configurations
  • Reproduce the stack trace by running a database without root privileges
  • Unlocking the bootloader is the primary debugging procedure
  • Changing the binary values before launching the commands is another excellent debugging procedure

This article proves overcoming the error log is straightforward and takes a minute, which is excellent for complex documents. We encourage you to open the application and implement the solutions.

  • Author
  • Recent Posts

Position is Everything

Your Go-To Resource for Learn & Build: CSS,JavaScript,HTML,PHP,C++ and MYSQL. Meet The Team

Position is Everything

@peyer

@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

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

@Didgeridoohan

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

nlburgin, deveshm, specters312, trochdewei, Enigma3000, 1180300724wangxurui, aliyin, and delicacyyy reacted with thumbs up emoji
adrmnv, xpgeng, gsy13213009, Alexmego, HackSunil007, and 1180300724wangxurui reacted with thumbs down emoji

@peyer

@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

@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

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

@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

adbd cannot run as root in production builds

@matianhe3

@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

anybody find a useful method?

@xzhan96

@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

@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

@matianhe3

anybody find a useful method?

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

@caseone

@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

Me too in my FP4 (Android 11)

@Alexmego

Me too in my pixel 3 (Android 12)

@themarkib

Any new solution for this?

@sssupercoder

@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

@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

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

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.
  • Finally
$ adb root
adbd is already running as root

I hope it works for you. ;)

@bozheng946448185

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

@Joy9Lee

#!/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

I am trying to install Ubuntu Touch on my Galaxy Nexus, but it says adbd cannot run as root in production builds. I tried a lot of stuff, including a few instructions from Ask Ubuntu, nothing helps. Can anybody please advise on what can be my problem?

NilsB's user avatar

NilsB

1,0011 gold badge7 silver badges32 bronze badges

asked Mar 6, 2013 at 14:30

dukenuker's user avatar

1

You have to unlock your bootloader. Please follow these steps:

Step 2 — Device unlock

  1. With the device powered off, power on the device by holding the Power button + volume up + volume down.
  2. The device will boot into the bootloader.
  3. Plug the device into the computer via the USB cable.
  4. On your computer, press Ctrl+Alt+T to start a terminal. Type sudo fastboot oem unlock, followed by Enter
  5. On the device screen, accept the terms of unlocking.
  6. Boot the device by pressing the power button (pointed by an arrow with Start on the screen).

Source

Please let us know if this worked.

answered Mar 7, 2013 at 12:21

NilsB's user avatar

NilsBNilsB

1,0011 gold badge7 silver badges32 bronze badges

3

You could try this:

adb shell setprop ro.secure 0
adb shell setprop ro.debuggable 1
adb shell setprop persist.service.adb.enable 1
adb root

That may work on some devices. Try it yourself and good luck.

alexgophermix's user avatar

answered Feb 5, 2015 at 23:30

Steven's user avatar

2

That error occurs on phone’s that have a production build. You need to get an other android distribution. I would recommend cyanogenmod.

But the people on XDA can help your better. Here’s a link:

Samsung Galaxy Nexus — on XDA

answered Mar 6, 2013 at 14:47

Thomas15v's user avatar

Thomas15vThomas15v

1,5931 gold badge11 silver badges21 bronze badges

If you are following the instructions at https://wiki.ubuntu.com/Touch/Install, the probable reason for the error is that you’re trying to run ‘phablet-flash’ command without having done the bootstrap ‘phablet-flash -b’ first.

answered May 20, 2013 at 8:48

Timo Jyrinki's user avatar

Понравилась статья? Поделить с друзьями:
  • Как найти телефон через часы амазфит
  • Как найти учеников для школы
  • Как найти кино по звуку
  • Хуавей смс центр как найти
  • Как найти условия рыночного равновесия