can u write to system folder? - G1 Android Development

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

Related

Few EXt2 questions

Is it possible to veiw the files in the EXt2 partition from our G1 terminal? If so, can we also delete files? If so, someone explain how, thanks.
asuming is mounted on /system/sd
just
cd /system/sd
ls -la /system/sd
to list the files
is their a way to erase those files
There are commands for deleting files on Android. Look up the Linux Command prompt commands for performing those functions.
If you've rooted your phone and don't know the commands already, you haven't been paying attention to the instructions.
ls = directory listing
cp = copy
mv = move/rename
rm = remove
Those are the very basics. Remember that Unix-like operating systems are case-sensitive and file.txt is different from File.txt or file.TXT.
If you're using wildcards to delete everything, take a precaution and use the dot-slash. It could save you a lot of trouble by ensuring you're only deleting files in the current working directory. To remove all text files in a directory, for example, you'd type rm ./*.txt
god, i hate how rude people are. I grew up with DOS, so dir, and del come more naturally to me than linux commands. So just ease up on the ppl that don't know linux. I didn't know linux til i started to IRC and wanted to run an eggdrop bot. Not like everyone has irc'd or compiled, or whatever. Heck, it has been so long now, I could not write an irc script or egg addon, and I think i was the first to develop some scripts in IRC 20 years ago. So all I can say is chill.
Shaggy
??huh??
whats the beef all about?
you can google the command and linux and probably have a ton of sites that list and explain the usage and stuff like that for *nix commands unix is a very old OS linus torvalds just woke up 1 day at age 15 or sumthin and said im gonna make a unix kernal that runs on my intel based pc and then instead of selling it and making a fortune I'll give it away and still make a fortune.
LINUS is the greatest man of our time, when the other OS was charging BIG $ to run Apache web servers in the .com boom (even more so now) linux was FREE and gave better throughput on the same hardware
Now if you want a pretty box booklet and packaging as you have become accustomed they have them to, some just feel better if they pay for it, free must not be as good as the one that costs right?
why did I bother just rambling, please ignore the babbling lunatic in the corner he is harmless
bhang
beartard said:
If you've rooted your phone and don't know the commands already, you haven't been paying attention to the instructions.
ls = directory listing
cp = copy
mv = move/rename
rm = remove
Those are the very basics. Remember that Unix-like operating systems are case-sensitive and file.txt is different from File.txt or file.TXT.
If you're using wildcards to delete everything, take a precaution and use the dot-slash. It could save you a lot of trouble by ensuring you're only deleting files in the current working directory. To remove all text files in a directory, for example, you'd type rm ./*.txt
Click to expand...
Click to collapse
if you dontknow how to be polite to the noobz then dont say anything at all. let someone else answer their questions.
Hi Beartard,
Thanks for the info.
This site has such a wealth of information, that it can be overwhelming to many members.
Can you tell me how to copy my apps-private from my ext2 partition to my sd card partition so I can back them up?
Thanks
beartard said:
If you've rooted your phone and don't know the commands already, you haven't been paying attention to the instructions.
ls = directory listing
cp = copy
mv = move/rename
rm = remove
Those are the very basics. Remember that Unix-like operating systems are case-sensitive and file.txt is different from File.txt or file.TXT.
If you're using wildcards to delete everything, take a precaution and use the dot-slash. It could save you a lot of trouble by ensuring you're only deleting files in the current working directory. To remove all text files in a directory, for example, you'd type rm ./*.txt
Click to expand...
Click to collapse
uh you wan't to copy your "app-private" folder as a backup in to yoru sdcard correct? well try this
busybox cp -a /system/sd/app-private /sdcard/app-private
if it don't allows you to copy do this command to re mount the system as read-write
mount -oremount,rw /dev/block/mtdblock3 /system
Hi Nitro .
I tried it both ways and it says operation not permitted.
-------------------
Update:
But wait, I connected my phone to the computer and the app-private is copied to the sdcard.
Your procedure worked!
I erased the folder that was copied to test it again.
Then I used just this set of commands and it worked again:
busybox cp -a /system/sd/app-private /sdcard/app-private
So you still get the same error, but it works.
Thanks alot Nitro!!!
Nitro212 said:
uh you wan't to copy your "app-private" folder as a backup in to yoru sdcard correct? well try this
busybox cp -a /system/sd/app-private /sdcard/app-private
if it don't allows you to copy do this command to re mount the system as read-write
mount -oremount,rw /dev/block/mtdblock3 /system
Click to expand...
Click to collapse
u tried it as root? what error u got?
well glad it worked.
Hi,
The error says:
"cannot preserve ownership of ... cannot preserve permissions of ... operation not permitted"
for every file it tries to transfer.
But then when you look in your sdcard the app-private is there.
So it is a false error.
Thanks again.
Nitro212 said:
uh you wan't to copy your "app-private" folder as a backup in to yoru sdcard correct? well try this
busybox cp -a /system/sd/app-private /sdcard/app-private
if it don't allows you to copy do this command to re mount the system as read-write
mount -oremount,rw /dev/block/mtdblock3 /system
Click to expand...
Click to collapse
It's not working for me...
My error is this:
cp: cannot stat '/system/sd/app-private': No such file or directory
Hi,
Use terminal emulator jf 1.41 or better
type su enter
then the busybox commands
Connect your phone to your computer and look on your memory card.
app-private is there
Proxin said:
It's not working for me...
My error is this:
cp: cannot stat '/system/sd/app-private': No such file or directory
Click to expand...
Click to collapse
bestwebs said:
Hi,
Use terminal emulator jf 1.41 or better
type su enter
then the busybox commands
Connect your phone to your computer and look on your memory card.
app-private is there
Click to expand...
Click to collapse
hey guys need some help here i have the same problem, (as far as the error saying 'no such file or dir') and i tried your suggestion about typing su first then the busybox commands.
i have the most current terminal emulator, unfortunately i still continue to get the same error every time i try to run the busybox commands. it just simply say 'no such file or directory"
you guys have any suggestions for me to try ?
any help would be great.
the error i get is "cannot preserve permissions of" i think that error is not something harmful im n o *nix expert but is just saying it wont save the permision of that folder i think...
Code:
# mkdir /sdcard/bk
mkdir /sdcard/bk
# busybox cp -rf /data/app-private/ /sdcard/bk
busybox cp -rf /data/app-private/ /sdcard/bk
cp: cannot preserve permissions of '/sdcard/bk/app-private': Operation not permi
tted
# ls /sdcard/bk
ls /sdcard/bk
app-private
thats what i did.. worked for me.. moved the app-private in to a folder named bk inside the sdcard
Hi,
We are assuming that you have already moved your apps and caches to the memory in a ext2 partition, correct?
Otherwise this will not work.
I 1st followed all the instructions in this post:
http://forum.xda-developers.com/showthread.php?t=468959
All this has to be done 1st including the 2 step 13's
onikus said:
hey guys need some help here i have the same problem, (as far as the error saying 'no such file or dir') and i tried your suggestion about typing su first then the busybox commands.
i have the most current terminal emulator, unfortunately i still continue to get the same error every time i try to run the busybox commands. it just simply say 'no such file or directory"
you guys have any suggestions for me to try ?
any help would be great.
Click to expand...
Click to collapse
nitro all i can say is thank you very much, i was looking through a 15 yr old unix book looking up commands, and it's just been so damn long ago i couldn't put it together.
thanks a ton. i'm sure you saved me at least a few hours.
@bestwebs ya i have done everything else including moving things to the ext2 partition i was just stuck on a few comands here and there.
but again thanks to both of you, and i'm all setup up now.
Hi,
Nitro is a real blast!
Glad it's working.

