adb remount permission denied, but able to access super user in shell -- android
Asked Answered
P

9

72

so, i'm trying to push some files to /system on android device (zte) I've rooted, connected with ADB,

adb remount -> I get permission denied adb shell su -> I'm able to access shell and create folders etc and edit filesystem

(but in shell I can't copy a file from my computer to device)

Any help please

Palaeontology answered 26/10, 2012 at 15:17 Comment(7)
Have you tried adb root, then adb remount ?Ecstatic
running adb root getting -> adbd can't run as root in production buildsPalaeontology
it's your boot.img - the default.prop or kernel must not be set up for adb remount permissions. Are you trying to push to /system somewhere? Then just run adb shell mount -o rw,remount /system to mount system as r/wRosellaroselle
adb shell mount -o rw,remount /system , is giving me a 'not permitted' error, when I goto into adb shell and do SU , I can run "shell mount -o rw,remount /system" but afterwords trying to adb push to system I still get permission denied @DrakeClarrisPalaeontology
then your boot.img or kernel needs to be changed to allow it. Are you stock and rooted? If so, try a custom rom. If you're on a custom rom, try another. Or look up how to mod a boot.img to change the ro.secure parameter - here's a guide I found on a quick google search: roguedroid.blogspot.com/2012/01/modding-bootimg.html (edit: don't use the dd command in the opening paragraph - you'll need to find what partition your device uses for that command)Rosellaroselle
I was on a zte u930 in china (pretty customized os) and it got stuck in boot loop and I got a replacement :-) @drakeclarris , maybe I'll just get a nexus next timePalaeontology
related: android.stackexchange.com/questions/110927/…Pock
O
98

In case anyone has the same problem in the future:

$ adb shell
$ su
# mount -o rw,remount /system

Both adb remount and adb root don't work on a production build without altering ro.secure, but you can still remount /system by opening a shell, asking for root permissions and typing the mount command.

Onomastic answered 13/11, 2012 at 18:23 Comment(15)
@Ecstatic at which step are you getting the error? Is your phone rooted? What root app are you using (SuperSU, Superuser, ...)?Onomastic
Step two, when I try to run "su" from the adb shell. Phone is rooted. I am using the Superuser app. Is there something I need to do to tell Superuser to allow adb root access?Ecstatic
Not that I know of! When you run "su" you should get a Superuser popup on the phone asking if you want to authorize it. Are you sure that Superuser is working fine and that it's not configured to block adb root?Onomastic
Thanks, that was it! It was popping up a dialog, but I didn't see it before (screen brightness auto-dimmed so I didn't notice anything there). Apparently after a bit it would time out and fail.Ecstatic
I'm not able to run su on my Android device, I get: /system/bin/sh: su: not found. I guess it's cause my device is not rooted.Flaunt
@Jayesh No, you need to be rooted to run su. That's pretty much the point of rooting ;)Onomastic
ok, I have rooted device but I have some issue, My device is not being switched on and in offline mode id display in Eclipse device list (by connecting with usb cable in PC), but I cant push one font file(DroidSans.ttf) please read this android.stackexchange.com/questions/53699/…Qua
I get mount: '/system' not in /proc/mounts on an emulator.Selima
@BeanstheWizard they changed in API 29 I believe, it helped me to create a different emulator with older API (I used 25, android 7.0.0), that might help you.Vivianne
@Kemal Tezer Dilsiz In API 28, I also got thisKendy
@Kendy I was able to do API 28 by launching emulator through cmd with --writable-system tag and then just using adb shell to go in and edit manually. I don't know if that'd work for your case. Good luck. I'm my case I only had to edit the hosts fileVivianne
@Kemal Tezer Dilsiz, that only works for your emulator, rather than the real device.Kendy
@KemalTezerDilsiz When I try to start my API 28 emulator using --writable-system, I get PANIC: Missing emulator engine program for 'x86' CPU. And I'm not even at the disco.Bambara
I also get mount: '/system' not in /proc/mounts with API 30, but it still works somehow when I connect to my database.Dasteel
Use the emulator from <path>/android-sdk/emulator/ instead of the one in <path>/android-sdk/tools/emulatorHenbane
S
27

emulator -writable-system

For people using an Emulator: Another possibility is that you need to start the emulator with -writable-system. That was the only thing that worked for me when using the standard emulator packaged with android studio with a 4.1 image. Check here: https://mcmap.net/q/122331/-cannot-change-android-system-directory-to-rw

Stairwell answered 2/4, 2017 at 1:23 Comment(1)
Yes, this removes the read-only option from QEMU's -drive option: android.stackexchange.com/questions/110927/… But note that it also points to a qcow2 overlay instead of the image itself, so you must then pass this option of future runs.Pock
L
19

Try

adb root
adb remount

to start the adb demon as root and ensure partitions are mounted in read-write mode (the essential part is adb root). After pushing, revoke root permissions again using:

adb unroot
Lipski answered 20/6, 2014 at 20:0 Comment(2)
Getting a "remount failed: no such file or directory"Narton
adb root: device not foundBeneath
P
15

