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

AndroidShellPermissionsAdbRoot

Android Problem Overview


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

Android Solutions


Solution 1 - Android

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.

Solution 2 - Android

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://stackoverflow.com/a/41332316/4962858

Solution 3 - Android

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

Solution 4 - Android

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

Solution 5 - Android

you can use:

adb shell su -c "your command here"

only rooted devices with su works.

Solution 6 - Android

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

Solution 7 - Android

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

Solution 8 - Android

I rebooted to recovery then

adb root; adb adb remount system; 

worked for me my recovery is twrp v3.5

Solution 9 - Android

@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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionIanO.S.View Question on Stackoverflow
Solution 1 - AndroidMartinodFView Answer on Stackoverflow
Solution 2 - Androidfrancis duvivierView Answer on Stackoverflow
Solution 3 - Androiduser2670032View Answer on Stackoverflow
Solution 4 - AndroidQuanlongView Answer on Stackoverflow
Solution 5 - AndroidMohamed M. HagagView Answer on Stackoverflow
Solution 6 - AndroidBakerView Answer on Stackoverflow
Solution 7 - AndroidSudoPlzView Answer on Stackoverflow
Solution 8 - AndroidSaeb MolaeeView Answer on Stackoverflow
Solution 9 - Androidเทคโนโลยี ประเทศไทยView Answer on Stackoverflow