[Q] ADB questions on mounting, remounting and misc - Android Software/Hacking General [Developers Only]

I have a few general questions for using adb, and also a related problem (which got me asking those questions).
Any help would be great.
1. when remounting which is the actual directory and which is the virtual one?
mount -o rw,remount dirA dirB
2. Is it possible to mount/remount several paths to the same virtual path? If so what happens when there are conflicts (directories or files with the same name)?
3. Is 'push' any different from just copying a file to the phone via USB?
Other than those questions I have a more specific one:
I'm trying to push a file into /system/app/ and /system/lib/ but I get a message that the directory is read-only.
I ran 'adb root' and then entered the shell, remounted this way:
'mount -o rw,remount /dev/block/mtdblock3 /system'
It seemed to work (I just got the command echoed back to me with no error messages).
But still I got read-only when trying to push.
The remount does not appear anywhere when I check mounts. Also mtdblock3 does not even appear in /dev/block/.
I can see that there is an rw mount for '/dev/block/stl9 /system' in the mounts - could it be that for SGS stl9 is the block to use instead of mtdblock3?
If so then why can't I push the file (since it's already mounted as rw).
Sorry for all the questions but I'm new to adb.
I'm using SGS GT-I9000 running 2.2.1 based rom with lag-fix (system is ext4)

yuv1 said:
3. Is 'push' any different from just copying a file to the phone via USB?
Click to expand...
Click to collapse
Adb push can push to more than just the sdcard.
It can also push to internal memory
Sent from my HTC Vision using XDA App

Related

Read-Only Filesystem?

Hello, all!
I'm trying edit a file in /etc/ and adb says 'Failed to copy: Read-only filesystem'
Now, is this actually true? Or is this simply a permissions issue? I'm doing this on a non-rooted phone, so I can't 'touch' anything without permission errors, but is it a futile task if the filesystem is read only anyway?
I'm trying to do this from a non-rooted environment as I had intended on making this into an application, but I imagine that if I can't touch or push these files from an adb shell then I won't be able to from the application space either.
It's frustrating not to be able to edit the filesystem of my own phone, I'll be rooting if this is just a permissions problem and not an issue of a non-writable filesystem. Perhaps I could still make an application for rooted-only phones.. hrm..
Any thoughts on this?
/etc is an alias for /system/etc, and /system is a partition mounted as ro (you can confirm this yourself by running mount)
Ah, bugger. So this is hopeless (without modifying and then reflashing)?
Thanks very much.
you need to mount it read write,
mount -oremount,rw /dev/block/mtdblock3 /system
then it will be read/write
try adb remount. if it failes you need root sorry.
Hello, i have the same error and I have root. i have tried adb remount and the mount -oremount,rw /dev/block/mtdblock3 /system
still dotn work. I want to move a script to /
so i only have to type sh debian.sh
nvm I figured it out. i just put it on system and then just type sh debian.sh on the terminal and it works
Rafase282 said:
Hello, i have the same error and I have root. i have tried adb remount and the mount -oremount,rw /dev/block/mtdblock3 /system
still dotn work. I want to move a script to /
so i only have to type sh debian.sh
Click to expand...
Click to collapse
what is the error message? saying it dont work doesnt provide enough info for us to help....
it says sh: cant open aw.sh
so i still have to put the path or cd to where the file is. Is there a way to make /system my home?
no you cant make system your home, system is system, home is home. you can make a symlink if you are familiar with linux - might want to read up about shell commands
korndub said:
you need to mount it read write,
mount -oremount,rw /dev/block/mtdblock3 /system
then it will be read/write
Click to expand...
Click to collapse
Thanks it really worked!! for me i had the same problem as the other guy.
Rafase282 said:
Hello, i have the same error and I have root. i have tried adb remount and the mount -oremount,rw /dev/block/mtdblock3 /system
still dotn work. I want to move a script to /
so i only have to type sh debian.sh
nvm I figured it out. i just put it on system and then just type sh debian.sh on the terminal and it works
Click to expand...
Click to collapse
You *CAN'T* modify the / filesystem. It is part of your BOOT partition, which CANNOT be remounted rw. You would have to read, modify, and write the boot partition.
Rafase282 said:
Hello, i have the same error and I have root. i have tried adb remount and the mount -oremount,rw /dev/block/mtdblock3 /system
still dotn work. I want to move a script to /
so i only have to type sh debian.sh
nvm I figured it out. i just put it on system and then just type sh debian.sh on the terminal and it works
Click to expand...
Click to collapse
Maybe you're typing it in too literally. It should actually read like this:
mount -o remount,rw /dev/block/mtdblock3 /system
There was a typo with -oremount, there should be a space after -o.
Hope that helps.
PS. That command worked for me on a device where everything else failed.
dhkr123 said:
You *CAN'T* modify the / filesystem. It is part of your BOOT partition, which CANNOT be remounted rw. You would have to read, modify, and write the boot partition.
Click to expand...
Click to collapse
actually, / can be mounted rw, but changes are lost on reboot
new user
Firerat said:
actually, / can be mounted rw, but changes are lost on reboot
Click to expand...
Click to collapse
Hi I have my Asus Prime rooted and installed a virtuous Rom and I tried to put a fonts on the System/ fonts folder using root explorer using a instructions to fix some error on some games that need that tis fonts exist on the tablet but it said it cant because file system is read only I'm new and I don't know how to do this commands any help on how to do in a easy (explained) form.
egalpr said:
Hi I have my Asus Prime rooted and installed a virtuous Rom and I tried to put a fonts on the System/ fonts folder using root explorer using a instructions to fix some error on some games that need that tis fonts exist on the tablet but it said it cant because file system is read only I'm new and I don't know how to do this commands any help on how to do in a easy (explained) form.
Click to expand...
Click to collapse
I would recommended not posting in the g1 section. The Asus forums would be a lot more helpful.
egalpr said:
Hi I have my Asus Prime rooted and installed a virtuous Rom and I tried to put a fonts on the System/ fonts folder using root explorer using a instructions to fix some error on some games that need that tis fonts exist on the tablet but it said it cant because file system is read only I'm new and I don't know how to do this commands any help on how to do in a easy (explained) form.
Click to expand...
Click to collapse
Download EStrong File Manager and within the settings of it, enable mounting of the system as read/write.
Or, download Terminal Emulator and type this in:
Code:
mount -o remount,rw /dev/block/mtdblock3 /system
Or, try typing this in terminal/cmd:
Code:
adb remount
Or, if you plan on doing it all from recovery you could do:
Code:
adb shell "mount system"
and then you could do it all from there.
Next time, please post in the proper forum.
Read-Only /system... i just deleted the file, tich push should update/replace and then it worked... only had this bug when i was trying to modify Trebuchet.apk (homescreen)
Hi guys
Not being a linux expert, i'm stuck with the following problem..
i'm using a program who uses low level adb commands to write on the phone extSdCard...
problem: this extSdcard is seen as a readonly filesystem.
What has to be done to make this FS RW instaed of RO ?
This does not happen under windows where I can write to the extSd without problems
thks in advance for the tip

