Replace a file that's in use in shell with SU Access. - Android Q&A, Help & Troubleshooting

Hi all sorry this may be a really simple question but I'm struggling with it as I'm new to this and shell
I have an android device (its a custom tablet tablet) that's routed via kingoroot with SU access via adb so im all sorted there,
I I need to overwrite a text file in a folder but it's in use, when I try to copy so cp I get "text file busy" message, I have tried finding the process that's using is and killing that via kill (process id) but it just restarts again it's back under a new id.
Basically I need to overwrite a text file with another with the same name while keeping all the permissions for the old file intact.
This should be simple but it's killing me,
sorry really new at this.

Related

[Q] Rage root + Superuser.apk

Question: Is your Superuser app asking for permissions from apps? Mine isn't. On my old rooted Eris, if I ran an app such as Titanium Backup or Root Explorer, I would get a dialog which would ask if I wanted to grant that app root access. This dialog was via the Superuser app. I don't get that now. It seems like any/every app on my phone has su access.
I'm wondering if it's just me or if this is the way the current root exploit works.
DeezNotes said:
Question: Is your Superuser app asking for permissions from apps? Mine isn't. On my old rooted Eris, if I ran an app such as Titanium Backup or Root Explorer, I would get a dialog which would ask if I wanted to grant that app root access. This dialog was via the Superuser app. I don't get that now. It seems like any/every app on my phone has su access.
I'm wondering if it's just me or if this is the way the current root exploit works.
Click to expand...
Click to collapse
It's just you. Try running root explorer or a screen cap program, and verify that you have root access. You may want to use an updated Superuser.apk too, I know the one I'm using (2.3.6.1) asks, (unless I told it not too).
I'm using Superuser 2.3.6.1. When I run Titanium or Root Explorer, everything works without prompting. Now, I'm concerned.
UPDATE: I opened Superuser, went to settings, scrolled to the bottom and updated the su binary. Now, I get prompted when an app needs access. Problem is, when I reboot the su binary is reset. I think this is due to me using the joeykrim root procedure, which uses a version of su that is scripted to be put in place during the boot process. I'm going to take a look at his scripts and change them so I can keep the su binary installed by the Superuser.apk.
Thanks for the info.
Confirmed my issue was due to using the joeykrim method. I backed out his procedure and used Dirrk's method (posted here: http://forum.xda-developers.com/showthread.php?t=779238) and I get a proper Superuser prompt when an application needs access.
I also noticed another flaw in the joeykrim method. Since his procedure was developed for the Epic, he has some incorrect file names in some places.
If you notice in his instructions where he says use playlogos1 instead of playlogos, this is not updated in all of his steps.
To get your boot screen back, you have to change the last line of playlogos1 or playlogosnow (based on whether you did the lag fix or not)
The file that will not show your boot animation will look like this:
Code:
#!/system/bin/sh
#joeykrim-SDX sdx-developers.com scripted
/system/bin/joeykrim-root.sh
/system/bin/playlogo-orig
To fix it, change the last line to read:
Code:
#!/system/bin/sh
#joeykrim-SDX sdx-developers.com scripted
/system/bin/joeykrim-root.sh
/system/bin/playlogos1-orig
In summary, the playlogos1 file is used to execute other startup scripts. The original playlogos1 file has the boot animation in it. It must be referenced in one of the startup scripts. Since these instructions were used for the Epic, there's a slight typo which keeps the original playlogos1 file from being executed.
Thanks--I came to the forums looking for a solution to the fact that my boot animation was now missing. I tried making your changes but I still can't seem to recover it. Here are what my playlogo scripts look like, keeping in mind I have also installed the lag fix:
playlogos1
Code:
#!/system/bin/sh
sh /system/bin/userinit.sh
playlogosnow
playlogosnow
Code:
#!/system/bin/sh
#joeykrim-SDX sdx-developers.com scripted
/system/bin/joeykrim-root.sh
/system/bin/playlogos1-orig
I'll also have a 3rd file called just playlogo (which was very long). Do you know what the issue is? Thanks so much for your help.
theicemonkey said:
Thanks--I came to the forums looking for a solution to the fact that my boot animation was now missing. I tried making your changes but I still can't seem to recover it. Here are what my playlogo scripts look like, keeping in mind I have also installed the lag fix:
playlogos1
Code:
#!/system/bin/sh
sh /system/bin/userinit.sh
playlogosnow
playlogosnow
Code:
#!/system/bin/sh
#joeykrim-SDX sdx-developers.com scripted
/system/bin/joeykrim-root.sh
/system/bin/playlogos1-orig
I'll also have a 3rd file called just playlogo (which was very long). Do you know what the issue is? Thanks so much for your help.
Click to expand...
Click to collapse
Judging by what your files look like, things should work. The original file is playlogos1. We never touch the playlogo file from what I can remember, so let's not do anything there.
What I would do is make sure the permissions are straight on all the files listed above (primarily playlogos1). They should be 755 (shown below):
Code:
# cd /system/bin
# ls -l playl*
-rwxr-xr-x root shell 10060 2010-08-12 04:30 playlogo
-rwxr-xr-x root root 106 2010-09-11 18:53 playlogos1
-rwxr-xr-x root root 177 2010-09-11 18:55 playlogos1-lagfix
-rwxr-xr-x root shell 14420 2010-08-12 12:30 playlogos1-orig
-rwxr-xr-x root shell 14204 2010-08-12 04:30 playlpm
#
If all else fails, you can always grab the original file from the system dump off of this link: http://forum.androidcentral.com/fascinate-roms-hacks/32839-fascinate-system-dump.html
DEAR GOD
Well, I'm an idiot.
I tried to take the playlogos1 file from the dump you showed me and copy it to my /system/bin file and, sure enough, I got the boot animation back. Problem is, I didn't think it through (that the edited playlogos1 file pointed to the rest of the modified boot sequence) and then the phone wouldn't boot. It would just loop the animations.
I booted into recovery, did a factory reset, and now I can get to the lockscreen and the very beginning of setup but TWLauncher force closes over and over and over and I'm unable to do anything except pull down the notification bar occasionally. I think this is because I moved some things (like bing, daily briefing, etc.) that TWLauncher wants at the outset, and it doesn't have them. I tried to bluetooth over LauncherPro and run it, but it fails at the last moment.
Does anyone know of a way to get to ADB Shell so that I can fix my mistake? Or if someone had an update.zip I could flash to get back to factory (with all of the system files in place), that would be super! Otherwise, it looks like I'm effed and will need to come up with a good story to tell Verizon...
theicemonkey said:
Well, I'm an idiot.
I tried to take the playlogos1 file from the dump you showed me and copy it to my /system/bin file and, sure enough, I got the boot animation back. Problem is, I didn't think it through (that the edited playlogos1 file pointed to the rest of the modified boot sequence) and then the phone wouldn't boot. It would just loop the animations.
I booted into recovery, did a factory reset, and now I can get to the lockscreen and the very beginning of setup but TWLauncher force closes over and over and over and I'm unable to do anything except pull down the notification bar occasionally. I think this is because I moved some things (like bing, daily briefing, etc.) that TWLauncher wants at the outset, and it doesn't have them. I tried to bluetooth over LauncherPro and run it, but it fails at the last moment.
Does anyone know of a way to get to ADB Shell so that I can fix my mistake? Or if someone had an update.zip I could flash to get back to factory (with all of the system files in place), that would be super! Otherwise, it looks like I'm effed and will need to come up with a good story to tell Verizon...
Click to expand...
Click to collapse
Sorry you're having issues. Bad news is, you can't flash any zip updates because we don't have a custom recovery re our phones yet. However, what you should be able to do is use adb to push the apps from /system/app from the system dump. That is.. if you can get adb to work? If it can work from recovery, that should save you.
Good luck.

