69
votes

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

9
Have you tried adb root, then adb remount ?Michael
running adb root getting -> adbd can't run as root in production buildsIanO.S.
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/wDrake Clarris
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 @DrakeClarrisIanO.S.
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)Drake Clarris

9 Answers

95
votes

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.

21
votes

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

19
votes

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
12
votes

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
8
votes

you can use:

adb shell su -c "your command here"

only rooted devices with su works.

1
votes

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

0
votes

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

0
votes

I rebooted to recovery then

adb root; adb adb remount system; 

worked for me my recovery is twrp v3.5

-5
votes
@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