Related
This howto is for those people who are unable to root their Galaxy Tab using any of the automated procedures and do not suffer from CLPS (command-line-phobia-syndrome).
My story: After upgrading my EURO (GSM) Galaxy Tab to JM6 my persistent efforts to root the device using either the z4root or SuperOnClick methods have all been unsuccessful. z4root (v1.3.0) kept crashing at different stages, apparently depending on which and how many background apps were running. With SuperOneClick I never managed to get beyond the "changing permissions" stage.
Since both methods are basically wrappers of the rageagainstthecage application, I tried to perform the rooting procedure manually. Guess what, that worked without any problem and it is pretty easy to do.
The basic steps of the rooting process are:
1) use rageagainstthecage to get a temporary root shell
2) use the temporary root shell to copy three files to the read-only system partition the device
While I find the outlined procedure straightforward, you may not. Anyhow, try this at your own risk.
==== Prerequisites ====
I used Ubuntu 10.10 for this, but it should work on any other distro and on Windows just as well. Whatever OS you use, you need a working adb connection to your Galaxy Tab. Odin or Kies are of no use here.
You need the following binaries
* su
* busybox
* Superuser.apk
* rageagainstthecage
To get the all required files, simply download "SuperOneClickv1.5.5-ShortFuse.zip". That's what I used.
Get it here: http://forum.xda-developers.com/showthread.php?t=803682
Extract the contents of the ZIP, open a command-prompt on your computer and change to the directory where the extracted files are located.
Some advice if shell commands are not your regular cup of tea.
The following instructions show the shell commands. Some are executed on the host computer. Others are executed on the Galaxy Tab. You can differentiate between the two easily: All commands which start with "> " need to be executed in a shell on the host computer. Commands which are prefixed with "$ " are executed on the Galaxy Tab. In both case the ">" and the "$" must not be typed. If you copy+paste from this howto, make sure only to copy the commands and leave out the prompt.
==== Step 1: getting a temporary root shell ====
Copy the rageagainstthecage exploit to a temporary directory.
Code:
> adb push rageagainstthecage /data/local/tmp
263 KB/s (5392 bytes in 0.020s)
Change the file permissions and execute the exploit.
Code:
> adb shell
$ cd /data/local/tmp
$ chmod 777 rageagainstthecage
$ ./rageagainstthecage
[*] CVE-2010-EASY Android local root exploit (C) 2010 by 743C
(other output truncated)
Your shell session will be terminated which will throw you back to the regular command prompt of your host computer.
==== Step 2: restart adb server ====
Now stop and restart the adb server process.
Code:
> adb kill-server
> adb start-server
* daemon not running. starting it now *
* daemon started successfully *
Now reconnect to the Galaxy Tab again. Notice the '#' prompt. This means you have a temporary root shell now. We use this to execute some privileged commands which make the rooting permanent.
==== Step 3: making it permanent ====
First, make the system partition writeable. We need this to be able to copy su, busybox and Superuser.apk to the required locations. Then exit the android shell again.
Code:
> adb shell
# mount -o remount,rw -t rfs /dev/block/stl9 /system
# exit
Now we push busybox and su via adb. Then we install Superuser.apk.
Code:
> adb push busybox /system/bin
> adb push su /system/bin
> adb install Superuser.apk
The final steps are to change the file permissions for su and busybox and then remount the system partition as read-only again.
Code:
> adb shell
# chmod 4755 /system/bin/busybox
# chmod 4755 /system/bin/su
# mount -o remount,ro -t rfs /dev/block/stl9 /system
# exit
That should be all. Try a reboot and some apps which require root, like Titanium Backup. The Superuser.apk should popup a dialog requesting permission.
Hope this helps. Happy rooting.
[update]
This process worked for JMA and JMD as well.
"adb install" Superuser.apk instead of "adb push"
[/update]
It will help me !
Merci ;-)
Fantastic! This is just what I was looking for, thank you! I feel dumb now, because I started a thread of my own right as you posted this. You must just type faster than me
I ran a quick test, and it all looks good. One quick question actually. Why do you mount like this:
Code:
# mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system
When most instructions for the Galaxy Tab have you doing something like this:
Code:
# mount -o remount,rw -t rfs /dev/block/stl9 /system
I'm not saying it is wrong, in fact, it actually worked for me. I'm just curious as to why it works like that? My understanding of mounting partitions and such in Linux is a little bit weak, so I like to indulge my curiousity by bugging fine people like yourself
Anyway, thanks again, this did exactly what I needed it to. Well done, I appreciate it.
DavidThompson256 said:
One quick question actually. Why do you mount like this:
Code:
# mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system
When most instructions for the Galaxy Tab have you doing something like this:
Code:
# mount -o remount,rw -t rfs /dev/block/stl9 /system
I'm not saying it is wrong, in fact, it actually worked for me. I'm just curious as to why it works like that? My understanding of mounting partitions and such in Linux is a little bit weak, so I like to indulge my curiousity by bugging fine people like yourself
Click to expand...
Click to collapse
Thanks for pointing that out! Actually both the filesystem type and blockdevice name were totally wrong. Apparently the mount command ignores both parameters - at least when they are wrong.
I just verified this as self-punishment for not paying attention:
Code:
# mount
(...)
/dev/block/stl9 /system rfs ro,relatime,vfat,log_off,check=no,gid/uid/rwx,iocharset=utf8 0 0
(...)
/system is mounted read-only to /dev/block/stl9. This is the normal state of things.
Now I remount this without the fstype parameter and using a wrong blockdevice name:
Code:
# mount -o remount,rw /dev/block/xyz /system
# mount
(...)
/dev/block/stl9 /system rfs rw,relatime,vfat,llw,check=no,gid/uid/rwx,iocharset=utf8 0 0
(...)
Surprise, this actually remounts /system in read-write mode. This is why my original howto worked despite using the wrong parameters.
Thanks again. I corrected the HOWTO.
It works for me, but i get now error message: The application calendar save (proces com.android.providers.calendar) is unexpecly stopt. Try again. Forced closing
I had this also with SuperOneClick.
When i want to start the calender in the applications i get it also.
The application wil not run anymore.
How can i resolved this.
Thnx
leonreijnders said:
It works for me, but i get now error message: The application calendar save (proces com.android.providers.calendar) is unexpecly stopt. Try again. Forced closing
I had this also with SuperOneClick.
When i want to start the calender in the applications i get it also.
The application wil not run anymore.
How can i resolved this.
Thnx
Click to expand...
Click to collapse
That is strange. The result of the rooting process is just adding three files to the system partition. I find it hard to believe that this could lead to the problem you describe. However, while experimenting with z4root I had the the effect that there were many rageagainstthecage processes running in the background and the Galaxy Tab slowed down considerably. Perhaps there is something similar going on.
Have you tried rebooting after completing the rooting process?
Try shutting down the Tab completely.After rebooting get a shell on the Tab with "adb shell" and execute "ps". That shows the process list. If that looks normal, I would try a factory reset of the device. Which ROM version are you running?
BlackLevel: Thank you soooooooooo much... I don't get how to hit the Thanks Meter thing, but here is the old fashioned way. I used a MacBook to accomplish your perfect, step by step rooting of an AT&T Galaxy Tab i987. It helps that I'm more comfortable at the command line than with most GUI systems.
I could put this into a bash script, but that could be dangerous. People really need to look at whats happening with 'adb' and have some idea of what adb is for. I did renamed your 'adbmac' to 'adb', then I could cut and paste from your instructions except for adding ./ before the adb... ie. ./adb shell
Again, wonderful work at pulling this all together in one place.
Jeff
This guide worked perfectly! I love a nice quiet clean root and it doesn't get any better than this. You my friend deserve a cookie!
Hi Guys,
I flashed to JMA, rooted it with One Click Root, and everxthing seemdet to be okay, but activating OCLF failed....is there anybody with the same problem?
Jan
Thanks a lot !. It's clean and doesn't need a kies ...
Just a question : after reboot I have to use "su" after "adb shell" to become root.
Is there any way to be root directly after adb shell ?
And thanks again ...
Mike
mbaroukh said:
Just a question : after reboot I have to use "su" after "adb shell" to become root.
Is there any way to be root directly after adb shell ?
Click to expand...
Click to collapse
The reason is that "/sbin/adbd" (the adb daemon) is running as the shell user. It would need to run as root user instead. This requires changes to the initial ram disk where adbd the relevant settings are stored.
Dealing with "insufficient permissions for device"
Thanks, this worked for me.
One small thing: running from a Linux sustem (Ubuntu 9.04), to overcome a "insufficient permissions for device" problem, I had to put my Ubuntu terminal session into su mode and restart the ADB server -- cf. groups.google.com /group/android-discuss/browse_thread/thread/f85a795644e65b59?pli=1 :
[[
adb kill-server
sudo adb start-server
adb devices
]]
gklyne said:
One small thing: running from a Linux sustem (Ubuntu 9.04), to overcome a "insufficient permissions for device" problem, I had to put my Ubuntu terminal session into su mode and restart the ADB server -- cf. groups.google.com /group/android-discuss/browse_thread/thread/f85a795644e65b59?pli=1 :
[[
adb kill-server
sudo adb start-server
adb devices
]]
Click to expand...
Click to collapse
Thanks for the feedback. On my Ubuntu 10.10 adb runs under my regular user-id (1000) and I do not have to use sudo or run the local adb server as root. That might be due to the way the udev rules are set up. Mine are rather unrestrictive and look like this:
Code:
$ cat /etc/udev/rules.d/51-android.rules
SUBSYSTEMS=="usb", SYSFS{idVendor}=="0bb4", MODE="0666"
SUBSYSTEMS=="usb", SYSFS{idVendor}=="04e8", MODE="0666"
How do yours look like?
Which is the more simple method for root of galaxy tab euro ?are there ?
the incredible said:
Which is the more simple method for root of galaxy tab euro ?are there ?
Click to expand...
Click to collapse
Try z4root or SuperOneClick. Both methods are wrappers of the rageagainstthecage exploit and try to automate the manual process outlined here.
This thread should be a sticky. Worked like a charm.
z4root is very simple method..thanks.
thanks to Germany...
I agree, this thread should be sticky. Finaly some sense in android devel section...
Thank you very much for your guide!
I followed all the instructions in your guide, everything seems fine until I try to push the busybox and su to my Galaxy Tab.
blacklevel said:
Now we push busybox and su via adb. Then we install Superuser.apk.
Code:
> adb push busybox /system/bin
> adb push su /system/bin
> adb install Superuser.apk
[/update]
Click to expand...
Click to collapse
I received an error: "failed to copy 'busybox' to '/system/bin/busybox' : No space left on device\"
the same error for the 'su' too
(No space left on device) is impossible, my tab is brand new sealed when i got it.
I have been trying the z4root and SuperOneClick procedure to root this tab but are all unsuccessful.
I am not sure if it is because of my tab needed a "NAND unlock" (I cannot find any guide about the NAND unlock) because I received this message when I tried to install busybox from the market.
Please help! My tab is carrier locked to Bell Canada, I really wanna to unlock it and root it~
Thanks!
gummo6869 said:
I received an error: "failed to copy 'busybox' to '/system/bin/busybox' : No space left on device\"
the same error for the 'su' too,
Click to expand...
Click to collapse
The `no space left on device` message indicates that the /system partition is still read-only. That means the mount command in step 3 was unsuccessful. Did you get any error message when you executed it?
STEAM ROM 2.9.9.0 (it's not 3.0.0.0 because that would mean stable)
Steam ROM is a Steam Kernel based XWJPA/XXJP7/JPM ROM. Although this config is a bit old, I didn't had much time to experiment with the newer ones. This ROM is the common successor of both of my previous two ROMs
Steam ROM is a showcase of almost all features Steam kernel/recovery provides, including the recovery selection menu, or afterburner. It also has /system pre-lagfixed, so you won't need to do that after flashing. (the other filesystems are still rfs, as samsung's CSC install would format them anyway to rfs)
Main highlights
- ROM:XWJPA, CSC:XWJP7 Kernel: JPM (Steam Kernel 2.9.9.0)
- System is pre-converted to ext4
- All other partitions can be converted later
- Root is not installed, but can be installed later from the menu
- No theme is installed, but the battery indicator can be installed later from Afterburner
- Most samsungs apps are removed, but they can be installed later from Afterburner
How to install
The zip file contains everything you need to start, including Odin, a pit file, and all images. This is a complete rom, so you can always flash this with re-partition checked, and get all your previous data erased (sometimes data is kept, run a wipe data to be sure)!
You don't need to stick with the XXJP7 CSSC however, as CSC installs will be done by either 3e, or 2e recovery. After boot, you'll be asked which recovery version you want to use to install your CSC file. The rule of thumb is, that if your CSC file is old (made for Eclair), then you should choose 2e recovery. If it's new (made for Froyo) chose 3e recovery. You can chose to keep with Steam, but that will usually fail, as Steam is not designed to handle CSC updated.
What is Afterburner?
After you allow Steam to install, and the CSC files to setup, you'll be greeted (hopefully) with a list of post-flash options. Most of these options will simply
install back some of the removed applications. Simply check the apps you wish to use, and wait for them to get installed. If you change your mind, you can later re-visit the afterburner menu during recovery mode.
Be careful however, as the space is limited on /system, and afterburner doesn't yet check if there is enough space left on the device!
How to root?
Enter recovery mode, select Steam options, and install superuser
How to lagfix?
Enter recovery mode, select Steam options, and filesystem options
DL link:
- http://android.sztupy.hu/dl/Steam_ROM_eng_2.9.9.0.zip (english)
- http://android.sztupy.hu/dl/Steam_ROM_hun_2.9.9.0.zip (hungarian - use 2e recovery)
This is truly nice work. Make a 2.2.1 version?
Looks like awesome stuff sztupy!
Maybe next, a tool to convert the rfs factoryfs.rfs to ext4, from a PC? Or better yet, a tool to convert Samsung rom images from rfs to ext4 that can be flashed using Odin or something.
DocRambone said:
This is truly nice work. Make a 2.2.1 version?
Click to expand...
Click to collapse
First I have to get the kernel working on stock stuff. Then it'll be possible.
hardcore said:
Looks like awesome stuff sztupy!
Maybe next, a tool to convert the rfs factoryfs.rfs to ext4, from a PC? Or better yet, a tool to convert Samsung rom images from rfs to ext4 that can be flashed using Odin or something.
Click to expand...
Click to collapse
I don't think that can be done on a PC, as there are no rfs drivers. Creating a script that does the job using adb is easy though:
Code:
rem Should be on Steam kernel, with adb root option enabled
adb root
adb shell /sbin/steam mkdir -p /mnt/sdcard/convert
adb shell /sbin/steam mkdir -p /mnt/sdcard/convert/rfs
adb shell /sbin/steam mkdir -p /mnt/sdcard/convert/ext4
adb push factoryfs.rfs /mnt/sdcard/convert/
adb shell /sbin/steam truncate /mnt/sdcard/convert/factoryfs.rfs 291504128
rem The correct amount is got by multiplying the partition size from /proc/partitions by 1024
adb shell /sbin/steam losetup /dev/block/loop0 /mnt/sdcard/convert/factoryfs.rfs
adb shell /sbin/steam touch /mnt/sdcard/convert/factoryfs.ext4
adb shell /sbin/steam truncate /mnt/sdcard/convert/factoryfs.ext4 291504128
adb shell /sbin/steam losetup /dev/block/loop1 /mnt/sdcard/convert/factoryfs.ext4
adb shell /sbin/steam mount -t rfs -o check=no /dev/block/loop0 /mnt/sdcard/convert/rfs
adb shell /sbin/steam mkfs.ext4 -b 1024 -m 0 -J size=4 /dev/block/loop1
adb shell /sbin/steam mount -t ext4 -o noatime /dev/block/loop1 /mnt/sdcard/convert/ext4
adb shell /sbin/steam cp -dpR /mnt/sdcard/convert/rfs/* /mnt/sdcard/convert/ext4
adb shell /sbin/steam umount /dev/block/loop0
adb shell /sbin/steam umount /dev/block/loop1
adb shell /sbin/steam losetup -d /dev/block/loop0
adb shell /sbin/steam losetup -d /dev/block/loop1
adb pull /mnt/sdcard/convert/factoryfs.ext4
adb shell rm -rf /mnt/sdcard/convert
I will try this out, I am sure I will be as awed by this ROM as I was with Sztupy's earlier ones.
Sztupy always delivers.
nice work sztupy and i happy u coming back
Any one tried this yet?
Aylarth said:
Sztupy always delivers.
Click to expand...
Click to collapse
That is right.
Lets hurry up samsung to release 2.2.1 sources so we can get it rolling again?
I'm fed with da mess with JPU/JPX/JPY and JPM kernels
@ Sztupy,
So, this ROM is stock, right? No deodex, no zipalign. Can I flash DDJP6 MODEM on it? & can I flash HKAINU CSC from the recovery?
ragin said:
@ Sztupy,
So, this ROM is stock, right? No deodex, no zipalign. Can I flash DDJP6 MODEM on it? & can I flash HKAINU CSC from the recovery?
Click to expand...
Click to collapse
Yep, it's stock. Only the apps were removed + system was converted to ext4.
Official CSC's will work using 3e recovery.
I don't know about the modem, but I don't know why it wouldn't work oout of the box with another one.
sztupy said:
Yep, it's stock. Only the apps were removed + system was converted to ext4.
Official CSC's will work using 3e recovery.
I don't know about the modem, but I don't know why it wouldn't work oout of the box with another one.
Click to expand...
Click to collapse
Thanks for a quick reply. I have uploaded a CSC file to be installed thru CWM, and a MODEM file specific to my region. Can you tell me if it will work?
Thanks again.
Will this work on the Sprint Epic 4G? I'm asking only because this phone is known to have odd differences/bugs from the other Galaxy S phones.
Now that JPX source is available. Why not a sample?
Sent from my GT-I9000 using XDA App
Any development?
Waiting for 2.2.1 jpy release,it will rock
°Dexter° said:
Waiting for 2.2.1 jpy release,it will rock
Click to expand...
Click to collapse
Like its said above, Sztupy always delivers.
hd2 problem hang
my htc hd2 hang on disply how to solve this problem help me
Having dropped my desire and cracked the screen I would like to perform a factory wipe via ADB before I take it in for repair (I've backed it up).
I have the clockwork recovery which doesn't have the su/format commands and I am unable to find information on the other functions.
Any tips?
Many thanks!
Clockwork recovery offers all wipe and factory reset functions. 2.5.0.7, unless I'm missing something
He has no screen man, so gui is Wortes
Anyway, try this
Code:
adb shell
#wipe data
just a question, can you go from rooted desire with custom rom to stock by just wiping everyting in clockwork recovery?
I thought you needed to run a RUU update to put everything back to stock?
swimon said:
I thought you needed to run a RUU update to put everything back to stock?
Click to expand...
Click to collapse
That's right. But even if wipe all is not back to stock, it's better than leaving a rooted rom if you want to give it for repair i think.
try;
adb shell
wipe all
you need to add ./ to the start of adb if using a mac or linux
./adb shell
wipe all
Thanks for all the help guys!
I tried the *wipe* command, but I didn't have superuser mode set up.
To get into superuser, which was denied repeatedly I read that a popup usually shows on the phone requesting access. I think I managed to click that by tapping the screen on the left where "yes/accept" usually shows.
When I tried with superuser:
Code:
adb shell
su
wipe system
I got an long list of files that it was unable to delete.
At this point, I needed to leave and thought maybe the phone needed charging or something.
Coming back to it now, the phone is not recognised by ADB.
I've done a lot of searching and I think I must have unchecked the "usb debugging" from the notifications menu somehow.
So I have a new problem...
q) Is it possible to enable usb debugging with a cracked screen or otherwise get into the phone?
I connect the phone and just get android disk device/usb disk drive in windows manager.
I can reboot the phone into bootloader (with volume down held) and when I connect the phone I get bootloader interface appearing instead of disk drive but I just don't know where to go from there.
All I want is to clean the phone before I send it in for repair!
If anyone is able to help, I greatly appreciate it, if not thanks for your time.
In recovery you have full adb acces and can do all!
I would say, you try to make a nandroid backup and than flash the ruu
You take out your sd card and send than the device to them.
They wont to a forensic dataanalys, and most of the personal stuff is on the sd ;-)
Ps.: as far as i know you can flash ruus over fastboot(needs s-off)
And when you get your phone back, you root it and restore the last backup!
Pps.: if you haven't done a backup in the closer past you can sync, with htc sync with your pc! So you have atleast your contacts
Edit: when everything fails just keep the sd :-( they should be professional enough to keep your privacy! And i dont think your emails, sms and contacts are that different from all others :-D
Ah thanks, I thought I might be able to do that as I was mulling it over this morning. When I get home I'll give it a try and see if I succeed. I'll let you know how it goes!
Thanks for the tips and the advice on the nandroid backup - I do have a backup already - I did it when I cracked the screen as a pre-emptive, because at first I could see everything and I assumed it was just a crack but overnight the screen blacked out totally.
Ok, it's in recovery mode but doesn't seem to recognise wipe command. I added a directory listing of /sbin
Code:
C:\Program Files\Android\android-sdk\platform-tools>adb devices
List of devices attached
HT0XWPLXXXXX recovery
C:\Program Files\Android\android-sdk\platform-tools>adb shell
~ # wipe data
wipe data
/sbin/sh: wipe: not found
~ # wipe all
wipe all
/sbin/sh: wipe: not found
~ # wipe
wipe
/sbin/sh: wipe: not found
~ # ls
ls
cache etc res sdcard
data init root sys
default.prop init.rc sbin system
dev proc sd-ext tmp
~ # cd sbin
cd sbin
/sbin # ls
ls
[ erase_image mkswap sort
[[ expr mktemp split
adbd false mkyaffs2image stat
amend fdisk modprobe strings
ash fgrep more stty
awk find mount swapoff
basename flash_image mountpoint swapon
bbconfig fold mv sync
bunzip2 free nandroid sysctl
busybox freeramdisk nandroid-md5.sh tac
bzcat fuser nice tail
bzip2 getopt nohup tar
cal grep od tee
cat gunzip patch test
catv gzip pgrep time
chgrp head pidof top
chmod hexdump pkill touch
chown id printenv tr
chroot insmod printf true
cksum install ps tty
clear kill pwd tune2fs
cmp killall rdev umount
cp killall5 readlink uname
cpio killrecovery.sh realpath uniq
cut length reboot unix2dos
date less recovery unlzop
dc ln renice unyaffs
dd losetup reset unzip
depmod ls rm uptime
devmem lsmod rmdir usleep
df lspci rmmod uudecode
diff lsusb run-parts uuencode
dirname lzop sed watch
dmesg lzopcat seq wc
dos2unix md5sum setsid which
du mkdir sh whoami
dump_image mke2fs sha1sum xargs
echo mkfifo sha256sum yes
egrep mkfs.ext2 sha512sum zcat
env mknod sleep
/sbin #
su rm -rf *
Does that work? :/
Yep, that's done the trick. Thanks.
try a straight
adb shell wipe all
all on one line sometimes the shell boots incorrectly
SOLVED: The file had Windows EOL formatting. *nix no likely that.
In the init script there are several instances of if statements like this:
Code:
testvar=1
if [ "$testvar" = "1" ] ; then
echo "Testvar is equal to one"
fi
Yet, when I put if statements exactly like this into a shell script and execute them in an adb shell (or connectbox shell), I get the following error:
line 4: syntax error: unexpected "fi" (expecting "then")
I've also taken if statements directly from init and they throw the same error.
Any busybox gurus here know what's up with this?
toadlife said:
In the init script there are several instances of if statements like this:
Code:
testvar=1
if [ "$testvar" = "1" ] ; then
echo "Testvar is equal to one"
fi
Yet, when I put if statements exactly like this into a shell script and execute them in an adb shell (or connectbox shell), I get the following error:
line 4: syntax error: unexpected "fi" (expecting "then")
I've also taken if statements directly from init and they throw the same error.
Any busybox gurus here know what's up with this?
Click to expand...
Click to collapse
Remove the ; and enter the then
Code:
testvar=1
if [ "$testvar" = "1" ]
then
echo "Testvar is equal to one"
fi
Nope. Still throws the same error.
This is driving me nuts. What I'm doing is editing the /init script. The loops work just fine when executed at bootup in / init, but remounting the filesystem, editing /init and rebooting just the test a change takes forever.
For now I've got my changes to init working, but it would be nice to be able to test before editing /init
I just realized that I forgot to put `#!/bin/sh` at the top of my script. But doing so doesn't seem to help. Instead I get not found error.
Weird!
toadlife said:
Nope. Still throws the same error.
This is driving me nuts. What I'm doing is editing the /init script. The loops work just fine when executed at bootup in / init, but remounting the filesystem, editing /init and rebooting just the test a change takes forever.
For now I've got my changes to init working, but it would be nice to be able to test before editing /init
Click to expand...
Click to collapse
Code:
testvar=1
if [ $testvar = `1` ] (`=~ key)
then
echo "Testvar is equal to one"
fi
[/QUOTE]
It gives the echo, but also 1: not found.
Here is the actual code I put into my init:
(this works)
Code:
#Super cool battery thingy
RUNSCBS=`/bin/grep -o "run.scbs=.*" /proc/cmdline | /bin/sed -e "s/.*run.scbs=//g" -e "s/ .*//g"`
if [ "$RUNSCBS" = "1" ] ; then
dev=$(cat /sys/class/scbs/0/dev | sed -e "s/:/ /g")
mknod /dev/scbs0 c $dev
scbs -d -co /sdcard/scbs.conf
fi
# Debug logs
TAKELOGS=`/bin/grep -o "take.logs=.*" /proc/cmdline | /bin/sed -e "s/.*take.logs=//g" -e "s/ .*//g"`
if [ "$TAKELOGS" = "1" ] ; then
logfiledate=`expr substr \`date -Iseconds|tr -d :|tr -d \+|tr -d \-|tr -d T\` 1 14`
tar -cz -f "$card"/debuglogs_"$logfiledate".tar.gz "$card"/debuglogs_*.txt
cat /proc/kmsg>"$card"/debuglogs_kmsg_"$logfiledate".txt &
logcat -v time >"$card"/debuglogs_logcat_time_"$logfiledate".txt &
logcat -v time -b radio>"$card"/debuglogs_logcat_time_radio_"$logfiledate".txt &
fi
Ooooo I really like the idea of having logging running from init. Does that work well? Do the logs ever 'loop' and you end up missing things, or do they just keep on churnin?
arrrghhh said:
Ooooo I really like the idea of having logging running from init. Does that work well? Do the logs ever 'loop' and you end up missing things, or do they just keep on churnin?
Click to expand...
Click to collapse
AFAIK, they go forever. I started doing it last night by just putting the static command in the /init and the logging was still going when I got up this morning.
This morning wanted to see if I could make logging and scbs triggerable by an option in the command line.
Both are working for me now.
Know if where talking about scripts, i have a question too.
This is my RIL logs script:
Code:
#! /system/bin/sh
i="0"
while [ $i -lt 2 ]
do
date=`date +%Y%m%d%H%M`
if [ -d /sdcard/logs/ril/$date/ ]
then
echo "/sdcard/logs/ril/$date/ exists!"
else
mkdir /sdcard/logs/ril/$date/
echo " Made direction /sdcard/logs/ril/$date!"
fi
logcat -v time > /sdcard/logs/ril/$date/logcat-time.txt &
logcat -v time -b radio > /sdcard/logs/ril/$date/logcat-time.txt &
sleep 18000 && kill -0 $! && kill $!
cd /sdcard/logs/ril/
tar -czf ril$date.tar.gz $date
rm -r $date
cd /
done
The thing, i believe, is that only the logcat -v time -b radio is killed and when it's sleeping it's not doing that in the background.
Sleeping for 18000 seconds (5h), because if it's running for a day the logcat log will be more than 10 mb or so.
lol.
Your date string...
Code:
date +%Y%m%d%H%M
...is a bit simpler than mine...
Code:
expr substr `date -Iseconds|tr -d :|tr -d \+|tr -d \-|tr -d T` 1 14
(I couldn't figure out the `date` syntax)
Christiaan91 said:
Know if where talking about scripts, i have a question too.
This is my RIL logs script:
Code:
#! /system/bin/sh
i="0"
while [ $i -lt 2 ]
do
date=`date +%Y%m%d%H%M`
if [ -d /sdcard/logs/ril/$date/ ]
then
echo "/sdcard/logs/ril/$date/ exists!"
else
mkdir /sdcard/logs/ril/$date/
echo " Made direction /sdcard/logs/ril/$date!"
fi
logcat -v time > /sdcard/logs/ril/$date/logcat-time.txt &
logcat -v time -b radio > /sdcard/logs/ril/$date/logcat-time.txt &
sleep 18000 && kill -0 $! && kill $!
cd /sdcard/logs/ril/
tar -czf ril$date.tar.gz $date
rm -r $date
cd /
done
The thing, i believe, is that only the logcat -v time -b radio is killed and when it's sleeping it's not doing that in the background.
Sleeping for 18000 seconds (5h), because if it's running for a day the logcat log will be more than 10 mb or so.
Click to expand...
Click to collapse
Hmm. I haven't set up gscript myself yet, but you might need to nohup the logcats to get them to stay once gscript shuts down.
arrrghhh said:
Ooooo I really like the idea of having logging running from init. Does that work well? Do the logs ever 'loop' and you end up missing things, or do they just keep on churnin?
Click to expand...
Click to collapse
I have found one issue. It's seems that whenever scbs runs, locat fails to open the log devices. I just disabled scbs and logcat worked. I'm going to try swapping the code around so scbs runs after the logging starts.
It seems scbs blows up logcat, even when it is triggered after logging starts. Ughhh.
Entropy512 said:
Hmm. I haven't set up gscript myself yet, but you might need to nohup the logcats to get them to stay once gscript shuts down.
Click to expand...
Click to collapse
logcat will be going, even when you close the terminal, but when you deleted the files they stop. So that's not a problem, cuz i won't delete.
BTW: is it possible to silently run scripts? Like this one?
./pathtoscript1 & ./pathtoscript2 & ./pathtoscript3
Christiaan91 said:
logcat will be going, even when you close the terminal, but when you deleted the files they stop. So that's not a problem, cuz i won't delete.
BTW: is it possible to silently run scripts? Like this one?
./pathtoscript1 & ./pathtoscript2 & ./pathtoscript3
Click to expand...
Click to collapse
What do you mean "silently run" - do you mean disable any printing to stdout?
./pathtoscript1 &>/dev/null & ; ./pathtoscript2 &>/dev/null &
should do the trick The &>/dev/null routes all output to /dev/null
Man, you guys go way overboard on this stuff. This is my gscript logging script.
Code:
cd /sdcard
mv logg.txt logg.0.txt
mv logr.txt logr.0.txt
nohup logcat -v time > logg.txt &
nohup logcat -v time -b radio > logr.txt &
nohup klogd > klog.txt
highlandsun said:
Man, you guys go way overboard on this stuff. This is my gscript logging script.
Code:
cd /sdcard
mv logg.txt logg.0.txt
mv logr.txt logr.0.txt
nohup logcat -v time > logg.txt &
nohup logcat -v time -b radio > logr.txt &
nohup klogd > klog.txt
Click to expand...
Click to collapse
Yeah, well we don't all have kung-fu coding ablities like you, so we go overboard with what we can overboard with.
Besides, I think it might be beneficial to put something like the code I wrote into the official init, so noobs can more easily provide debug logs.
One thing to keep in mind, busybox = /bin/sh, statically compiled sh is /system/bin/sh. I got tired of not having arrow key support whenever I su'ed (since /bin/su spawns a root /system/bin/sh regardless of what's in /etc/passwd) so I bind mounted /bin/sh (which is a symlink to busybox) over the one in /system in my user.conf. I haven't come across any ill effect, but if you feel that the shell difference may be causing issues, you could try that route, since it's very easy to undo.
-- Starfox
Starfox said:
One thing to keep in mind, busybox = /bin/sh, statically compiled sh is /system/bin/sh. I got tired of not having arrow key support whenever I su'ed (since /bin/su spawns a root /system/bin/sh regardless of what's in /etc/passwd) so I bind mounted /bin/sh (which is a symlink to busybox) over the one in /system in my user.conf. I haven't come across any ill effect, but if you feel that the shell difference may be causing issues, you could try that route, since it's very easy to undo.
-- Starfox
Click to expand...
Click to collapse
Thanks for the tip. I'll give that a shot.
LOL. I'm an idiot
Figured out what the problem was. The file had Windows EOL formatting.
That's what I get for using Windows to edit shell scripts.
Hi,
I am running the recently released stock ROM version 4.1.2 downloaded via Kies.
I am trying to debug a Bluetooth problem. However, I cannot see Bluetooth messages when I run the following script using command 'sh btlog' on my android from a terminal:
#!/system/bin/sh
su
print START
# logcat -c
# logcat -v time |grep ".*[bB]luetooth.*"
logcat -v time | grep Bluetooth
print END
It will only output:
START
And, if I run 'logcat | grep Bluetooth' from a terminal session on the android I do not get any output.
But if I run 'sh btlog' from an adb shell I do see the Bluetooth messages, and if I run 'logcat | grep Bluetooth' from an adb shell I also get the expected output.
Can anyone help?
Thanks
Brushborder said:
Hi,
First,I hope this is posted in the right place. I have not been here in ages!
I am running the stock ROM and ICS 4.1.2
I am trying to figure out a problem with my S2 and how it randomly disconnects from some Bluetooth devices. However, I cannot see Bluetooth messages when I run my script using command 'sh btlog' on my android from a terminal:
#!/system/bin/sh
print START
# logcat -c
# logcat -v time |grep ".*[bB]luetooth.*"
logcat -v time | grep Bluetooth
print END
It will only output:
START
And, if I run 'logcat | grep Bluetooth' from a terminal session on the android I do not get any output.
But if I run 'sh btlog' from an adb shell I do see the Bluetooth messages, and if I run 'logcat | grep Bluetooth' from an adb shell I also get the expected output.
Can anyone help?
Thanks
Click to expand...
Click to collapse
get on stock 4.1.2, it was released for our device a while back it might solve your issue
imo ics is dead now
JesusWazBlack said:
get on stock 4.1.2, it was released for our device a while back it might solve your issue
imo ics is dead now
Click to expand...
Click to collapse
Maybe I misspoke. I'm on the stock 4.1.2. Downloaded via kies last week or so, but it is still causing problem. Better, but still disconnects and does not allow reset which is why I am trying to look at log. Thx
Brushborder said:
Hi,
I am running the recently released stock ROM version 4.1.2 downloaded via Kies.
I am trying to debug a Bluetooth problem. However, I cannot see Bluetooth messages when I run the following script using command 'sh btlog' on my android from a terminal:
#!/system/bin/sh
su
print START
# logcat -c
# logcat -v time |grep ".*[bB]luetooth.*"
logcat -v time | grep Bluetooth
print END
It will only output:
START
And, if I run 'logcat | grep Bluetooth' from a terminal session on the android I do not get any output.
But if I run 'sh btlog' from an adb shell I do see the Bluetooth messages, and if I run 'logcat | grep Bluetooth' from an adb shell I also get the expected output.
Can anyone help?
Thanks
Click to expand...
Click to collapse
Well, I fixed the code problem. Basically, I am executing this script as a task when bluetooth starts. I have to make sure the task manager is executing this as super user. Not in the script itself, but calling from super. Now my logger works, now to debug the exceptions.