Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

adb shell "operation not permitted" for every command

I recently did a factory reset of my android phone. Prior to the reset, I was able to install applications through adb install. The phone was not rooted.

After the factory reset, I mostly get "Operation not permitted" for nearly every command in adb shell (including ones that don't exist):

$ install
install: permission denied
$ push
push: permission denied
$ remount
remount: permission denied
$ su
su: permission denied
$ kmmsaldfmaldskfmlasdf
kmmsaldfmaldskfmlasdf: permission denied
$

Most of the PATH is unreadable to me (except for /system/bin and /system/xbin):

$ echo $PATH
/sbin:/vendor/bin:/system/sbin:/system/bin:/system/xbin
$ ls /sbin
opendir failed, Permission denied
$ ls /vendor/bin
/vendor/bin: No such file or directory
$ ls /system/sbin/
/system/sbin/: No such file or directory

If I run adb root:

$ adb root
adbd cannot run as root in production builds

From my search (which has already robbed me of way more time than necessary), some pointers are to default.prop:

$ cat default.prop
#
# ADDITIONAL_DEFAULT_PROPERTIES
#
ro.secure=1
ro.allow.mock.location=0
ro.debuggable=0
persist.service.adb.enable=1
$

But I have no write access to default.prop:

$ ls -l default.prop 
-rw-r--r-- root     root          118 1969-12-31 19:00 default.prop
$

I also seem unable to remount. I have been able to use adb successfully on the non-rooted device, why so much grief now? Has anyone come across this problem? My own phone is virtually unusable to me, and of course I am unable to do any development.

Trying to remount as rw:

$ mount
rootfs / rootfs ro,relatime 0 0
tmpfs /dev tmpfs rw,relatime,mode=755 0 0
devpts /dev/pts devpts rw,relatime,mode=600 0 0
proc /proc proc rw,relatime 0 0
sysfs /sys sysfs rw,relatime 0 0
tmpfs /mnt/asec tmpfs rw,relatime,mode=755,gid=1000 0 0
tmpfs /mnt/obb tmpfs rw,relatime,mode=755,gid=1000 0 0
/dev/stl9 /system rfs ro,relatime,vfat,log_off,check=no,gid/uid/rwx,iocharset=cp437 0 0
/dev/stl10 /cache rfs rw,nosuid,nodev,relatime,vfat,llw,gid/uid/rwx,iocharset=cp437 0 0
/dev/stl6 /mnt/.lfs j4fs rw,relatime 0 0
/dev/stl11 /data rfs rw,nosuid,nodev,relatime,vfat,llw,check=no,gid/uid/rwx,iocharset=cp437 0 0
$ mount -o remount,rw -t yaffs2 /dev/block/mtdblock0 /
mount: Operation not permitted

My phone is a Samsung Galaxy Y, which could matter

like image 646
ealfonso Avatar asked Oct 01 '13 01:10

ealfonso


People also ask

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 enable adb shell?

Enable adb debugging on your device 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. On some devices, the Developer options screen might be located or named differently. You can now connect your device with USB.


2 Answers

You need to issue commands like install from the PC command line:

C:\> adb install ...

instead of from within the adb shell. If that doesn't work, you may need to run

adb remount

and/or reboot your phone and/or reinstall the phone driver. See this thread for more info.

I've found that the path in an adb shell session can have all sorts of non-existent directories on it. I don't know why that is, but it normally doesn't screw up anything.

like image 161
Ted Hopp Avatar answered Dec 15 '22 07:12

Ted Hopp


Assuming that you didn't put a new version of Android on your phone, my guess is that your phone is no longer in developer mode.

Go to Settings. Scroll down until you see the System heading. Under it, you should see several options. If Developer is not one of them, click on About phone, then scroll down to Build number. Click on Build number 7 times. That should bring back Developer mode.

like image 21
Joe Malin Avatar answered Dec 15 '22 08:12

Joe Malin