Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

adb shell operation not permitted

Tags:

android

adb

I try to run

adb shell kill 5539

where 5539 is a process id found when running adb shell ps, but I get

/system/bin/sh: kill: 5539: Operation not permitted

How can I rectify my permissions?

This is the only adb documentation on kill:

kill [options]

Kill all processes associated with (the app's package name). This command kills only processes that are safe to kill and that will not impact the user experience. Options are:

--user | all | current: Specify user whose processes to kill; all users if not specified.

like image 599
Rose Perrone Avatar asked Jun 17 '13 19:06

Rose Perrone


People also ask

How do I enable adb shell?

Enable adb debugging on your device On Android 4.2 and higher, the Developer options screen is hidden by default. To make it visible, go to Settings > About phone and tap Build number seven times. Return to the previous screen to find Developer options at the bottom.

Why adb shell not working?

Make sure USB debugging is enabled and USB is physically plugged in. Make sure everything is ok with the ADB drivers, double-check the device manager. Check if the device appears in "adb devices", make sure its authorized on the device. Try actual adb shell and other relevant adb stuff.

How do I launch adb shell?

Open a command window in the folder by holding shift and right-clicking in an empty spot in the folder and selecting "Open command prompt/PowerShell here" in the menu. Then you can start using ADB — connect your phone and try .


2 Answers

My methods:

Without root

adb shell am force-stop <package name>

I don't know how to do it with PID, kill <PID> and kill -9 <PID> don't work in my case

With root

I have also installed BusyBox to get more UNIX tools on my device

adb shell "su -c 'kill $(pidof <package name>)'"

or

adb shell "su -c 'kill <PID>'"
like image 65
KnightWhoSayNi Avatar answered Sep 17 '22 14:09

KnightWhoSayNi


You need to restart adb as root

This will give you permissions to kill the process.

$ adb root

$ adb shell kill 5539

like image 34
harsmar Avatar answered Sep 20 '22 14:09

harsmar