can u write to system folder?

Sorry if this has been answerd, tried searching but didnt find it. (I am driving and looking at same time...ya i know)
Im trying something and i need to put a file in the system folder on the phone. I tried cut/copy and past from my sd card to it and says failed in linda file mgr. I tried in terminal and it gave me cross device link error, if i even put commands in correctly. Linux is new to me, lol.
I am on 1.5 h build for referance
Thanks in advance
You might have to do it in ADB.
adb remount
adb shell
[your command]
besides that, you cannot mv across file systems either. mv is essentially a renaming tool, if you want to move something use cp and rm.
billc.cn said:
besides that, you cannot mv across file systems either. mv is essentially a renaming tool, if you want to move something use cp and rm.
Click to expand...
Click to collapse
I presume you have little *nix background... 'mv' essentially performs both cp and rm functions in one fell swoop. I use it on my desktop and laptop daily. It will copy before it deletes as well, so if you are interrupted, the source files wont be gone with a corrupt destination.
Get Terminal Emulator
this is easily accomplished via terminal emulator, if u have a recent haykur0 build it should include busybox what u would do in the termial type
Code:
su
mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
busybox cp /sdcard/namofyour.file /system/nameofyour.file
thanks guys. got same error when used shell. got it done using:
adb push file.name /system

[Q] Simple adb question (or perhaps not?) Permission Denied

