[Q] AOSP ADB push /sdcard/ permission denied - HTC Droid DNA

I noticed on some of the recent AOSP ROMs (AICP and Vanir that I remember for sure) that trying to "adb push <file> /sdcard/" results in a basic permission denied error. I tried "adb push <file> /storage/emulated/0/" and got a slightly more specific error saying that the filesystem was mounted as read only. When I tried "adb push <file> /data/media/0/" it went through as expected. I'm rooted with SuperSU 2.14, enabled USB debugging, and granted root to both apps and adb. I tried doing "adb root" and "adb remount" which should've given root and remounted /system as read-write, but I got the same results (using adb and fastboot from the most recent SDK).
It works fine in recovery (TWRP 2.8.0.2), but is there a way to fix it so that the /sdcard/ path works again?

Related

[Q] Read partitions without rooting

I'm trying to find an universal way to read userdata partition(dump partition) without rooting the device.
Assumption :
the device can be boot in fastboot mode
Possible ways :
1. Using fastboot
I've looked into fastboot.c, it taking usb as a usb_handle pointer. I'm trying to move from that point. Fastboot is mostly to write or erase, but I assumed if writing and erasing are possible, reading should be possible as well.
2. Using nvflash, tftp...
It won't be the solution, since it's chip dependent but using chip vendor's download tool to dump partitions.
Go for it!
How does using adb dumping from /dev/mmcblk0p1 sounds?
can I unmount mmcblk0p1, and mount back to readable position?
what device? more info please.
dd if=dev/mmcblk0p? of=data.img bs= 8096 is usually the easiest. (<--just an example)
also this may be helpful:
http://forum.xda-developers.com/showthread.php?t=1247908
chrisrotolo said:
what device? more info please.
dd if=dev/mmcblk0p? of=data.img bs= 8096 is usually the easiest. (<--just an example)
also this may be helpful:
http://forum.xda-developers.com/showthread.php?t=1247908
Click to expand...
Click to collapse
Thanks for the link. using dd command is the exact way I used to dump mmc block as root. Or can it be run under not-rooted phones?
Rooting depends on the kernel version of devices, so when I have to dump various phones, it's very cumbersome to root different kinds of devices and dump.
So I'm finding a way to walk around the problem by using fastboot or if possible adb.
I think fastboot is my best bet so far.
How about adb?
adb shell
df -h
kkiqq1208 said:
How about adb?
adb shell
df -h
Click to expand...
Click to collapse
df -h will only show usage of storage medias. Is there anyway I can read off the actual data?
As already mentioned, dd, but via ADB. I believe that it functions at a low enough level that you should be able to dump mmcblk0 without having to be rooted. If dd can't be directly accessed via adb, you could extract a busybox install from a rooted phone and set it up in your adb directory and then run it from there with busybox (in theory).
Волк said:
As already mentioned, dd, but via ADB. I believe that it functions at a low enough level that you should be able to dump mmcblk0 without having to be rooted. If dd can't be directly accessed via adb, you could extract a busybox install from a rooted phone and set it up in your adb directory and then run it from there with busybox (in theory).
Click to expand...
Click to collapse
Question.
Feels like i'm on the different page from you. If i run dd for /dev/mmcblk0 it does give me an error message saying "Access Denied" of couse mmcblk0 is owned by root. And busybox too(I haven;t tried this), it's just a set of linux commnads, I'm not sure how it can access a file(in this case, a device) which does not have its ownership.
Please correct me if I'm wrong.
Hi All,
There is a way to dump any partition to SD card partition on unrooted device vi ADB.
Paste this couple of lines into the terminal :
adb kill-server
adb wait-for-device
adb shell "echo ro.kernel.qemu=1 > /data/local.prop"
adb reboot
adb wait-for-device
adb shell "mount -wo remount rootfs /"
adb shell "rm /data/local.prop"
adb shell dd if=/dev/block/mmcblk0p1 of=/sdcard/mmcp1.dump
The phone may reboot many time after that, so make sure the file /data/local.prop is deleted after this operation. or execute this :
adb reboot
adb wait-for-device
adb shell "rm /data/local.prop"
adb reboot
hope that helps
__________________
HTC One X (SFR)
Wissam said:
Hi All,
There is a way to dump any partition to SD card partition on unrooted device vi ADB.
Paste this couple of lines into the terminal :
adb kill-server
adb wait-for-device
adb shell "echo ro.kernel.qemu=1 > /data/local.prop"
adb reboot
adb wait-for-device
adb shell "mount -wo remount rootfs /"
adb shell "rm /data/local.prop"
adb shell dd if=/dev/block/mmcblk0p1 of=/sdcard/mmcp1.dump
The phone may reboot many time after that, so make sure the file /data/local.prop is deleted after this operation. or execute this :
adb reboot
adb wait-for-device
adb shell "rm /data/local.prop"
adb reboot
hope that helps
__________________
HTC One X (SFR)
Click to expand...
Click to collapse
Has anyone verified if this works for reading partitions on a non-rooted phone?
This doesn't work on an unrooted, locked device.
Code:
C:\Windows\System32>adb shell "echo ro.kernel.qemu=1 > /data/local.prop"
/system/bin/sh: can't create /data/local.prop: Permission denied
This did not work for my phone.
I got "permission denied" right after
adb shell "echo ro.kernel.qemu=1 > /data/local.prop"
Most of the above will only work on a rooted device with superuser.
The loop holes for shadow copies are mostly fixed since 6.0.
Partitions that can be accessed without root can be dumped with DD through ADB if ADB itself is supported and not internally limited to prevent just this.
Try
Code:
adb reboot recovery
adb root
adb shell
In my device, I can able to read those /data /dev without bootloader unlocking or root.
HemanthJabalpuri said:
Try
Code:
adb reboot recovery
adb root
adb shell
In my device, I can able to read those /data /dev without bootloader unlocking or root.
Click to expand...
Click to collapse
So, ... You are lucky. If I try these commands, I am getting "error: closed". And believe it or not, I have my bootloader UNlocked. It's a doomed chinese tablet, Allwinner 100 SOC.
observingman said:
So, ... You are lucky. If I try these commands, I am getting "error: closed". And believe it or not, I have my bootloader UNlocked. It's a doomed chinese tablet, Allwinner 100 SOC.
Click to expand...
Click to collapse
I found that it is common for many Realme devices to able to use `adb root` in recovery mode.
I have a Realme C12 which has Mediatek Helio G35 MT6765G SoC. So we can also able to `readback` partitions by using SP Flash Tool with the help of MTK-bypass.

