10

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

6
  • What version of Android do you have installed?
    – Ted Hopp
    Commented Oct 1, 2013 at 3:08
  • It reports 2.3.6 as the android version. I have tried to update, it does not find available updates.
    – ealfonso
    Commented Oct 1, 2013 at 3:11
  • 1
    Instead of issuing commands like install from the shell, what happens if you issue them from the PC's command line: adb install, etc.? First try adb remount from the PC command line. You also may need to reinstall your phone driver (as per this thread).
    – Ted Hopp
    Commented Oct 1, 2013 at 3:15
  • Ok. Actually, that works. (Please post that as your answer so I can eventually accept it). I guess I never imagined it could make a difference. Intuitively, it should not. . I did not even have to adb remount. The problem still remains, why am I unable to use the shell?
    – ealfonso
    Commented Oct 1, 2013 at 3:17
  • adb remount fails with Operation not permitted
    – ealfonso
    Commented Oct 1, 2013 at 3:19

8 Answers 8

5

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.

7
  • 1
    I am still unable to use the shell. Interestingly, I now get install: permission denied instead of install: Operation not permitted. Since my question was not only about installing, but about being able to use the commands in the adb shell, I would like to find a solution to that problem before accepting your answer. Your advice has been helpful to running the install command, but I feel that I still pretty much can not use adb as a developer should be.
    – ealfonso
    Commented Oct 1, 2013 at 3:24
  • @ealfonso - I'm not sure it will help, but try turning on USB debugging (I think under 2.3.6 it's under Settings > Applications > Development). Also turn on "Unknown sources".
    – Ted Hopp
    Commented Oct 1, 2013 at 3:26
  • USB debugging is on, it is one of the first things that I made sure was set. I have also enabled "Android Device Manager" as a device administrator. But I still get this frustrating behavior.
    – ealfonso
    Commented Oct 1, 2013 at 3:29
  • @ealfonso - It's quite weird. I'm out of ideas at the moment, but I'll keep thinking about it. (Oh...did you try killing and restarting the adb server? I wouldn't expect that to affect the behavior you're describing, but you never know.)
    – Ted Hopp
    Commented Oct 1, 2013 at 3:32
  • 1
    Yes, I routinely restarted the adb daemon upon every change, I've also restarted the phone. The only change is that now Operation not permitted has been replaced with permission denied for all commands (including non-existent ones). I have a feeling that this is a problem intentionally placed by the makers of this particular phone.
    – ealfonso
    Commented Oct 1, 2013 at 3:39
1

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.

1
  • Ok. I keep tapping on Build number, nothing seems to happen. I tapped 7 times, but still get the permission problems of above.
    – ealfonso
    Commented Oct 1, 2013 at 2:35
0

Try executing these commands from in recovery, most recent recoveries are debuggable=1 other then that decompile the kernel and change ro.debuggable=0 to 1 and that will allow you to remount with adb and allow adb to run as root!

1
  • I will look into this, though a couple of links to elaborate on your answer would be good.
    – ealfonso
    Commented Oct 15, 2013 at 23:29
0

I might have found a solution for you

Recently i updated my (rooted) LGP500 from Froyo (android 2.2.1) to Gingerbeard (android 2.3.3). After that i found myself in a situation, quite similar to yours (the same, to be honest). I lost my SU credentials, and desperately tried to find a solution to that problem. I was so desperate - i even tried famous Android 4.2 method of enabling developer settings, tapping my poor device like a madman for quite some time. So... i've had exactly the same issue. While surfing the web i found out that the problem was actually in the Gingerbeard build, and stumbled upon some interesting solutions. And, after all the effort - it took me quite some time to figure out which way is the best - i (finally) had my 2.3.3 device rooted.

Note that i only share these things in educational purposes only. No offence taken if you brick your device by accident.


Before proceeding check if:

  • You have properly installed ADB drivers (if not - will show an error with the following text: "could not find online device, please enable USB debugging!"; solution - install or reinstall ADB drivers. Mind that you have to install drivers with your device connected, BUT "USB debugging" disabled.
  • You have "USB debugging" and "Allow mock locations" checked.

    It is highly advisable to have a backup to prevent any data loss. (At least export your contacts to .vcf file)

If everything is OK:

  1. Install UnlockRoot (you can find Unlock_Root_2.3.0.exe here) and execute it.
  2. Run "root" (You can actually ignore everything but the "root" button). Choose your device in the pop-up menu.
  3. Reboot your device (to finish the installation of the SU binary - you will be prompted in the app if you wish to reboot, but are free to do it yourself through adb shell ) And voila! your device is rooted, just like that.
0

You should install the SuperSU app from Google Play. That is the only super-user app which enabled root functionality correctly on my device (Galaxy S4).

After that do adb shell and su. If you want to pull a file from /data directory, you will need to change permissions of that file (using chmod). Then it should work!

0

I had this problem endlessly on my galaxy S3 When i built my android kitchen i found a way around this

  1. Root the device if you need elavated permissions
  2. Unpack build the kernel for your device in the default.prop change these values to the corresponding

ro.secure=0 ro.debuggable=1

  1. Compile/repack and flash
  2. Enable USB debugging
0

Your user capabilities are being stripped somewhere. Look at the /proc/<shell process>/status to see the capability mask.

-1

You could try SUInstaller.

http://theroot.ninja/apks/SUInstaller.apk

Basically sets up su on your phone. This MAY work,from memory i used one click androroot to root samsung y. If this fails,try booting into recovery and flashing supersu, can try samsung galaxy method,or base yours on it, http://www.android.gs/root-samsung-galaxy-s3-with-cwm-recovery-and-supersu/

Goodluck.

Not the answer you're looking for? Browse other questions tagged or ask your own question.