Here is an easy way to run commands after each boot.
In the init.rc file, the file /system/bin/clrbootcount.sh always gets run after a successful boot. Since it isn't trivial to change the init.rc file, we will use clrbootcount.sh to run commands after a boot. Since people are having issues with modifying clrbootcount.sh, we will choose a safer method.
clrbootcount.sh will always attempt to call /data/boot_complete_hook.sh, which doesn't exit. We are going to create this file and use that to run commands.
Create a file named boot_complete_hook.sh with the following contents (On Windows, use Notepad++):
Code:
#!/system/bin/sh
##################################################################################
#
# File boot_complete_hook.sh
# Description Run any commands that you want to be run after boot
#
##
setprop persist.service.mount.umsauto 0
echo 68000,1024/70/200/40,600/10/11/10 > /sys/devices/omapdss/display0/timings
Save and close.
Now, execute the following commands to put the file on your nook:
Code:
adb push boot_complete_hook.sh /data/boot_complete_hook.sh
adb shell chmod 755 /data/boot_complete_hook.sh
Note:
Before you reboot verify that the file will run properly. Open up a shell via adb shell. Inside that run the following:
Code:
setprop persist.service.mount.umsauto 1
getprop persist.service.mount.umsauto
You should see 1 as the output. Now run:
Code:
sh /system/bin/clrbootcount.sh
You should see an output similar to:
Code:
4+0 records in
4+0 records out
4 bytes transferred in 0.010 secs (400 bytes/sec)
Now run:
Code:
getprop persist.service.mount.umsauto
If 0 is printed out, exit the shell.
If 0 is not printed out, something went wrong and the file will not be run properly on the next boot. If you do reboot in this state 8 times, the boot count won't be reset and you will hit the factory reset. While you are trying to get the script working, you could always manually reset the boot count by executing (from a shell):
Code:
dd if=/dev/zero of=/rom/devconf/BootCnt bs=1 count=4
Now reboot:
Code:
adb shell reboot
As you are rebooting, run:
Code:
adb shell getprop persist.service.mount.umsauto
It will return 1 since the init.rc file sets it to 1 explicitly. However, once you are fully booted it will return 0.
Didn't work for me.
JoshMiers said:
Here is an easy way to run commands after each boot.
In the init.rc file, the file /system/bin/clrbootcount.sh will always gets run after a successful boot. Since it isn't trivial to change the init.rc file, we will use clrbootcount.sh to run commands after a boot.
Do:
Code:
adb pull /system/bin/clrbootcount.sh .
Open the file (on Windows, don't use Notepad) and you should see:
Code:
#!/system/bin/sh
##################################################################################
#
# File clrbootcount.sh
# Description Clear the bootcount variable to 0 on successful boot
#
##
# Run potential hook first.
/data/boot_complete_hook.sh
# Zero the boot count
dd if=/dev/zero of=/rom/devconf/BootCnt bs=1 count=4
Add the following to the end of the file:
Code:
#run other commands
setprop persist.service.mount.umsauto 0
Save and close.
Now, execute the following commands to put the file back on your nook:
Code:
adb shell mount -o rw,remount -t ext2 /dev/block/mmcblk0p5 /system
adb push clrbootcount.sh /system/bin/clrbootcount.sh
adb shell chmod 755 /system/bin/clrbootcount.sh
adb shell mount -o ro,remount -t ext2 /dev/block/mmcblk0p5 /system
adb shell reboot
As you are rebooting, run:
Code:
adb shell getprop persist.service.mount.umsauto
It will return 1 since the init.rc file sets it to 1 explicitly. However, once you are fully booted it will return 0.
Click to expand...
Click to collapse
Wouldn't this screw up the 8X "back to stock firmware" sequence since that depends on having the boot counter increment up to 8?
docfreed said:
Wouldn't this screw up the 8X "back to stock firmware" sequence since that depends on having the boot counter increment up to 8?
Click to expand...
Click to collapse
The script file is already there and already being called after each successful boot. The 8x boot counter logic happens with 8 failed boots. Regardless, the instructions just show you how to append a custom command to be run after the stock commands run, no other booting logic is affected.
>DARKMAN< said:
Didn't work for me.
Click to expand...
Click to collapse
What didn't work? Run the following and paste your output:
Code:
adb shell cat /system/bin/clrbootcount.sh
Code:
adb shell ls -l /system/bin/clrbootcount.sh
Awesome, thanks for the tip! Been wondering how to put in my own stuff into the init, I'd love to modify the path but I suspect this won't be the way, but regardless it's good info.
BTW, I have found that disabling this USM property seems to disable the SD card automounting but the Nook itself might still automount... But that's for another thread I suppose
Worked perfectly
This is exactly what I was looking for.
Thanks
Sent from my LogicPD Zoom2
There seems to be a little confusion over at the refresh rate thread http://forum.xda-developers.com/showthread.php?t=901294.
To be explicit, if you want to disable auto-mounting as well as change the refresh rate, you would edit clrbootcount.sh to have the following contents:
Code:
#!/system/bin/sh
##################################################################################
#
# File clrbootcount.sh
# Description Clear the bootcount variable to 0 on successful boot
#
##
# Run potential hook first.
/data/boot_complete_hook.sh
# Zero the boot count
dd if=/dev/zero of=/rom/devconf/BootCnt bs=1 count=4
#run other commands
setprop persist.service.mount.umsauto 0
echo 68000,1024/70/200/40,600/10/11/10 > /sys/devices/omapdss/display0/timings
If you don't want to disable auto-mounting, just remove the line with
Code:
setprop persist.service.mount.umsauto 0
I ran what was posted and it still returns 1.
Sent from my HAXSUNG Moment
JoshMiers said:
What didn't work? Run the following and paste your output:
Code:
adb shell cat /system/bin/clrbootcount.sh
Code:
adb shell ls -l /system/bin/clrbootcount.sh
Click to expand...
Click to collapse
Screen shot attached (1.0.1 Auto-Nooter 2.12.25).
# cat /system/bin/clrbootcount.sh
cat /system/bin/clrbootcount.sh
#!/system/bin/sh
################################################################################
##
#
# File clrbootcount.sh
# Description Clear the bootcount variable to 0 on successful boot
#
##
# Run potential hook first.
/data/boot_complete_hook.sh
# Zero the boot count
dd if=/dev/zero of=/rom/devconf/BootCnt bs=1 count=4
#
# ls -l /system/bin/clrbootcount.sh
ls -l /system/bin/clrbootcount.sh
-rwxr-xr-x root root 338 2011-01-06 19:50 clrbootcount.sh
#
edit double post oops
I lost my backup of clrbootcount.sh
and now it won't reset the boot count.
any help would be greatly appreciated.
adb shell getprop persist.service.mount.umsauto
Click to expand...
Click to collapse
always returns 1 during and after complete reboot. The echo command for screen does not persist. Have followed your instructions super letter by letter multiple times and leading up to the reboot everything is exactly as you say.
Right now, I am most concerned that whatever I have done will not reset the boot count since it stays at 1 and does not go to 0. I've already lost my entire setup twice and had to start from scratch trying to make this work. At least I know how to reset to 0 with the line command script but how do I ensure i don't need to worry about it?
I think this process may be a bust.
I am on 1.0.0 and have been using this since I posted it and both the refresh rate and automount values are sticking between reboots.
>DARKMAN< said:
# cat /system/bin/clrbootcount.sh
cat /system/bin/clrbootcount.sh
#!/system/bin/sh
################################################################################
##
#
# File clrbootcount.sh
# Description Clear the bootcount variable to 0 on successful boot
#
##
# Run potential hook first.
/data/boot_complete_hook.sh
# Zero the boot count
dd if=/dev/zero of=/rom/devconf/BootCnt bs=1 count=4
#
# ls -l /system/bin/clrbootcount.sh
ls -l /system/bin/clrbootcount.sh
-rwxr-xr-x root root 338 2011-01-06 19:50 clrbootcount.sh
#
Click to expand...
Click to collapse
I am assuming you are using the new method, which would mean you need to post your /data/boot_complete_hook.sh
>DARKMAN< said:
I lost my backup of clrbootcount.sh
and now it won't reset the boot count.
any help would be greatly appreciated.
Click to expand...
Click to collapse
The clrbootcount.sh file that you posted is the default file. I will post it again:
Code:
#!/system/bin/sh
##################################################################################
#
# File clrbootcount.sh
# Description Clear the bootcount variable to 0 on successful boot
#
##
# Run potential hook first.
/data/boot_complete_hook.sh
# Zero the boot count
dd if=/dev/zero of=/rom/devconf/BootCnt bs=1 count=4
Also, the original post explains how to manually reset the boot count. Here it is:
If 0 is not printed out, something went wrong and the file will not be run properly on the next boot. If you do reboot in this state 8 times, the boot count won't be reset and you will hit the factory reset. While you are trying to get the script working, you could always manually reset the boot count by executing (from a shell):
Code:
dd if=/dev/zero of=/rom/devconf/BootCnt bs=1 count=4
jleecong said:
Screen shot attached (1.0.1 Auto-Nooter 2.12.25).
Click to expand...
Click to collapse
It appears you are running Windows, so I am hoping that you did not use Notepad to edit this file.
Since you are running 1.0.1, post your /init.rc file.
Thought I may have been doing something wrong since I used notepad but downloaded Notepad++ and created the new .sh file. Still no go. Screen still flickers and USB still automounts. Maybe 1.0.1 just is not commpatible with this process. Only difference I can see.
The getprop persist.service.mount.umsauto also indicates 1 after full boot and not 0. Pretty sure this will wipe everything out after 8 boots, going to wipe it all out now and proactively prevent it.
Related
Im running a userinit file for the cyanogen 3.91 rom and if tried to run it with now success. it just shows 000 on the swap when i run free. and when i try to run cat /proc/ramzswap it says that no such directory exists,
this is the userinit.sh
#!/system/bin/sh
# $Id: userinit.sh,v 1.2 2009/07/17 01:11:25 noah Exp $
# Do not change the #! above and expect that shell to invoke this script at
# boot, because a2sd forcibly calls this with /system/bin/sh.
PATH=/system/xbin/bb:$PATH
# Currently our busybox build uses the "small" modprobe and insmod,
# which don't support parameter arguments. (The usage string lies.)
uname_r=`uname -r`
moddir=`find /system/modules -type d -name $uname_r`
insmod=/system/bin/insmod
if $insmod $moddir/compcache/xvmalloc.ko &&
$insmod $moddir/compcache/ramzswap.ko disksize_kb=32768
then
sysctl -w vm.swappiness=40
mknod /dev/ramzswap0 b 253 0
swapon /dev/ramzswap0
fi
exit;
# eof
yeah dude im getting the same problem. Ive asked everywhere and no one can help. the only difference i notice are the two lines (exit; # eof) at the end of yours.
EDIT:
DUDE, just got it to work, this is what to do:
go here: http://forum.xda-developers.com/showthread.php?t=537236
download the text file.
open the text file delete everything and paste this in:
Code:
#!/system/bin/sh
# $Id: userinit.sh,v 1.2 2009/07/17 01:11:25 noah Exp $
# Do not change the #! above and expect that shell to invoke this script at
# boot, because a2sd forcibly calls this with /system/bin/sh.
PATH=/system/xbin/bb:$PATH
# Currently our busybox build uses the "small" modprobe and insmod,
# which don't support parameter arguments. (The usage string lies.)
uname_r=`uname -r`
moddir=`find /system/modules -type d -name $uname_r`
insmod=/system/bin/insmod
if $insmod $moddir/compcache/xvmalloc.ko &&
$insmod $moddir/compcache/ramzswap.ko disksize_kb=32768
then
sysctl -w vm.swappiness=40
mknod /dev/ramzswap0 b 253 0
swapon /dev/ramzswap0
fi
save it and close it
rename it userinit.sh and type this in adb:
Code:
adb push userinit.sh /system/sd
adb shell chmod 755 /system/sd/userinit.sh (not sure if needed being safe)
adb shell reboot
hope that helps
did you get it to work on 3.91?
ive tried everything and still swap is 0 0 0 0
I'm not an expert in the whole compcache thing I haven't followed it but doesn't "free" in terminal show swap, not compcache? I believe "cat /proc/ramzswap" shows compcache compression..
alritewhadeva said:
I'm not an expert in the whole compcache thing I haven't followed it but doesn't "free" in terminal show swap, not compcache? I believe "cat /proc/ramzswap" shows compcache compression..
Click to expand...
Click to collapse
"free" shows the swap file total, used and free. ramzswap goes more indepth
ubernicholi said:
"free" shows the swap file total, used and free. ramzswap goes more indepth
Click to expand...
Click to collapse
ah ok. Thanks for the clarification.
i tried the cat /proc/ramzswap and it said the file or directory could not be found
Compache DOES NOT WORK ON 3.9.1
Per the Nookie Froyo thread they have a suggestion to increase the refresh rate to 68000 to stop/reduce flicker.
I noticed a similar flicker on "stock" 2.1 and checked /sys/devices/omapdss/display0/timings only to find out it is also set at 48000. I increased it to 68000, but it is reset after each reboot.
What is the proper refresh rate? Anyone else notice a flicker on the stock ROM?
jleecong said:
Per the Nookie Froyo thread they have a suggestion to increase the refresh rate to 68000 to stop/reduce flicker.
I noticed a similar flicker on "stock" 2.1 and checked /sys/devices/omapdss/display0/timings only to find out it is also set at 48000. I increased it to 68000, but it is reset after each reboot.
What is the proper refresh rate? Anyone else notice a flicker on the stock ROM?
Click to expand...
Click to collapse
what process did you use to modify the file?
paleh0rse said:
what process did you use to modify the file?
Click to expand...
Click to collapse
I used the following from the thread I linked.
Code:
adb shell echo 68000,1024/70/200/40,600/10/11/10 > /sys/devices/omapdss/display0/timings
jleecong said:
I used the following from the thread I linked.
Code:
adb shell echo 68000,1024/70/200/40,600/10/11/10 > /sys/devices/omapdss/display0/timings
Click to expand...
Click to collapse
Did you su and mount as r/w first?
paleh0rse said:
Did you su and mount as r/w first?
Click to expand...
Click to collapse
You don't remount /sys
so does anyone know how to make this stick after boot?
dennisi01 said:
so does anyone know how to make this stick after boot?
Click to expand...
Click to collapse
See the thread I just made: http://forum.xda-developers.com/showthread.php?t=901791
jleecong said:
I used the following from the thread I linked.
Code:
adb shell echo 68000,1024/70/200/40,600/10/11/10 > /sys/devices/omapdss/display0/timings
Click to expand...
Click to collapse
Originally Posted by dennisi01
so does anyone know how to make this stick after boot?
See the thread I just made: http://forum.xda-developers.com/showthread.php?t=901791
Click to expand...
Click to collapse
Thank you both. Seems to work. Now I know how to run my own scripts afterboot.
Does that mean we add the
adb shell echo 68000,1024/70/200/40,600/10/11/10 > /sys/devices/omapdss/display0/timings
Click to expand...
Click to collapse
at the end of the clrbootcount.sh text to have it run that command to fix the refresh and make it stick?
I did this (as I posted in the nook flicker thread):
I did a CAT on immediately after, and it had defaulted instead to 66461 instead of 68000 (maximum rate for the chip?)
Of course it also cleared upon reboot. Should I have seen a flicker improvement right away?
After clearing up all the posted suggestions listed here is what worked for me
greenmky said:
I did this (as I posted in the nook flicker thread):
I did a CAT on immediately after, and it had defaulted instead to 66461 instead of 68000 (maximum rate for the chip?)
Of course it also cleared upon reboot. Should I have seen a flicker improvement right away?
Click to expand...
Click to collapse
I also get 66461
------------------------
increase the refresh rate to 68000/66461 to stop/reduce flicker.
---------------------------------------------------------------------------
adb pull /system/bin/clrbootcount.sh
gedit clrbootcount.sh (assume you stay in specific dir)
add this to end of file and save
---------------------------------------------------
#run other commands
setprop persist.service.mount.umsauto 0
---------------------------------------------------
NEXT
adb shell mount -o rw,remount -t ext2 /dev/block/mmcblk0p5 /system
adb push clrbootcount.sh /system/bin/clrbootcount.sh
adb shell chmod 755 /system/bin/clrbootcount.sh
adb shell mount -o ro,remount -t ext2 /dev/block/mmcblk0p5 /system
adb shell reboot
--------------
NEXT
adb shell - NOW AT THE su # PROMPT (HAD NO LUCK WITH THE ADB SHELL and then commands all in one line)
cat /sys/devices/omapdss/display0/timings
mount -o remount,rw /dev/block/mmcblk0p5 /system
chmod 0755 /sys/devices/omapdss/display0/timings
echo 68000,1024/70/200/40,600/10/11/10 > /sys/devices/omapdss/display0/timings
mount -o ro,remount -t ext2 /dev/block/mmcblk0p5 /system
reboot
-----------------------------------------------
NEXT
cat /sys/devices/omapdss/display0/timings
66461,1024/70/200/40,600/10/11/10
----------------------------------------------
Three reboots and I still have the changes...
Read all the posting listed if you want/need more details....
here.david said:
adb shell - NOW AT THE su # PROMPT (HAD NO LUCK WITH THE ADB SHELL and then commands all in one line)
cat /sys/devices/omapdss/display0/timings
mount -o remount,rw /dev/block/mmcblk0p5 /system
chmod 0755 /sys/devices/omapdss/display0/timings
echo 68000,1024/70/200/40,600/10/11/10 > /sys/devices/omapdss/display0/timings
mount -o ro,remount -t ext2 /dev/block/mmcblk0p5 /system
reboot
Click to expand...
Click to collapse
You do not need to remount /system to write to /sys, and if you have chmod at all (unlikely) it would not be 755, it would be 644.
here.david said:
I also get 66461
------------------------
increase the refresh rate to 68000/66461 to stop/reduce flicker.
---------------------------------------------------------------------------
adb pull /system/bin/clrbootcount.sh
gedit clrbootcount.sh (assume you stay in specific dir)
add this to end of file and save
---------------------------------------------------
#run other commands
setprop persist.service.mount.umsauto 0
---------------------------------------------------
NEXT
adb shell mount -o rw,remount -t ext2 /dev/block/mmcblk0p5 /system
adb push clrbootcount.sh /system/bin/clrbootcount.sh
adb shell chmod 755 /system/bin/clrbootcount.sh
adb shell mount -o ro,remount -t ext2 /dev/block/mmcblk0p5 /system
adb shell reboot
--------------
NEXT
adb shell - NOW AT THE su # PROMPT (HAD NO LUCK WITH THE ADB SHELL and then commands all in one line)
cat /sys/devices/omapdss/display0/timings
mount -o remount,rw /dev/block/mmcblk0p5 /system
chmod 0755 /sys/devices/omapdss/display0/timings
echo 68000,1024/70/200/40,600/10/11/10 > /sys/devices/omapdss/display0/timings
mount -o ro,remount -t ext2 /dev/block/mmcblk0p5 /system
reboot
-----------------------------------------------
NEXT
cat /sys/devices/omapdss/display0/timings
66461,1024/70/200/40,600/10/11/10
----------------------------------------------
Three reboots and I still have the changes...
Read all the posting listed if you want/need more details....
Click to expand...
Click to collapse
Tried all that and it did not stick. The final CAT showed a reversion to 48000. Still don't understand how the change to the clrbootcount.sh is supposed to make it stick but it isn't working.
DatterBoy said:
Tried all that and it did not stick. The final CAT showed a reversion to 48000. Still don't understand how the change to the clrbootcount.sh is supposed to make it stick but it isn't working.
Click to expand...
Click to collapse
It wouldn't. The change to the clrbootcount.sh only changes the automount, the change to the /sys var is completely temporary. I assume one could also put it in the clrbootcount.sh, assuming it isn't modified later by the system (negating the change made from the clrbootcount.sh script).
Yeah. not sure how anyone is getting this to work but i can't figure it out. As a warning, modifying the clrbootcount.sh and trying to incorporate the fefresh change script has force firmware into boot loop to needing a factory reset twice now. Wonder if anyone else had the same experience.
The flicker is annoying and the refresh change works, but just won't stick.
To get it to stick, follow the steps on my other thread http://forum.xda-developers.com/showthread.php?t=901791.
When you edit clrbootcount.sh, add the following to the end:
Code:
echo 68000,1024/70/200/40,600/10/11/10 > /sys/devices/omapdss/display0/timings
The final file (if you also want to disable automounting), will look like:
Code:
#!/system/bin/sh
##################################################################################
#
# File clrbootcount.sh
# Description Clear the bootcount variable to 0 on successful boot
#
##
# Run potential hook first.
/data/boot_complete_hook.sh
# Zero the boot count
dd if=/dev/zero of=/rom/devconf/BootCnt bs=1 count=4
#run other commands
setprop persist.service.mount.umsauto 0
echo 68000,1024/70/200/40,600/10/11/10 > /sys/devices/omapdss/display0/timings
While I've never really looked at this, but isn't the "refresh" "rate" largely irrelevant with LCD based screens? I'd always just assumed that even assigning them a "refresh" "rate" was just a place holder to make things work and not break CRT compatibility in drivers/display engines.
Did all this from a super clean root. Did not hold.
cutterjohn said:
While I've never really looked at this, but isn't the "refresh" "rate" largely irrelevant with LCD based screens? I'd always just assumed that even assigning them a "refresh" "rate" was just a place holder to make things work and not break CRT compatibility in drivers/display engines.
Click to expand...
Click to collapse
Don't know if that is true, but I have seen flicker on other LCD panels that could be addressed with refresh changes. The echo command does work instantly on the NC but just won't hold for me.
I have been playing with this and while the changes in clrbootcount.sh do stick, I'm unable to get it to either set the refresh rate or run a script that sets the refresh that I KNOW works from the terminal. Seems idealy this should be set in the ROM. Back to the terminal...
I should add I'm running 1.0.1 (Auto-Nooter 2.12.25) and also tried it in Nookie Froyo.
Sogarth's webtop2sd will be released soon, you really should wait and install that instead of this! Thanks -The Management
No longer breaks on 1.83, thanks to Romracer
Update: This script worked on my phone. Mind you I was installing it from a fresh SBF flash, but it should work on your phone too. Absolutely no guarantees as usual.
Update 11th April 2011, 06:59 PM: Won't be getting CWM package because it'd be huuuuuuuuuge.
Update 28th April 2011. 16:38 PM: Removing BETA tag since there have been no issues with the script for quite some time.
First off I would like to thank Sogarth for making this script in the first place as well as Romracer for fixing it for 1.83. Since he is busy doing more important work I decided to do this little hack for those of us that updated to 1.5.7 and dont feel like flashing back to earlier versions to get full Ubuntu working.
Again, this is only necessary if you're already running 1.5.7 or 1.8.3.
Secondly, I am still working on this script so it may not work for you. If you have a problem you may post in the thread or PM me showing exactly the error message, word for word, that you receive.
Updates will be included in the OP from time to time as I fix errors.
Instructions:
1) install.bat (from your computer)
2) adb shell (get a shell on your phone)
3) su (get root on your phone in that shell)
4) . /data/local/tmp/install.sh (run the install script *on your phone* don't forget the "." and the space after the dot, or you will have to chmod 755 the shell script manually)
5) ?????
6) profit\
Noob instructions, written by Viamonte (I take no credit or responsibility):
Thanks again for all your help. Now the noob instructions:
"1-Download "Terminal Emulator" from the market, on your phone (or any other terminal), and the file anexed in this thread to your computer.
2-Connect the Atrix to the computer via USB, configuring the connection mode to "None" and enabling USB Debugging mode (Settings>Applications>Development>USB debugging)
3-Unzip the file you downloaded on your pc, and run Install.bat. This will push the script to your phone.
4-Go back to your phone and open the emulator you downloaded. Then type "su" (without quotes) and press enter. Then type ". /data/local/tmp/install.sh" (without quotes) and press enter again.
The script should begin running now. It will stop in two moments where you'll be instructed to get a cup of coffee, and may take several minutes to continue form this point. When finished, the Atrix will reboot.
To check if this worked, use the Webtop either on your multimidia dock or your lapdock and verify if new itens appeared on your task bar and on the right upper side of the screen"
0.3.1 release
0.2 release
0.1 first release
Changelog
0.3.1 fix to gconf file's mdate so it does what its supposed to do =)
0.3 Small typo fixes and cpp package install fix by romracer, now works on 1.83 =)
0.2 Fixed some typos in uninstall.sh and make sure the %gconf file wound up in the right spot.
0.1 - first version. NOT CWM install but ready to be packaged for that more or less
Nice, I'll give this a shot later.
Ill give it a shot when I get home!
Sent from Motorola Atrix on TELUS.
My phone is working perfectly, so why not ruin it?
I'm giving this a try right now!
1.4.57 - Rooted and gingerblurred with HDMI Mirroring and Webtop hack.
I'll update as progress goes along:
Edit 1:
Initial try gave me this
Checking device state...
Obtaining temporary root access...pushing shell scripts
A filesystem file already exists. Reset it? [n] y
Mounting the filesystem...
07.sh
--------------------------------------------
EXECUTION FAILED
Unable to mount the filesystem file. ERR 07
--------------------------------------------
Press any key to continue . . .
Edit 2:
Ok, it doesnt work with resetting it. How about removing?
Checking device state...
Obtaining temporary root access...pushing shell scripts
A filesystem file already exists. Reset it? [n] n
A filesystem file already exists. Delete it? [n] y
Deleting the filesystem file...
--------------------------------------
EXECUTION FAILED
Unable to delete the filesystem file.
--------------------------------------
Press any key to continue . . .
Edit 3:
Ok, only one option left then.
Checking device state...
Obtaining temporary root access...pushing shell scripts
A filesystem file already exists. Reset it? [n] n
A filesystem file already exists. Delete it? [n] n
--------------------------------------------------------------------------
EXECUTION FAILED
The filesystem file already exists, but no operations have been selected.
--------------------------------------------------------------------------
Press any key to continue . . .
=====================================================================
Edit 4:
Since execution is failing I'm trying to find the problem. Using ADB Shell i tried to manually run the shell scripts and stumbled here:
(I tried chmod 777 @ 02.sh to see if that was the problem, no change is results)
# ls -l
...
...
-rwsr-sr-x shell shell 87 2011-04-06 12:13 03.sh
-rwxrwxrwx shell shell 82 2011-04-06 12:11 02.sh
-rwsr-sr-x shell shell 251 2011-04-06 12:04 01.sh
# pwd
pwd
/data/tmp/shell
# /data/tmp/shell/02.sh
/data/tmp/shell/02.sh
/data/tmp/shell/02.sh: not found
I had the same issue as flybob when I tried to run the script.
Sent from my MB860 using XDA Premium App
Good effort, but 1.57 changes how we have to run commands as root. On a normal linux box, I'm sure your methods would work fine, but we're not dealing with a normal su binary. You should look into doing this as CWM as opposed to .bat files. I had a hell of a time getting around the restrictions since the psneuter exploit was closed.
Ah, I did not think about that Ririal, thanks for the info. I am not familiar with CWM though.
Why is the /tmp directory in /data ? That would certainly cause every script to fail.
I'll look at this some more tonight.
Ririal said:
Good effort, but 1.57 changes how we have to run commands as root. On a normal linux box, I'm sure your methods would work fine, but we're not dealing with a normal su binary. You should look into doing this as CWM as opposed to .bat files. I had a hell of a time getting around the restrictions since the psneuter exploit was closed.
Click to expand...
Click to collapse
How about a shell script that we can run in terminal emulator ? and the output goes to screen and a log file for debug !
molotof said:
How about a shell script that we can run in terminal emulator ? and the output goes to screen and a log file for debug !
Click to expand...
Click to collapse
most of the script is now run by shell scripts, no reason you couldn't run them in the terminal emulator, just get the order right. There are also a few lines I didn't translate to shell so you'd have to enter them by hand.
In any case I'll keep working on this until Sogarth releases his version with union mounts =D
You might be interested to know this;
# cd /tmp
cd /tmp
# pwd
pwd
/data/tmp
# ls -l /tmp
lrwxrwxrwx root root 2011-04-09 14:47 tmp -> /data/tmp
I'll happily help with the script, i know tons of linux and got my Atrix ready to be bricked
flybob said:
You might be interested to know this;
# cd /tmp
cd /tmp
# pwd
pwd
/data/tmp
# ls -l /tmp
lrwxrwxrwx root root 2011-04-09 14:47 tmp -> /data/tmp
I'll happily help with the script, i know tons of linux and got my Atrix ready to be bricked
Click to expand...
Click to collapse
That's just a symlinked directory. I won't make a difference if you call either.
Yes, just replied to the previous question
Why is the /tmp directory in /data ? That would certainly cause every script to fail.
I'll look at this some more tonight.
Click to expand...
Click to collapse
However, why doesn't the scripts run as wanted...?
# cat /tmp/shell/02.sh
cat /tmp/shell/02.sh
#!/bin/sh
/system/bin/su
/bin/rm /data/ubuntu.disk > /dev/null 2>&1 && echo PASS#
# ls -l /tmp/shell/02.sh
ls -l /tmp/shell/02.sh
-rwxrwxrwx shell shell 82 2011-04-06 12:11 02.sh
# /tmp/shell/02.sh
/tmp/shell/02.sh
/tmp/shell/02.sh: not found
flybob said:
Yes, just replied to the previous question
However, why doesn't the scripts run as wanted...?
# cat /tmp/shell/02.sh
cat /tmp/shell/02.sh
#!/bin/sh
/system/bin/su
/bin/rm /data/ubuntu.disk > /dev/null 2>&1 && echo PASS#
# ls -l /tmp/shell/02.sh
ls -l /tmp/shell/02.sh
-rwxrwxrwx shell shell 82 2011-04-06 12:11 02.sh
# /tmp/shell/02.sh
/tmp/shell/02.sh
/tmp/shell/02.sh: not found
Click to expand...
Click to collapse
Ah ok my mistake, you didn't quote anything I didn't realize that's what you were responding too
Likely noexec flag causing that issue.
Also, you can't invoke su from inside a shell script. It just doesn't work with this su binary.
yeah, I guess not. I hadn't realized that it wasn't a real 'su' before making this... too bad.
If anyone figures out how to get around that we'll be in business Unfortunately that's way beyond my expertise.
Okay, after fiddling a little bit and talking to a friend I may have solved some of the problems, mainly with the scripts executing and su working.
I will have to rewrite a bunch of things but should report back tonight.
the2dcour said:
Okay, after fiddling a little bit and talking to a friend I may have solved some of the problems, mainly with the scripts executing and su working.
I will have to rewrite a bunch of things but should report back tonight.
Click to expand...
Click to collapse
su -c "command"
You'll have to allow superuser on the phone for every single command.
PM'd you my error. I tried manually editing the permissions, but that didn't work.
Running on GladAtrix2 v3
USB debugging on; USB set to none
Checking device state...
Obtaining temporary root access...pushing shell scripts
-------------------------
EXECUTION FAILED
Unable to chmod scripts.
-------------------------
Press any key to continue . . .
Changed /sdcard-ext to /sdcard in script. Got this error
Checking device state...
Obtaining temporary root access...pushing shell scripts
-------------------------
EXECUTION FAILED
Unable to chmod scripts.
-------------------------
* server not running *
Press any key to continue . . .
Running BETA_ubuntu-1.0.6.4.zip. File extracts to BETA_ubuntu-1.0.6.2 directory. Ran ubuntu-1.5.7.bat
Moved BETA_ubuntu-1.0.6.2 to C:\ Same error
The only easy workaround to that I can see at the moment is to
Code:
adb shell
su
chmod 777 /path-to-scripts/*
ls -l /path-to-scripts/*
make sure all the files are executable (should say rwxrwxrwx)
then remove the bit of code from 1.5.7.bat
Code:
set retval=
for /f "tokens=*" %%l in ('%~dps0adb.exe shell "/bin/chmod 6755 /mnt/sdcard-ext/shell/* > /dev/null 2>&1 && echo PASS"') do set retval=%%l
if "%retval%" neq "PASS" set message=Unable to chmod scripts. && goto abort
If anyone can help me fix this problem I should be able to automate the chmod process using ririal's suggestion of su -c. The problem is that there are too many nested quotation marks in this section of the batch file, and I can't for the life of me figure out how to escape quotes so they pass through to adb:
Code:
set retval=
for /f "tokens=*" %%l in ('%~dps0adb.exe shell "/system/bin/su -c [U]'/bin/chmod 6755 /mnt/sdcard-ext/shell/*'[/U] > /dev/null 2>&1 && echo PASS"') do set retval=%%l
if "%retval%" neq "PASS" set message=Unable to chmod scripts. && goto abort
The underlined bit is where I need to escape either single or double quotes.
the2dcour said:
The only easy workaround to that I can see at the moment is to
Code:
adb shell
su
chmod 777 /path-to-scripts/*
ls -l /path-to-scripts/*
make sure all the files are executable (should say rwxrwxrwx)
then remove the bit of code from 1.5.7.bat
Code:
set retval=
for /f "tokens=*" %%l in ('%~dps0adb.exe shell "/bin/chmod 6755 /mnt/sdcard-ext/shell/* > /dev/null 2>&1 && echo PASS"') do set retval=%%l
if "%retval%" neq "PASS" set message=Unable to chmod scripts. && goto abort
If anyone can help me fix this problem I should be able to automate the chmod process using ririal's suggestion of su -c. The problem is that there are too many nested quotation marks in this section of the batch file, and I can't for the life of me figure out how to escape quotes so they pass through to adb:
Code:
set retval=
for /f "tokens=*" %%l in ('%~dps0adb.exe shell "/system/bin/su -c [U]'/bin/chmod 6755 /mnt/sdcard-ext/shell/*'[/U] > /dev/null 2>&1 && echo PASS"') do set retval=%%l
if "%retval%" neq "PASS" set message=Unable to chmod scripts. && goto abort
The underlined bit is where I need to escape either single or double quotes.
Click to expand...
Click to collapse
^ escapes batch, \ escapes shell. Hope this helps. If you zip up and send me the whole process in a single .sh file I can wrap it up in CWM for you.
hi
I want to make a file root .bat
But the problem after the order adb.exe shell stops Does not continue automatically
This code is used
[email protected]:~/Downloads/mtk-su $ adb shell
mustang:/ $ cd /data/local/tmp
mustang:/data/local/tmp $ ./mtk-su
New UID/GID: 0/0
mustang:/data/local/tmp # getenforce
Permissive
mustang:/data/local/tmp # echo 0 > /sys/block/mmcblk0boot0/force_ro
mustang:/data/local/tmp # dd if=/dev/zero of=/dev/block/mmcblk0boot0 bs=512 count=8
8+0 records in
8+0 records out
4096 bytes transferred in 0.001 secs (4096000 bytes/sec)
mustang:/data/local/tmp #
Click to expand...
Click to collapse
You want to make a Windows Batch file for your Fire 7?
1. To open Notepad via Run. Open run using the PC keyboard. Press Windows key + R key and type notepad.exe
2. Type the batch script:
Code:
@echo off
adb devices
pause //To pause the running scripts
adb push C:\Desktop\path\to\mtk-su /data/local/tmp
adb shell
cd /data/local/tmp/
chmod -755 mtk-su
./mtk-su
3. Save the file as a .bat file
Unfortunately not work
Hi ..
I have a script for device amonet-mustang
I want when I run a file flash-B.sh
to do everything automatically
When I run my script it doesn't work .. say Permission denied
link file
https://www.mediafire.com/file/iioog...lash-B.sh/file
Quote:
#!/bin/bash
args=("[email protected]")
function goto
{
label=$1
cmd=$(sed -n "/$label:/{:a;n;p;ba};" $0 | grep -v ':$')
eval "$cmd"
exit
}
echo[*] OPEN Done ...
adb wait-for-device
adb devices
adb push arm/mtk-su /data/local/tmp
adb shell chmod 777 /data/local/tmp/mtk-su
echo[*] File Push Done...
adb shell "/data/local/tmp/mtk-su -c echo 0 \> /sys/block/mmcblk0boot0/force_ro"
adb shell "/data/local/tmp/mtk-su -c dd if=/dev/zero of=/dev/block/mmcblk0boot0 bs=512 count=8"
echo[*] block Done...
adb reboot
echo[*] Reboot DONE .
./bootrom-step.sh
echo[*] bootrom-step DONE .
./fastboot-step.sh
echo[*] You are now in Recovery ..plz Format your Amazon ...
sleep
exit
Click to expand...
Click to collapse
say
dd: /dev/block/mmcblk0boot0: Operation not permitted
1+0 records in
0+0 records out
0 bytes transferred in 0.001 secs (0 bytes/sec)
Click to expand...
Click to collapse
PRInCEI7 said:
Hi ..
I have a script for device amonet-mustang
I want when I run a file flash-B.sh
to do everything automatically
When I run my script it doesn't work .. say Permission denied
link file
https://www.mediafire.com/file/iioog...lash-B.sh/file
Quote:
say
Click to expand...
Click to collapse
Link is dead