"rm -r" a file on root with terminal - Android Q&A, Help & Troubleshooting

Hi, does anyone know how to delete a file on root with terminal, as rm -r returns screenshotted error.

kriki200 said:
Hi, does anyone know how to delete a file on root with terminal, as rm -r returns screenshotted error.
Click to expand...
Click to collapse
Did you execute this command as root ? If not enter "su" then enter your command. (Make sure you hit "Allow" when the prompt for you to allow root accès to the shell appears)
And maybe it sounds stupid but try chmod commands if your command doesn't work.
I'm not an expert with android terminal so if the problem is persistent you can try this with a root explorer.
Hope all of this helped
Have a good day

kriki200 said:
Hi, does anyone know how to delete a file on root with terminal, as rm -r returns screenshotted error.
Click to expand...
Click to collapse
The partitition you want to deal with must be mounted as READ-WRITE before.

Raiz said:
Did you execute this command as root ? If not enter "su" then enter your command. (Make sure you hit "Allow" when the prompt for you to allow root accès to the shell appears)
And maybe it sounds stupid but try chmod commands if your command doesn't work.
I'm not an expert with android terminal so if the problem is persistent you can try this with a root explorer.
Hope all of this helped
Have a good day
Click to expand...
Click to collapse
I did, kinda don't want to change permissions... same.

jwoegerbauer said:
The partitition you want to deal with must be mounted as READ-WRITE before.
Click to expand...
Click to collapse
How do I do and undo that, will it change any file permissions?

Example:
Code:
su
cd /
mount -o rw,remount -t auto /system

jwoegerbauer said:
Example:
Click to expand...
Click to collapse
Thank you, it worked, do you know how to undo it, the below command deosn't seem to work and do you know what the "auto" is for in the command?
Code:
mount -o ro,remount -t auto /system

Related

[Q] How to make Android a read and write system

How can I do this in terminal emulator
iloveandroid said:
How can I do this in terminal emulator
Click to expand...
Click to collapse
adb remount
http://www.pocketmagic.net/?p=757
^tells you how
you pretty much just type "mount -o rw,remount -t yaffs2 /dev/block/mtdblock3", then "chmod 777 /system".
iloveandroid said:
How can I do this in terminal emulator
Click to expand...
Click to collapse
I attached a file called sys. push this file to the bin directory and give it permissions then you can just mount the system by typing "sys -rw" to mount read and write and to mount read only you type "sys -ro"
to push the file and give it permissions :
Code:
adb push sys /system/xbin
adb shell chmod 775 /system/xbin/sys
I like the script because its easier to remember than the long command.
If you want to edit the script just open it in notepad and change what you like.
I got that script from Bugless Beast By Pete and modified it to display my rom info.
Remove the ".txt" from the script I had to put that to be able to upload it.

[Q] problems modifying apks?

hey guys,
ive just started to learn how to modify apks and use adb.
my problem is that after i pull the file, i modify the icon i want to change, re-sign it and push it back to the phone. after i reinstall, the icons have not changed :S i re-pulled it, and the icons in the drawable_hdpi file are the one i wanted.
also, completely unrelated to that.... in adb when i try to run adb remount, it says permission denied, but im rooted and i even tried running the shell root beforehand aswell.
i ran a search and followed the various instructions from the different threads and forums but im just stuck at that point
thanks guys
kylec said:
also, completely unrelated to that.... in adb when i try to run adb remount, it says permission denied, but im rooted and i even tried running the shell root beforehand aswell.
Click to expand...
Click to collapse
If you're getting permission denied how have you pushed it back?
XperiaX10iUser said:
If you're getting permission denied how have you pushed it back?
Click to expand...
Click to collapse
i push it to the sdcard lol because it wont let me push to the system/app folder nor the data/app folder. i check my screen and a pop up appears saying that superuser granted access, so i have that.
kylec said:
i push it to the sdcard lol because it wont let me push to the system/app folder nor the data/app folder.
Click to expand...
Click to collapse
Then it's no wonder your icons haven't changed if you haven't installed it to the phone.
Try, but keep your phones screen on whilst you try it...
adb shell (enter)
su (enter)
...allow super user access on phone...
mount -o remount,rw -t yaffs2 /dev/block/mtdblock2 /system
XperiaX10iUser said:
Then it's no wonder your icons haven't changed if you haven't installed it to the phone.
Try, but keep your phones screen on whilst you try it...
adb shell (enter)
su (enter)
...allow super user access on phone...
mount -o remount,rw -t yaffs2 /dev/block/mtdblock2 /system
Click to expand...
Click to collapse
ok i just tried that. when i typed su, it echoed and on my phone it said "unknown has been grandted superuser permissions" so i didnt need to click allow or anything.
then i typed the mount -o remount,rw -t yaffs2 /dev/block/mtdblock2 /system and got mount: operation not permitted
any ideas?
kylec said:
any ideas?
Click to expand...
Click to collapse
Try...
cd C:\android-sdk-windows\tools
adb shell
su
chmod 4755 /system/bin/sh
mount -o remount,rw -t yaffs2 /dev/block/mtdblock2 /system
...and report back.
XperiaX10iUser said:
Try...
cd C:\android-sdk-windows\tools
adb shell
su
chmod 4755 /system/bin/sh
mount -o remount,rw -t yaffs2 /dev/block/mtdblock2 /system
...and report back.
Click to expand...
Click to collapse
yup that worked, i got an echo without errors
EDIT: ok after that i then tried to push the apk to the system/app and also the data/app folders, but i got a different error this time.
it said failed to copy .apk permission denied
kylec said:
it said failed to copy .apk permission denied
Click to expand...
Click to collapse
Try, in a terminal on the phone...
su
chmod 4755 /system/bin/sh
I always struggle trying to get permissions after I've first rooted but can never remember the exact sequence, but do know it's a combination of what I've suggested.
XperiaX10iUser said:
Try, in a terminal on the phone...
su
chmod 4755 /system/bin/sh
I always struggle trying to get permissions after I've first rooted but can never remember the exact sequence, but do know it's a combination of what I've suggested.
Click to expand...
Click to collapse
ill give it a try after uni lol. thanks for all the help mate, its awesome having a place to get advice and help
EDIT: finally got it working... i pushed the file to sdcard then used the terminal emulator and used:
su
mount -o remount,rw -t yaffs2 /dev/block/mtdblock2 /system
cd sdcard
cat x.apk /data/app/x.apk
and that worked perfectly lol