Exporting PATH in Terminal

Couldn't find any topic about this, so sorry if I've missed it.
Does anyone know where I can export the PATH variable, so that it does that everytime I start the Terminal app?
Edit: aha, apparently setting it in /init.rc works... now to edit my boot.img.
Making PATH Stick
Tested on G1 With JF 1.43 (you dont need to edit your boot.img)
There is a file called init.rc that be found in /system/init.rc
This is loaded on Start-up
So here we go
1.Type su on Terminal Emulator to get root
2. Type (This will make your system path writable)
mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
3. On a system with the Android SDK Installed type
adb pull /system/init.rc c:\init.rc
4. Add the line To the File (I use notepad++ to edit on windows because it saves with linux brakelines)
export PATH /data/busybox:/usr/bin:/usr/sbin:/bin:/sbin:/system/sbin:/system/bin:/system/xbin:/system/xbin/bb:/data/local/bin
You can edit this to sute your needs. This is mine for busybox.
5. Type
adb push c:\init.rc /system/init.rc
6. Reboot your Phone
Ah excellent, that's working.
I just symlinked everything instead
I don't have a init.rc in /system , but there is one in root.
I'm running ADP1.1h.
Should I just create a new init.rc in /system ?
Check the One is / It should call the one in system from that file somewhere.
If thats there you should be Fine to create one.
The one in root doesn't call one in system... hmm...
That odd i am using the ADP 1.1h (JF 1.43) firmware
I'm not using JF, just pure ADP1.1

