Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to restart adb from root to user mode?

Tags:

android

adb

root

Basic question on ADB.

adb root restarts adb as root. But what i want is to restart it back to user after some time.

I tried the following :

adb kill-server adb start-server 

doesnt work..

ps -A -> noted the process number of adb and killed it.. even this did not work. Finally i am restarting my device. Is there any way i can come back from root adb to general adb?

Thank you.

like image 758
Sandeep Avatar asked Mar 11 '13 10:03

Sandeep


People also ask

How do I switch to root in adb?

So to enable the adb root command on your otherwise rooted device just add the ro. debuggable=1 line to /system/build. prop file. If you want adb shell to start as root by default - then add ro.

What is adb reboot bootloader?

This command reboots your device in normal mode. You'll typically run this command after you've flashed something to your device and need to reboot. adb reboot. This command can also be useful if you're encountering issues with your Android device – for example, if your smartphone suddenly becomes unresponsive.

How do I start and stop adb server?

In some cases, you might need to terminate the adb server process and then restart it to resolve the problem (e.g., if adb does not respond to a command). To stop the adb server, use the adb kill-server command. You can then restart the server by issuing any other adb command.


2 Answers

adb kill-server and adb start-server only control the adb daemon on the PC side. You need to restart adbd daemon on the device itself after reverting the service.adb.root property change done by adb root:

~$ adb shell id uid=2000(shell) gid=2000(shell)  ~$ adb root restarting adbd as root  ~$ adb shell id uid=0(root) gid=0(root)  ~$ adb shell 'setprop service.adb.root 0; setprop ctl.restart adbd'  ~$ adb shell id uid=2000(shell) gid=2000(shell) 
like image 144
Alex P. Avatar answered Sep 18 '22 14:09

Alex P.


If you used adb root, you would have got the following message:

C:\>adb root * daemon not running. starting it now on port 5037 * * daemon started successfully * restarting adbd as root 

To get out of the root mode, you can use:

C:\>adb unroot restarting adbd as non root 
like image 37
Akshay Gaur Avatar answered Sep 20 '22 14:09

Akshay Gaur