accidentally move "/system/bin/sh" file on htc aria 2.2

Dear All,
I have been accidentally move the /system/bin/sh file to my SD card,
now, all my app which need root was not function..
What should I do now...?
Please help..... T_T
Move it back.
thankz for reply..
But, any suggestion to move back?
cause now I can't move it back via my phone file manager as the sh file was a
read only file..
Please advise any suggestion that how i can move back
really need advise...
peter tham said:
thankz for reply..
But, any suggestion to move back?
cause now I can't move it back via my phone file manager as the sh file was a
read only file..
Please advise any suggestion that how i can move back
really need advise...
Click to expand...
Click to collapse
You can probably use adb or Terminal Emulator (Free on market) directly on your phone.
Regards
SprigganMaster said:
You can probably use adb or Terminal Emulator (Free on market) directly on your phone.
Regards
Click to expand...
Click to collapse
Dear SprigganMaster,if I use terminal emulator,what was the initial command?
Cause the 'sh' file I move from system,it seem like a script ,and when I open the scree of emulator,I can't type any things...
For your info,I move the 'sh' file from /system /bin/ folder to my SD card /folder.
by using apk root explore,as a result,without the 'sh' script file in /system/bin folder,when I can't access to root explore anymore-force close.
Then I can't move back the 'sh' file to the system/bin folder.
All those root apk does not work anymore...
Now,I am trying my best to get a way to move back the 'sh' file (which is read only file) to my system folder...
Can u guide me about it? Using terminal emulator or any alternative way to move back the file into system?
Waiting your prompt reply and really appreciate it.
Thankz....^^
Hello peter tham,
Please note : my phone is not rooted. I can't try these solutions and I'm quite new to android. Maybe someone with more experience could help you.
I'm not sure if Terminal Emulator use the sh file too but we can try...
To move file, the command is mv.
To copy a file, the command is cp.
Adapt this command with the correct folder where you put the sh file :
Code:
cp /FOLDER/sh /system/bin/
You will need to be root to copy a file to /system folder.
Usually, to gain root privileges, you use the command su.
If Terminal Emulator does not work, you can try with adb.
1- Download sh file to your computer.
2- open a shell (on windows : cmd, on linux whatever you're using as shell)
3- plug your phone in Charge Only mode with USB debuging On
4- Push the file with a command like this one :
Code:
adb push foo.txt /sdcard/foo.txt
adb push <local> <remote>
You can find more info on adb here :
http://wiki.cyanogenmod.com/wiki/ADB
and here :
http://developer.android.com/guide/developing/tools/adb.html
Good Luck

problem with pushing a file via adb and/busybox

I am using Samsung Galaxy Note with stock ICS 4.0.4 and notecore kernel v13 std by g.lewarne.
here is the link for the kernel: http://forum.xda-developers.com/showthread.php?t=1749863 (it is hydracore now. but same for tw roms)
You may have heard the program called Droid Manager by deep unknown xda presented it to us a couple of days ago.
here is the link ıf the program: http://forum.xda-developers.com/showthread.php?t=1772338
my problem is that:
the program cannot push edited build.prop file to my phone. It can do so for any other phones.
I communicated with the dev of the program and he infırmed me that the program uses busybıx and/or adb commands to push the new build.prop file. we tried a couple of things yet could bot find a sokution. we tried the way to create a new file within the phone. (cat command). We 8succeeded however we need to push "enter" button to push the content to the file which is not possible to do so with the coding of droid manager. (i dont know how to tell the problem properly since i am not a dev )
what could be the possible solutions way???
TIA
p.s: i will ask devs to look at the thread. maybe they can shed more light to the problem...
I have opened Teamviwer with "ardicli2000" and worked directly from his laptop on his phone.
Done the following via Droid Manager and Command Line (CMD):
1. remount system as RW: succeeded.
2. Create a file on "/system" using: "touch /system/1.txt" also succeeded.
3. tried pushing a file from his desktop (file name was: 1.txt) FAILED !!
No matter what, once I start using "Adb push" I fail on putting anything on "/system" I get: Permission denied :-/
but when I attempt to create anything on "/system" using busybox commands I SUCCEED !!
what could be the issue?! everything in the program functions without issues except for "adb push" to "/system" :crying:
DeepUnknown said:
I have opened Teamviwer with "ardicli2000" and worked directly from his laptop on his phone.
Done the following via Droid Manager and Command Line (CMD):
1. remount system as RW: succeeded.
2. Create a file on "/system" using: "touch /system/1.txt" also succeeded.
3. tried pushing a file from his desktop (file name was: 1.txt) FAILED !!
No matter what, once I start using "Adb push" I fail on putting anything on "/system" I get: Permission denied :-/
but when I attempt to create anything on "/system" using busybox commands I SUCCEED !!
what could be the issue?! everything in the program functions without issues except for "adb push" to "/system" :crying:
Click to expand...
Click to collapse
Could no one help

[Q] Giving root access to an application that does not ask it.

Hi everyone!
First, I want to thanks for the great help you give me with all the other thread I found on XDA!
But for now I have a think that's giving me headache.
I am searching how can I give root access to any application from google play or from anywhere.
The reason is that I want to use an application that create a web server and can access cache(which is only possible with root access).
Because I need an other device to connect to the server and use this files.
The application is "Web Server ultimate" but I does not have root access.
Is it possible to give this app root access? if Yes how? and if not do you have any other idea?
Thanks
Note : The application that need the file is created with Corona SDK and this cannot be change.
Ok well I am a noob . . .
I post my answer(if it's help...)
I just think a little and realize that I just need right on the files and folder...
So I just use chmod like anybody would do...
Sorry for the useless thread... >_<
No no, it's not a useless thread. (believe me, I've seen much more incredible threads)
Are you able to share with me the answer?
I do not have experience with chmod, and in theory, I want root access something like:
directly selecting a file from those restricted directories and hitting share to Dropbox (or any non root enabled app).
In normal case, it'll fail with an error. (Dropbox at least).
Oh yes no trouble I'll explain :
-first to use "chmod" you have to go to the "terminal emulator" application (I use the one from cyanogen but you can find some other in the store.)
-then write "su" to give root access to your terminal
-then go to the directories you want to change right (use linux shell command to move (eg. “cd”)) (if you need help : search "command linux shell" for more info )(sorry I can't give you url because I am just a new user)
-after that you will have to change right for every file you need using chmod command. For example : you can use "chmod 777 [File]" to give the right of writing, reading and execute the file to everything in your phone but beware of the right you give or remove because some application or even the system can have trouble (more info in wikipedia chmod )
-don't forget to do the same think for every folder that go to your file(if they don't have the right)
and after that every application that does not have root access can access the file (with the right you give).
For example : a file manager that does not have root access have the right to use the File I needed
And for more question don't hesitate
PS : I am not responsible if you do somethings bad with chmod so be careful with chmod command and enjoy it ^^ :laugh:

[Q] ADB commands

Hi everyone! I'm new in the community but a know a thing or two about technology. I wrote this thread to see if someone helps me out solving a problem I have.
I have a Vodafone Smart II with Gingerbread 2.3 not rooted anymore, I'll explain later. I edited Android/system/build.prop file:
(Original) ro.build.version.sdk=10
(Edited) ro.build.version.sdk=11
When I rebooted the phone, it launched normally but when I tried to open Play Store and my Superuser app it force closed it.
Only system apps did not force close, I formatted the phone to see if it could restore the build.prop but did not worked, so my phone is not rooted now, but it has SuperUser app installed but not opening.
Now I am trying to use ADB to copy the build.prop, edit it with Notepad++ and push it to system/bin again.
I need to know if I need any command to give permissions to ADB to change and push build.prop and if so which commands are.
Any suggestions?
As long as you're not rooted you will not have access to /system

Categories

Resources