Useful Commands in Terminal Emulator

Hi guys!
I created this thread mainly because many useful things can be done in Terminal emulator. I will show you some simple commands which are useful.
Very useful if you don't have Root explorer when you need it.
Make sure you take a Nandroid backup before you try out just in case you can restore when you do something wrong!
You can get terminal Emulator from here: https://play.google.com/store/apps/details?id=jackpal.androidterm&hl=en
Note: Most commands need root. So type su and press enter and grant superuser permissions to Terminal Emulator!
First type this command before using any of the commands below just in case(needs root)
Code:
su
Some useful commands:
Turning device off (Turns your device off very fast!! ):
Code:
poweroff
Rebooting:
Code:
reboot
Rebooting to Recovery
Code:
reboot recovery
Rebooting to download mode:
Code:
reboot download
Forcing Most Apps to install to SDcard(Root needed with Terminal Emulator, no need root with ADB):
Code:
pm setInstallLocation 2
Alternatively, you can type 0 at the end instead of 2 for Auto location install mode or 1 for Internal memory install mode
To check what the current install location is:
Code:
pm getInstallLocation
Mounting R/W in system(Use with caution)
Code:
mount -o rw,remount -t /system
If above one doesnt work, try this.
Code:
mount -o rw,remount -t ext3 /dev/block/mmcblk1p21 /system
Unmounting R/W in system.
Code:
mount -o ro,remount -t /system
If above code doesn't work, try this
Code:
mount -o ro,remount -t ext3 /dev/block/mmcblk1p21 /system
Moving files from sdcard to system (Use after mounting R/W):
Code:
busybox cp /sdcard/<path> /system/<path>
Example: busybox cp /sdcard/demo/framework-res.apk /system/framework/
Changing file permissions to rw-r--r-- (Use after mounting R/W):
Code:
chmod 644 <path>
Example 1: chmod 644 /system/app/mms.apk
Example 2: chmod 644 /system/app/*.apk (This command changes the file permission of all apps in the folder to rw-r--r--)
Changing the current directory:
Code:
cd <path>
Example: cd /sdcard
Listing all the files and folders under the current directory:
Code:
ls
If you want to view all the files and folders in your sdcard, type:
cd /sdcard
ls
Making a new folder:
Code:
mkdir <path>
Example: mkdir /sdcard/newfolder
Removing files (For System files, Use after mounting R/W)
Code:
rm <path>
Example: rm /system/app/demoapp.apk
Removing Folders:
Code:
rmdir <path>
Get info of your build.prop values
Code:
getprop
That's all for now. I will add a few more later!
If you have any more new commands or if I have given an improper command, feel free to post it in the thread
Thanks for reading.
Have you any idea on why if I were to enter pm set-install-location 2(SD card), the next line would be "Killed"?
UserU said:
Have you any idea on why if I were to enter pm set-install-location 2(SD card), the next line would be "Killed"?
Click to expand...
Click to collapse
I don't understand your question...
Anyways...Thanks for reminding me of that command!
system.img said:
I don't understand your question...
Anyways...Thanks for reminding me of that command!
Click to expand...
Click to collapse
No problem. This is the output from the Terminal Emulator. The bold command changes the default install dir to the SD card:
u0 [email protected]:/ $ pm set-install-location 2
Killed
137|u0 [email protected]:/ $
Click to expand...
Click to collapse
UserU said:
No problem. This is the output from the Terminal Emulator. The bold command changes the default install dir to the SD card:
Click to expand...
Click to collapse
I never got that problem on adb.
Let me see....
This:
mount -o remount rw system
Is much easier than the previous one to mount readwrite.
Sent from my GT-P7300 using xda app-developers app
panpjp said:
This:
mount -o remount rw system
Is much easier than the previous one to mount readwrite.
Sent from my GT-P7300 using xda app-developers app
Click to expand...
Click to collapse
Isnt it /system?
ok...will add to op.
Thanks.
system.img said:
Isnt it /system?
ok...will add to op.
Thanks.
Click to expand...
Click to collapse
Not necessary for it to be /system
Sent from my Desire using xda app-developers app
panpjp said:
Not necessary for it to be /system
Sent from my Desire using xda app-developers app
Click to expand...
Click to collapse
Ok....
system.img said:
I never got that problem on adb.
Let me see....
Click to expand...
Click to collapse
Here's a thread which shed some light on the similar issue.
http://forum.xda-developers.com/showthread.php?t=1495423
UserU said:
Here's a thread which shed some light on the similar issue.
http://forum.xda-developers.com/showthread.php?t=1495423
Click to expand...
Click to collapse
I got it.
It needs root.
So type
su
pm set-install-location 2
Then you are done!
wow thanks !!
Bassesh said:
wow thanks !!
Click to expand...
Click to collapse
Welcome!
Useful
A question: once i tried to type
bootanimation
Click to expand...
Click to collapse
The boot animation started but..i couldn't stop it!! I could "use" the phone (i caught 4 or 5 screens) but the only thing i saw was the bootanimation.. i had to pull the battery off and restart my ace.. any solution??
Toni5830 said:
Useful
A question: once i tried to type
The boot animation started but..i couldn't stop it!! I could "use" the phone (i caught 4 or 5 screens) but the only thing i saw was the bootanimation.. i had to pull the battery off and restart my ace.. any solution??
Click to expand...
Click to collapse
That is the use of the bootanimation command. You can stop it either by pulling battery or closing terminal emulator!
But what I did to stop it was to rotate my phone to landscape and somehow close terminal emulator.
But in ADB it is easier to stop using exit command.
how to get info about /system memory and /data memory ?
rajxelton said:
how to get info about /system memory and /data memory ?
Click to expand...
Click to collapse
What info do you exactly want? Free Space, Partition Size or Used space?
system.img said:
What info do you exactly want? Free Space, Partition Size or Used space?
Click to expand...
Click to collapse
partition size. well can you tell me for all.
Anyone know a command to trigger media scanner?
Thanks for the commands. Quite new to all of this and these will help me understand things a little better

BootLooooop!

Hi all, i added some files into the system directory of my kindle fire hdx 7'.. when i restarted it is stuck in a boot loop on the animated Kindle Fire boot screen, i can ADB onto it, and i attempted to remove the files, but "ADB su" isn't working for me, and I'm unable to access the system directory over ADB... and i don't have custom recovery.
Any ideas on this one? is there a way of restoring the Kindle?
Thanks
osmorgan said:
Hi all, i added some files into the system directory of my kindle fire hdx 7'.. when i restarted it is stuck in a boot loop on the animated Kindle Fire boot screen, i can ADB onto it, and i attempted to remove the files, but "ADB su" isn't working for me, and I'm unable to access the system directory over ADB... and i don't have custom recovery.
Any ideas on this one? is there a way of restoring the Kindle?
Thanks
Click to expand...
Click to collapse
what you get on
Code:
adb shell
su
?
thanks for the reply. when i
adb shell
su
Click to expand...
Click to collapse
it returns to 1:[email protected] where it should show [email protected] any ideas?
osmorgan said:
thanks for the reply. when i
it returns to 1:[email protected] where it should show [email protected] any ideas?
Click to expand...
Click to collapse
after that use
Code:
mount -o rw,remount /system
if you wil get permission denied you need to do hard reset from recovery and try again
after that you could change files in /system
great, i will try this later.. any guides on doing a hard reset?? keeping in mind that i don't have custom recovery..
thanks again.
osmorgan said:
great, i will try this later.. any guides on doing a hard reset?? keeping in mind that i don't have custom recovery..
thanks again.
Click to expand...
Click to collapse
you could get into stock recovery by holding power+volume up
all of this suggesting that you are at 4.5.2 and rooted
for 3.2.X hard reset will delete su - file
You're a star. Thanks. I'll get onto this after work.
ONYXis said:
you could get into stock recovery by holding power+volume up
all of this suggesting that you are at 4.5.2 and rooted
for 3.2.X hard reset will delete su - file
Click to expand...
Click to collapse
No luck :/ was unable to mount, and hard reset via recovery still results in boot loop :/ any other ideas?
Could you post output?
and pls what is your firmware and root method?
Seems no way to recover(sorry
How do I provide the output? I was 4.5.2 and rooted with CVE
copy-paste output from cmd
like:
Code:
adb shell
su
....
ahh i see what you mean.. ive run s uagian after factory reset and its now giving me the root prompt! great! im just about to follow this guys steps
http://forum.xda-developers.com/showthread.php?t=2793253
thanks for your help.. i may be back.
any idea if this method works with stock recovery?
ONYXis said:
copy-paste output from cmd
like:
Code:
adb shell
su
....
Click to expand...
Click to collapse
nope.. that didnt work for me.. do you know how i can push a deb to reflash?
Pls post output to see that exactly doesn't work.
to use that manual you need to use 4.5.3 bin btw
I see, I was having permissions errors when pushing the file to the sdcard, I had mounted the data partition. I am unable to write anything as shell user, but fine as root. Any ideas?
Thanks
adb shell
[email protected]:/ $ su
[email protected]:/ # mount -o rw,remount /cache
[email protected]:/ # mkdir /cache/recovery
mkdir failed for /cache/recovery, File exists
[email protected]:/ # echo install /cache/kindleupdate.bin > /cache/recovery/openrecoveryscript
[email protected]:/ # chmod 0777 /cache/recovery/openrecoveryscript
[email protected]:/ # exit
[email protected]:/ $ exit
Mac-miniownloads $ adb push update-kindle-13.4.5.3_user_453011120.bin /cache/kindleupdate.bin
failed to copy 'update-kindle-13.4.5.3_user_453011120.bin' to '/cache/kindleupdate.bin': Permission denied
What do you think?
ONYXis said:
what you get on
Code:
adb shell
su
?
Click to expand...
Click to collapse
ONYXis said:
Pls post output to see that exactly doesn't work.
to use that manual you need to use 4.5.3 bin btw
Click to expand...
Click to collapse
osmorgan said:
Mac-miniownloads $ adb push update-kindle-13.4.5.3_user_453011120.bin /cache/kindleupdate.bin
failed to copy 'update-kindle-13.4.5.3_user_453011120.bin' to '/cache/kindleupdate.bin': Permission denied
What do you think?
Click to expand...
Click to collapse
You cant do this at that way
you need :
Code:
adb push update-kindle-13.4.5.3_user_453011120.bin /sdcard/update.zip
adb shell
su
mount -o remount,rw /cache
cd /sdcard
cp update.zip /cache
chmod 777 /cache
chmod 777 /cache/recovery
cd /cache/recovery
echo "--update_package=/cache/update.zip" > command
exit
exit
adb reboot recovery
thank you but i still get permissions issues -
failed to copy 'update-kindle-13.4.5.3_user_453011120.bin' to '/sdcard/update.zip': Permission denied
ONYXis said:
You cant do this at that way
you need :
Code:
adb push update-kindle-13.4.5.3_user_453011120.bin /sdcard/update.zip
adb shell
su
mount -o remount,rw /cache
cd /sdcard
cp update.zip /cache
chmod 777 /cache
chmod 777 /cache/recovery
cd /cache/recovery
echo "--update_package=/cache/update.zip" > command
exit
exit
adb reboot recovery
Click to expand...
Click to collapse
osmorgan said:
thank you but i still get permissions issues -
failed to copy 'update-kindle-13.4.5.3_user_453011120.bin' to '/sdcard/update.zip': Permission denied
Click to expand...
Click to collapse
Hmm....Strange. Are you see Fire as mtp device on you Pc (for Mac you need https://www.android.com/filetransfer/)?
If "yes" - try to copy update.zip manual into Fire's internal storage.

(urgent) How to give write permission for system using terminal emulator?

What the command?
I need it quick please.
First you need root acces on your phone.
Then type this in your terminal:
Code:
su
mount -o rw,remount,rw /system
Myst3rion09 said:
First you need root acces on your phone.
Then type this in your terminal:
Code:
su
mount -o rw,remount,rw /system
Click to expand...
Click to collapse
thanks bro.
almost forgot everything on terminal

Categories

Resources