Read Only File System

I'm trying to adb push a zip file onto my Prime so I can install the ROM, but adb push always fails, saying that the file system is read only.
What can I do to change this?
Please post full adb command which you are using.
Johnotronz said:
I'm trying to adb push a zip file onto my Prime so I can install the ROM, but adb push always fails, saying that the file system is read only.
What can I do to change this?
Click to expand...
Click to collapse
Send the file to a writable location?
adb push file.ext /sdcard/
or
adb push file.ext /data/local/
I had been using the "adb push file.ext /sdcard/" command, and it returned "Failed to copy....blah: Read-only file system."
This also happens when using "adb push file.ext /data/local"
Try adb push file.ext /mnt/sdcard/
Johnotronz said:
I had been using the "adb push file.ext /sdcard/" command, and it returned "Failed to copy....blah: Read-only file system."
This also happens when using "adb push file.ext /data/local"
Click to expand...
Click to collapse
?
what happens if you type:
Code:
adb remount
First?

[Q] Removed T-Mobile Boot and Shutdown Animations - Now ADB cannot run as root

Hello everyone,
I have a T-Mobile L9 Optimus and I have rooted it according to this guide, it was very helpful
http://forum.xda-developers.com/showthread.php?t=2173465
After removing a bunch of bloatware, I also wanted to remove T-Mobile's Boot and Shutdown animations, which on this phone are located in system/media -> bootanimation.zip and shutdownanimation.zip
I used ADB to pull both files into Windows as a backup
Then, I used ADB to open a shell as su:
adb shell
su
Then I realized I couldn't use the rm command for those zip files because the /system folder is mounted as read-only by default. To change that I used the following commands:
mount -o rw,remount /system
then I used the rm command to remove the two zip files
then I used
mount -o ro,remount /system
to have the folder back in its default read-only state
Then I restarted my phone and voila - no shut-down animation and only a default LG and Android animation on startup
Then I re-started Command prompt to get back to ADB (I still don't know how to exit shell and get back to ADB, help on that?) and here's the problem - I can no longer access root permission in ADB.
When I type in adb root, I get "adbd cannot run as root in production builds"
When I type in adb remount, I get remount failed: Operation not permitted
If I open a shell, I can still enter su, but after the procedures above, ADB thinks that my phone is a production build and I would like to know why, and how I can fix it without returning the original bootanimation.zip and shutdownanimation.zip files.
Is there a background process on T-Mobile phones that goes through a default checklist of system files, then determines that a phone must be a production build if some of those files aren't there? Is there a way to modify that process if it exists? I would rather do that than have to put in a "dummy" bootanimation.zip and shutdownanimation.zip
Lastly, if I were to return those original files through shell, would everything return to normal regarding ADB?
So adb shell and su doesn't work for you now ?
Edit:
I missed a part of your post,
That is a normal behaviour. I don't thing you could adb root before removing animations.
Edit:
If you want to run something from command prompt you have to:
adb shell su -c command_goes_here

Can't do adb push or remount system

when i try to do the following commands "adb push <> <> " and "adb remount" ...i get error.... Like "operation not permitted access denied" ....please help

Editing Hosts File on Rooted Android 11 Google Pixel 3

I'm trying to edit the hosts file in /system/etc/hosts on Android and I rooted the device via Magisk. When I utilize adb push through my Linux machine it can't do it because the system is read only. After seeing this I looked up how to mount it as rw and back but disabling dm-verity didn't work, neither did adb remount (It claimed there was no remount command) and after dropping into a shell on both a terminal emulator on the app and through adb itself it can't remount the filesystem as rw no matter what I do. Ultimately it comes down to three errors on my machine: "adb root" returns: "adbd cannot run as root in production builds", under "su" in the shell a simple "mount -o rw,remount /" returns: "'/dev/block/dm-0' is read-only", "disable-verity" returns: "verity cannot be disabled/enabled - USER build", and "adb root" returns: "adbd cannot run as root in production builds" to which I can find no solutions online. I have also tried going into a file explorer and manually editing the files that way but I still get an error that it's read only. Is there anything at all I can do?
T3ntr0 said:
I'm trying to edit the hosts file in /system/etc/hosts on Android and I rooted the device via Magisk. When I utilize adb push through my Linux machine it can't do it because the system is read only. After seeing this I looked up how to mount it as rw and back but disabling dm-verity didn't work, neither did adb remount (It claimed there was no remount command) and after dropping into a shell on both a terminal emulator on the app and through adb itself it can't remount the filesystem as rw no matter what I do. Ultimately it comes down to three errors on my machine: "adb root" returns: "adbd cannot run as root in production builds", under "su" in the shell a simple "mount -o rw,remount /" returns: "'/dev/block/dm-0' is read-only", "disable-verity" returns: "verity cannot be disabled/enabled - USER build", and "adb root" returns: "adbd cannot run as root in production builds" to which I can find no solutions online. I have also tried going into a file explorer and manually editing the files that way but I still get an error that it's read only. Is there anything at all I can do?
Click to expand...
Click to collapse
Search forum for superrepack tool or SystemRW script. Good luck!
Worked on Android 11 with lineageos: https://www.howtogeek.com/140576/how-to-edit-the-hosts-file-on-android-and-block-web-sites/

Categories

Resources