Some newer builds require the following additional adb commands to be run first

adb root
adb disable-verity
adb reboot

Then

adb root
adb remount
Pizzeria answered 24/7, 2018 at 7:47 Comment(4)
@PrzemysławSienkiewicz Same here. Nothing works with the newest emulator.Dunaville
adb disable-verity gives me an error of error:closed. Any fix for this?Bypath
I doesn't work for me. After adb remount I get some writing data errors and finally a "remount failed".Noisemaker
adb disable-verity gives me Device must be bootloader unlockedIson
U
9

you can use:

adb shell su -c "your command here"

only rooted devices with su works.

Upbraiding answered 13/2, 2014 at 16:3 Comment(1)
Thanks man, it worked on android 11, IDK why they forgot to place the remount file under bin dir. :)Symphysis
L
7

Start /w Writable System

Using Emulator Images without Google Play

This does not work with production Android images, i.e. ones with Google Play

Use non-Google Play images for root access & writeable system

Start your emulator from a command prompt as a writable system, using its AVD Name (Pixel3a in this example, see AVD Name below to find or change yours. Make sure another emulator instance is not running when using this command):

emulator @Pixel3a -writable-system

(Keep this command handy. You will need to use it any time you want to access your emulator as 'writable'. I use an alias in gitbash to start my emulator from a gitbash terminal, everytime.)

This launches the emulator.

When startup is complete, open another command prompt/terminal (this one is stuck running the emulator) and:

adb root

Result should be:

$ adb root
restarting adbd as root

Then:

adb remount

Result:

$ adb remount
remount succeeded

When you:

adb shell

and:

su

You should now have full root/writable access:

$ adb shell
generic_x86_arm:/ # su
generic_x86_arm:/ # 

To add a domain to hosts file

$ cd /etc
$ cp hosts hosts.bak1
$ cat hosts
127.0.0.1       localhost
::1             ip6-localhost

$ echo '10.0.2.2 my.newdomain.com' >> hosts
$ cat hosts
127.0.0.1       localhost
::1             ip6-localhost
10.0.2.2        my.newdomain.com

10.0.2.2 is "localhost" for an Android emulator. It will delegate to your Windows/Mac hosts file & DNS services. Any domain you add to your development machine's hosts file, will work as 10.0.2.2 on your Android Emulator hosts file.

AVD Name

In Android Studio AVD Manager can be launched from menu:

Tools > AVD Manager

AVD List

If your emulator name has spaces, you can change that by clicking the pencil icon on right hand side.

I named my emulator 'Pixel3a' without spaces for ease of typing. AVD Details

Lysine answered 10/3, 2021 at 2:14 Comment(1)
These are the only instructions I've found that work. Set up a new emulated Pixel 4a device w/ Android 12.0, and I was able to update the hosts to access a local development server running on Vagrant. Thank you! (If anyone's curious, because of how Vagrant works I used the same IP I have in my host machine's /etc/hosts file: 192.168.56.5.Ornamentation
V
0

I rebooted to recovery then

adb root; adb adb remount system; 

worked for me my recovery is twrp v3.5

Vanesavanessa answered 20/1, 2021 at 5:39 Comment(0)
G
-1

Try with an API lvl 28 emulator (Android 9). I was trying with api lvl 29 and kept getting errors.

Gallows answered 14/1, 2021 at 20:3 Comment(0)
A
-5
@echo off
color 0B
echo =============================================================================
echo.
echo              ClockworkMod Recovery for SAMSUNG GALAXY SIII E210L
echo.
echo                  ClockworkMod Recovery (v6.0.1.2 Touch)
echo.
echo     ¡ô¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¡ô
echo     ¨U                                                                  ¨U
echo     ¨U SAMSUNG GALAXY SIII E210L                                        ¨U
echo     ¡ô¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¡ô
echo.
echo  1) (Settings\Developer options©¥ USB debugging)
echo.
echo  2) CWM SAMSUNG GALAXY SIII E210L 
echo.
echo  3) THANK!!!!!!
echo.
echo =============================================================================
echo                           ARE YOU READY? GO! ¡·¡·¡·
@pause
echo.
echo adb...
adb.exe kill-server
adb.exe wait-for-device
echo wiat¸!
echo.
echo conect...
adb.exe push IMG /data/local/tmp/
adb.exe shell su -c "dd if=/data/local/tmp/GANGSTAR-VEGAS-1.3.0-APK-Andropalace.net.apk of=/mnt/sdcard/Android/GANGSTAR-VEGAS-1.3.0-APK-Andropalace.net.apk
adb.exe shell su -c "rm /data/local/tmp/bootloader.img"
adb.exe shell su -c "rm /data/local/tmp/recovery.img"


echo ===============================================================
echo     ClockworkMod Recovery!
echo.
@pause
Anthozoan answered 8/12, 2015 at 2:31 Comment(2)
a little bit of explanation along with your code might go a long wayMagic
You can delete the answer if you don't want to carry with so many downvotesKendy

© 2022 - 2024 — McMap. All rights reserved.