Hi all--in need of some help here--have been crusing the forums for three days and still hitting a brick wall...
Have a rooted (and minimally modded) Atrix 4g in serious need of a hard reset and all the pain that comes with as nearly every app force closes on startup.
Hoping to backup some of my data (contacts, SMS, etc), but unable to do so my usual way (an app, root explorer, or the like), so I'm attempting to use ADB pull to grab the .db files. I'm relatively comfortable with linux, but running into a problem with ro/rw permissions (I think).
have tried the following:
adb pull /data/...../mmssms.db (yields Permission Denied)
# cp /data/....mmssms.db (appears to copy, but no file in destination, and can't copy out of shell)
have been able to remount /system as rw, but not /data where the files are located.
Anybody have suggestions? I'd be most apprecative!
Copy the the files as superuser to your sdcard first and adb pull them from there.
Unfortunately, the whole reason I'm needing to reset is that every app (incl superuser accesses) force closes on start--no chance to move through the phone itself. Since the .db files are not in the usb-accessible file structure I'm thinking that ADB is the only way to access.
Does that make sense?
Hi, OP here--anybody else have a suggestion? Getting a little desperate here... Any thoughts would really be appreciated!
im assuming your accessing ADB via recovery?
You should be able to use su without superuser.apk's permission in that case - however, theoretically, you should not need to use su in recovery anyway.
you can try running
Code:
adb shell ls -l /data/data/*tele*/databases/mmssms.db
and see what you get permissions wise, maybe a chmod could fix it?
Otherwise you could try
Code:
adb shell mount -o remount,rw /data
Another alternative to cp and adb pull is cat
Code:
adb shell cat /path/to/mmssms.db > /path/to/destination-file.db
might copy remote mmssms.db to a local file, while
Code:
adb shell
cat /path/to/mmssms.db > /path/to/destination-file.db
exit
would copy remote to remote
Is /data mounted at all?
This is strange, you should have read access to everything, especially in recovery.
What phone and what recovery?
Its not something as simple as geting the URIs the wrong war round ('cmd local remote' vs 'cmd remote local')?
So, still tinkering... Will give it one last try before I call it quits and just wipe the bloody thing. So, your thoughts were spot on--its probably me missing something.
Quick data dump on progress to data:
Phone: Rooted Motorola Atrix running 2.2
no trouble accessing shell or via ADB
/data is mounted, though only in Read Only mode--can't seem to change, have tried several ways in various modes (shell, su, etc)
Permissions for mmssms.db are: -rw-rw---- radio radio
chmod 777 of the file yields: "Read-only file system," which makes sense since I can't seem to change /data... to rw
Tried to remount rw:
adb shell mount -o remount,rw /data
and
mount -o remount,rw -t yaffs2 /dev/block/mmcblk0p11 /system (for systeem
but get "Operation not permitted" in both cases.... UGH!
Hadn't thought of cat--great idea. Still no real joy however.
I seem to have managed a copy to /system, but can't seem to get it off the device or onto the SD card.
Thanks much for your help so far. Any final thoughts?
SO CLOSE!!!! (and yet...)
crags said:
Hadn't thought of cat--great idea. Still no real joy however.
I seem to have managed a copy to /system, but can't seem to get it off the device or onto the SD card.
Click to expand...
Click to collapse
SO FRUSTRATING!!!! so close, but not quite there--HELP!!!
As noted at the end above, have been able to copy the mmssms.db file to /system/ after remounting as RW
Can't seem to copy or pull off the device--still getting "Permission Denied" no matter which course I try!?!?!
It sounds as if your doing this while booted into the ROM, and (maybe) without su (root)?
su-ing might help, just type su and hit return to enter a root shell
alternatively, going in through recovery ('adb shell reboot recovery') might help as most recoveries ignore permission rules - make sure to mount the partitions your using though.
It almost sounds like the sdcard has no write permissions - you can get the NAND partitions to mount rw, but cant copy to the sdcard.
On my Desire, there is (at least) two mount points: /sdcard and /mnt/sdcard - maybe on your phone only one of your mount points has write permissions?
Otherwise i suggest going in via recovery. You can still use adb (will have to manually mount - 'mount /system' 'mount /date' and 'mount /sdcard' usually work, otherwise use the menu item in recovery )
When in recovery, and after mounting partitions/card, try adb pull, cp /sdcard and cat > sdcard (and if possible cat > computer) plus anything else i forgot (quite tired )
if these dont work something is messed up somewhere in the ROM, or likely kernel and so without ideas a reflash would be the only real solution :/
I did have a bare-minimum+apps recovery script (attached) which might be worth a read to see if your forgetting something obvious - it works on my desire

[Q]How to "remount /system rw" on Android 4.2.1/CM10.1 for SSH/SFTP?

Hallo,
i'm using SSH/SFTP for Android maintenance. On previous Android versions (4.1.2 and below) i simply used apps like 'root explorer' to remount /system to rw but starting with Android 4.2.1/CM10.1 (multi user environment) the remounted /system folder is only remounted for the app itself (root explorer) and not for any other app (including SFTP).
The only workaround i know so far is to remount the folder externally with 'adb remount' but that's a very uncomfortable solution.
Is there any solution how to remount /system rw for SSH/SFTP?
Is it possible to do an 'adb remount' from local shell?
What does 'adb remount' exactly and why does it affects all UIDs and not just one user like if done by (root) apps or local shell (mount -o remount,rw /system)?
Edit: Never mind... it must be some strange side effect with root explorer. If i use the shell command directly without ever using root explorer it seems to work. If is use a 'custom command' (mount -o remount,rw /system) in WinSCP it does work as well.
Did not test it, but first thing that comes to my mind is wrapping the sftp binary in a shell script which does the remount before calling the sftp binary. Then change the subsystem line in the sshd.conf to point to that shell-script. The drawback is that it will always be remounted, no more read-only access at all.
gaius.baltar said:
The drawback is that it will always be remounted, no more read-only access at all.
Click to expand...
Click to collapse
That wouldn't be so dramatically since the RW would only affect the sftp process. That's the weird stuff i haven't understand yet (the per user mount state). But somehow it does work now when using ssh/shell.

Can't remount /system in read-write mode.

Yes, my phone is a chinese Hero H2000+.
I have managed to stick su and busybox into /system/bin using debugfs, but there's absolutely no way I could find to make /system get into read-write mode.
If I type "mount -o rw,remount /system" it seems to work for about 1 second, but then it's remounted read-only. All the changes will be reverted (files I add/remove via script). If I try to run the same command again, it will show me a message saying filesystem is read only.
Does anyone know what might be causing this?
Thanks in advance.

Categories

Resources