[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

Fix fix_permissions

Apparentely fix_permissions doesn't work in stock roms (or at least in XKPU + XDA_bam kernel v11).
In order to fix permissions, /sbin/fix_permissions reads /data/system/packages.xml. However that file is not there, but in /dbdata/system/.
I temporarily solved the problem creating a symbolinc link to the file, but in this way "fix_permissions" will not work from CWM (it doesn't mount /dbdata).
The only way to successfully run "fix_permissions" is to run it from from adb or terminal emulator, when /dbdata is already mounted.
(I suggest you not to simply copy the file from /data to /dbata. The one in /dbdata is continuously updated)
The only way to completely solve the problem is to edit /sbin/fix_permissions, but apparently the file is regenerated after every reboot and I don't know how to permanently change it (I think we need to change boot.img, that's why I specified rom and kernel), but I really don't care that much since the command works from adb/terminal emulator.
Anyway, here the commands to create the symbolic link. You need to run them only once from adb/terminal emulator:
Code:
su
mount -o remount rw /system
ln -s /dbdata/system/packages.xml /data/system/packages.xml
mount -o remount ro /system
After that, whenever you need to fix permissions, you simply need to run this from adb/terminal emulator:
Code:
su
fix_permissions
Before you create the symbolic link, you can check if the problem exists in your rom/kernel by running "fix_permissions". The error is:
Code:
cat: can't open '/data/system/packages.xml': No such file or directory
Thanks! Gonna fix that in the next release
loSconosciuto said:
Apparentely fix_permissions doesn't work in stock roms (or at least in XKPU + XDA_bam kernel v11).
In order to fix permissions, /sbin/fix_permissions reads /data/system/packages.xml. However that file is not there, but in /dbdata/system/.
I temporarily solved the problem creating a symbolinc link to the file, but in this way "fix_permissions" will not work from CWM (it doesn't mount /dbdata).
The only way to successfully run "fix_permissions" is to run it from from adb or terminal emulator, when /dbdata is already mounted.
(I suggest you not to simply copy the file from /data to /dbata. The one in /dbdata is continuously updated)
The only way to completely solve the problem is to edit /sbin/fix_permissions, but apparently the file is regenerated after every reboot and I don't know how to permanently change it (I think we need to change boot.img, that's why I specified rom and kernel), but I really don't care that much since the command works from adb/terminal emulator.
Anyway, here the commands to create the symbolic link. You need to run them only once from adb/terminal emulator:
Code:
su
mount -o remount rw /system
ln -s /dbdata/system/packages.xml /data/system/packages.xml
mount -o remount ro /system
After that, whenever you need to fix permissions, you simply need to run this from adb/terminal emulator:
Code:
su
fix_permissions
Before you create the symbolic link, you can check if the problem exists in your rom/kernel by running "fix_permissions". The error is:
Code:
cat: can't open '/data/system/packages.xml': No such file or directory
Click to expand...
Click to collapse
This should have been included in the specific ROM's thread not creating another thread. Closing this since XDA_Bam has stated the fix will be implemented.

[GUIDE] Enable/Disable HTC Virtual CDROM

I personally hate the automounting CDROM image with HTC software. I know it's fairly common knowledge how to disable it but below are the commands for anyone that cares. Make sure android debugging is enabled and enter the applicable command in your computer's terminal. As with other /system edits, this will only stick if you have S-OFF. You may need your phone screen unlocked to accept the su prompt if you haven't already granted ADB root access.
Disable HTC Virtual CDROM:
Code:
adb shell su root -c "mount -o remount,rw /system /system; mv /system/etc/CDROM.ISO /system/etc/CDROM.ISO.bak; mount -o remount,ro /system /system"
Re-Enable HTC Virtual CDROM:
Code:
adb shell su root -c "mount -o remount,rw /system /system; mv /system/etc/CDROM.ISO.bak /system/etc/CDROM.ISO; mount -o remount,ro /system /system"
i didnt know
I didn't know either... thanks!:good:
Never even crossed my ind to remove that annoying "feature"
Cheers man
Any particular reason to not simply rename the file cdrom. iso.bak or just delete it?
Transmitted from the holodeck of my HTC One M8.
hgoldner said:
Any particular reason to not simply rename the file cdrom. iso.bak or just delete it?
Transmitted from the holodeck of my HTC One M8.
Click to expand...
Click to collapse
Nope, I'm in IT so I always rename and not delete for small files. Personal preference.
I had no idea. Thanks so much
Nice. So glad to get rid of that stupid thing. I wanted to do that before but couldn't find where the file was located. Worked great. Thanks alot!
Thanks, just used root explore, found the file, and just added .bak to it.
Put a bootable Linux rescue ISO in there :angel:
unfortunately, I can't find that file. it exist because the silly CD popups every time I plug my phone in, but the .iso isn't in system/etc. my phone seems to be slightly stupid when doing a search. Oh well. Good info to have. Thanks for posting the instructions. I appreciate it.

Categories

Resources