Backtrack 5 Note 2 - Galaxy Note II Q&A, Help & Troubleshooting

Right guys,
I am a bit of a nub and i need some help.
Need bt5 on my note 2 as part of a course.
Had it working fine then exited when done. Wouldnt re-open.
Deleted the BT5 folder i created and started from scratch but all i get is
#sh boot bt
bootbt[30]:syntax error: 'if' unmatched
this is my boot file
perm=$(id|cut -b 5)
if [ "$perm" != "0" ];then echo "This script requires root! Type: su"; exit; fi
mount -o remount,rw /dev/block/mmcblk0p5/system
export kit=/sdcard/BT5
export bin=/system/bin
export mnt=/data/local/mnt
export sdcard=/mnt/sdcard
export extsd=/mnt/extSdCard
export USER=root
if [ ! -d "$mnt" ]; then
mkdir $mnt
fi
export PATH=$bin:/sbin:/usr/bin:/usr/local/bin:/usr/sbin:/bin:/usr/local/sbin:/usr/games:$PATH
export TERM=linux
export HOME=/root
if [ -b /dev/block/loop255 ]; then
echo "Loop device exists"
else
busybox mknod /dev/block/loop255 b 7 255
fi
#mount -o loop,noatime -t ext2 $kit/BT5.img $mnt
losetup /dev/block/loop255 $kit/bt5.img
mount -t ext2 /dev/block/loop255 $mnt
mount -t devpts devpts $mnt/dev/pts
mount -t proc proc $mnt/proc
mount -t sysfs sysfs $mnt/sys
mount -o bind /mnt/sdcard $sdcard
mount -o bind /mnt/extSdCard $extsd
if [ ! -d "/data/local/mnt/sdcard" ]; then
mkdir /data/local/mnt/sdcard
fi
busybox mount -o bind /sdcard /data/local/mnt/sdcard
busybox sysctl -w net.ipv4.ip_forward=1
echo "nameserver 8.8.8.8" > $mnt/etc/resolv.conf
echo "nameserver 8.8.4.4" >> $mnt/etc/resolv.conf
echo "127.0.0.1 localhost bt5" > $mnt/etc/hosts
echo "Back Track is configured with SSH and VNC servers that can be accessed from the IP:"
ifconfig wlan0
echo " "
busybox chroot $mnt /bin/bash
echo "Shutting down BackTrack ARM"
umount $sdcard
umount $extsd
umount $mnt/dev/pts
umount $mnt/proc
umount $mnt/sys
umount $mnt
losetup -d /dev/block/loop255

Related

A2SD APPS2SD 40a2sd init startup script editing

i am trying to change the init script for APP2SD by [email protected] (cyanogen). it is the standard script for all custom roms.
i want move dalvik cache back to phone memory and app, app-private and data to system/sd. data/data/ is normally moved back to phone memory by the script if someone moves it to system/sd/ due to "compatibility" reasons.
i have edited the script and removed this part.
the problem is that after installing some apps, etc. phone memory is at 13mb and one cant install any additional apps.
also, how do i replace the previous 40a2sd script? i ran into a wall when trying...
THX
------------------------------------------------------------------------------------------------------------------------------------------------
#!/system/bin/sh
#
# Apps2SD using symlinks and bind mounts
# [email protected] (cyanogen)
# Adapted for Modaco Custom Rom by Teknologist
#Removed this as there is no /etc/sysctl.conf as of now in MCR
#sysctl -p
# execute any postinstall script then kill it
if [ -e /dev/block/mmcblk0p2 ];
then
# mount and set perms
busybox mount -o noatime,nodiratime -t auto /dev/block/mmcblk0p2 /system/sd;
busybox chown 1000:1000 /system/sd;
busybox chmod 771 /system/sd;
# clean up any old symlinks, create data directories
for i in data;
do
if [ -h /data/$i ];
then
rm /data/$i;
fi;
if [ ! -d /data/$i ];
then
mkdir /data/$i;
busybox chown 1000:1000 /data/$i;
busybox chmod 771 /data/$i;
fi;
done;
# move apps from internal memory to sdcard
for i in app app-private dalvik-cache;
do
if [ ! -d /system/sd/$i ];
then
mkdir /system/sd/$i;
fi
busybox chown 1000:1000 /system/sd/$i;
busybox chmod 771 /system/sd/$i
if [ -d /data/$i ] && [ ! -h /data/$i ];
then
busybox cp -a /data/$i/* /system/sd/$i/;
busybox rm -f /data/$i/*;
fi;
done;
# symlink app dirs - they must be on the same filesystem
for i in app app-private dalvik-cache;
do
if [ -d /data/$i ] && [ ! -h /data/$i ];
then
busybox rm -rf /data/$i;
busybox ln -s /system/sd/$i /data/$i;
fi;
done;
# clean up old whiteouts
for i in local misc property system tombstones data;
do
if [ -h /system/sd/$i ]; then rm -f /system/sd/$i; fi
done;
# please don't put odex files in the app directory people!
# it causes dexopt to crash when switching builds!
busybox rm -f /system/sd/app/*.odex
setprop cm.a2sd.active 1;
echo "+++ Apps-to-SD successfully enabled";
else
# replace symlinks with directories so we can boot without sd
for i in app app-private dalvik-cache;
do
if [ -h /data/$i ];
then
rm -f /data/$i;
mkdir /data/$i;
busybox chown 1000:1000 /data/$i;
busybox chmod 771 /data/$i;
fi;
done;
setprop cm.a2sd.active 0;
fi;
sync;

[TIP][TRICK][SCRIPT] ISD for Link2SD #2P, ESD as ISD, 300MB ESD, VM#, NTP.

Thank you, for taking the time to put this together for the E4GT community. Nice work
Great. I always wanted to know how to do it.
I decided to write a script to do this automatically.
[size=+1]As before, I provide this with no warranties or guarantees. Use at your own risk. Make a NAND backup of at least System and Data before attempting.[/size]
The script assumes you have busybox and root access.
The script does not check for supported hardware. It has only been tested on the SPH-D710.
The script will check for /mnt/sdcard/external_sd, /mnt/emmc, and /mnt/sd-ext and that at least one is mounted. It bails otherwise. If your external SD card is mounted elsewhere, you can add it to line 9 of the script file (`mountpoint <real path to external SD (no symlinks)>`).
This script must be executed from a live boot (ie, not from recovery) using either Root Explorer, Scripter, a terminal emulator, ADB, or anything else that will run scripts as root.
The file must be on an EXT# partition (just put it in /data and you'll be fine) with 777 permissions unless you're using Scripter.
The script backs up your vold.fstab file to /data/vold.fstab.bak. If the backup file exists, the script will restore it, delete the Link2SD file, and delete the backup file.
Executing the script from Recovery is not advisable.
Executing the script after it has already been executed and the backup file no longer exists is also not advisable.
Your phone will reboot immediately after the script has executed.
Method 1 (terminal emulator or ADB shell):
Put the file from the zip into the /data directory.
Use the following commands from the shell:
Code:
su
chmod 777 /data/eg.link2sd.sh
sh /data/eg.link2sd.sh
Method 2 (Root Explorer | Root Browser):
Put the file from the zip into the /data directory.
Long tap the file, click "Permissions", check every box (the bottom row (there are only two boxes in that row) can be unchecked), and tap Ok.
Tap the file and tap "Execute".
Method 3 (Scripter):
Put the file from the zip wherever, but remember where.
Open Scripter, tap the "+", tap "Import", find the file, and tap it.
Tap the file in the list, tap "Run script", make sure "Execute script as root" is checked, and tap "Execute".
The full script:
Code:
#!/system/bin/sh
LOG=/data/testlog.log
VTEMP=/data/eg.vold.fstab
LTEMP=/data/eg.11link2sd
TEMPFILE=/data/eg.temp
BVOLD=/data/vold.fstab.bak
EXTMOUNTED=""
for N in `mountpoint /mnt/emmc` `mountpoint /mnt/sdcard/external_sd` `mountpoint /mnt/sd-ext`
do
if [ $N ]; then
echo "Found external card. ($N)";
EXTMOUNTED="Yes";
break;
fi
done
if [ ! $EXTMOUNTED ]; then
echo "Can't find external SD card. Make sure it's inserted and mounted and try again.";
exit;
fi
mount -o remount,rw /system
# System files
MOUNTPOINTS=/proc/mounts
VOLD=/system/etc/vold.fstab
LINK2SD=/system/etc/init.d/11link2sd
EXTPATH="";
EXTDEV="";
INTPATH="";
INTDEV="";
LINK2SDPATH="";
LINK2SDDEV="";
x=0;
while [ $x -lt $(cat $MOUNTPOINTS | wc -l) ]
do
let x=x+1;
LINE=`head -n $x $MOUNTPOINTS | tail -n 1`;
DEVICE=`echo "$LINE" | cut -d' ' -f1`;
POINT=`echo "$LINE" | cut -d' ' -f2`;
if [ $POINT = "/mnt/sdcard/external_sd" ] || [ $POINT = "/mnt/emmc" ] || [ $POINT = "/mnt/sd-ext" ]; then # It's the external SD
EXTPATH=$POINT;
EXTDEV=$DEVICE;
elif [ $POINT = "/mnt/sdcard" ]; then
INTPATH=$POINT;
INTDEV=$DEVICE;
elif [ $POINT = "/data/sdext2" ]; then
LINK2SDPATH=$POINT;
LINK2SDDEV=$DEVICE;
fi
done
if [ -f $BVOLD ]; then
echo "Restoring backup. ($BVOLD > $VOLD, '' > $LINK2SD)";
cp $BVOLD $VOLD;
rm $LINK2SD;
rm $BVOLD;
exit;
else
echo "Making backup. ($VOLD > $BVOLD)";
cp $VOLD $BVOLD;
fi
if [ $EXTPATH ] && [ $EXTDEV ]; then
echo "External SD ==";
echo "$EXTPATH: $EXTDEV";
fi
if [ $INTPATH ] && [ $INTDEV ]; then
echo "Internal SD ==";
echo "$INTPATH: $INTDEV";
fi
if [ $LINK2SDPATH ] && [ $LINK2SDDEV ]; then
echo "Link2SD ==";
echo "$LINK2SDPATH: $LINK2SDDEV";
fi
echo "" > $VTEMP;
echo "" > $LTEMP;
echo "" > $TEMPFILE;
echo "#!/system/bin/sh" > $LTEMP;
echo "#added by link2sd" >> $LTEMP;
echo "LOG=/data/link2sd-11link2sd.log" >> $LTEMP;
echo "echo \"\$(date) mounting...\" > \$LOG" >> $LTEMP;
echo "" >> $LTEMP;
VEXT="";
VINT="";
x=0;
while [ $x -lt $(cat $VOLD | wc -l) ]
do
let x=x+1;
LINE=`head -n $x $VOLD | tail -n 1`;
ACTION=`echo "$LINE" | cut -d' ' -f1`;
DEVID=`echo "$LINE" | cut -d' ' -f2`;
POINT=`echo "$LINE" | cut -d' ' -f3`;
PART=`echo "$LINE" | cut -d' ' -f4`;
DEVICE=`echo "$LINE" | cut -d' ' -f5`;
if [ "$POINT" = "$EXTPATH" ]; then # It's the external SD
echo "#$LINE" >> $TEMPFILE;
echo "INT 1" >> $TEMPFILE;
VEXT="$ACTION $DEVID $INTPATH $PART $DEVICE";
elif [ "$POINT" = "$INTPATH" ]; then
echo "#$LINE" >> $TEMPFILE;
echo "EXT 1" >> $TEMPFILE;
VINT="$ACTION $DEVID $EXTPATH 12 $DEVICE";
echo "mount -t vfat -o rw /dev/block/mmcblk0p$PART /data/sdext2 1>>\$LOG 2>>\$LOG" >> $LTEMP;
else
echo "$LINE" >> $TEMPFILE;
fi
done
x=0;
while [ $x -lt $(cat $TEMPFILE | wc -l) ]
do
let x=x+1;
LINE=`head -n $x $TEMPFILE | tail -n 1`;
ACTION=`echo "$LINE" | cut -d' ' -f1`;
if [ "$ACTION" = "EXT" ] && [ "$VEXT" ]; then
echo "$VEXT" >> $VTEMP;
elif [ "$ACTION" = "INT" ] && [ "$VINT" ]; then
echo "$VINT" >> $VTEMP;
else
echo "$LINE" >> $VTEMP;
fi
done
echo "" >> $LTEMP;
echo "mount >> $LOG" >> $LTEMP;
echo "\"\$(date) mount finished\" >> \$LOG" >> $LTEMP;
cp $LTEMP $LINK2SD;
cp $VTEMP $VOLD;
rm $LTEMP;
rm $VTEMP;
rm $TEMPFILE;
chmod 777 $LINK2SD;
mount -o remount,ro /system
reboot;
I can't seem to get this to work without errors and system app crashes on Stock rooted JB 4.1.2.
Nice write up. Thanks for the time spent to put this together
E4GT Rom-a-holic!!!
egingell said:
I can't seem to get this to work without errors and system app crashes on Stock rooted JB 4.1.2.
Click to expand...
Click to collapse
Someone smarter than me can validate or disprove my answer here, but I believe JB has different file system mount points than ICS. (he said he did this on BK)
CyberpodS2 said:
Someone smarter than me can validate or disprove my answer here, but I believe JB has different file system mount points than ICS. (he said he did this on BK)
Click to expand...
Click to collapse
You are correct. JB has a different pre load set up. I think you are rite...this was created on the ICS Kuban.
E4GT Rom-a-holic!!!
CyberpodS2 said:
Someone smarter than me can validate or disprove my answer here, but I believe JB has different file system mount points than ICS. (he said he did this on BK)
Click to expand...
Click to collapse
robrooter said:
You are correct. JB has a different pre load set up. I think you are rite...this was created on the ICS Kuban.
E4GT Rom-a-holic!!!
Click to expand...
Click to collapse
That's just it, it works fine, but System, Settings, and some other system apps crash consistently while the internal sdcard is mounted to Link2SD's directory and the external sdcard mounted in its place. I even made sure to edit my scripts to change where the external and internal would be remounted to (it's /storage/sdcard0 and /storage/extSdCard respectively).
P.S.: It's 4.2 that changes how mounts are seen by or accessible to apps.
Edit: To clarify, the directories get successfully changed around as intended.
Edit 2: Oh, and the phone reboots itself after a few minutes. I had to fix it via Recovery with ADB because the phone wouldn't stay up long enough to do it the normal* way. * Transferring files to the SD card via USB and moving them to their proper destinations via Root Explorer.
I figured out why I was having a problem. I was mounting /dev/block/mmcblk0p12 to /storage/extSdCard. The problem is that Android 4.1.2 stock uses /dev/block/mmcblk0p12 as "overflow" for system apps.
I am currently unwilling to test this on my phone at this time. My setup would require /dev/block/mmcblk0p11 to be an EXT4 file system which, judging by what I see in init.rc, is going to get reformatted as exFAT on boot. Besides, Link2SD has since been fixed to find the second partition on the external SD card for the SGS2.
I have successfully mounted my internal SD card to /data/sdext2, mounted my external SD card to /storage/sdcard0, and bound /storage/sdcard0 to /storage/extSdCard (for backward compatibility) using the following scripts.
[size=+1]I provide this information with no warranties or guarantees and I only tested it on the Sprint Epic 4G Touch with stock rooted Jelly Bean 4.1.2. Use it at your own risk.[/size]
Requires:
root
busybox
basic knowledge of shell scripts and Linux (not necessarily required, but it doesn't hurt)
Notes:
Make sure /system/etc/init.d/12binds, /system/bin/debuggerd, and /system/bin/debuggerd.bin are executable. Just to be safe, you can execute this from a terminal emulator (the asterisk will make it get multiple files at the same time).
Code:
mount -o remount,rw /system
chmod 755 /system/bin/debuggerd*
chmod 755 /system/etc/init.d/12binds
mount -o remount,ro /system
The reason I converted my SD card to EXT4 is so I can move&bind internal app data (the stuff in /data/data/app.package.name) to /data/sdext2/data/app.package.name and preserve file permissions. exFAT does not support this.
Terminal emulator - Executing this command will wipe the SD card and convert it to EXT4. This is optional:
Code:
mkfs.ext2 /dev/block/mmcblk0p11
/system/etc/vold.fstab
Code:
[color=green]## Vold 2.0 Generic fstab
## - San Mehat ([email protected])
##
#######################
## Regular device mount
##
## Format: dev_mount <label> <mount_point> <part> <sysfs_path1...>
## label - Label for the volume
## mount_point - Where the volume will be mounted
## part - Partition # (1 based), or 'auto' for first usable partition.
## <sysfs_path> - List of sysfs paths to source devices
## storage_struct - ex) series, "/mnt/sdcard/extStorages" / parallel
######################
# internal sdcard[/color]
{
ums_sys_path = /sys/class/android_usb/f_mass_storage/lun0/file
secure_format = enable
discard = enable
}
[color=green]#dev_mount sdcard /storage/sdcard0 11 /devices/platform/dw_mmc/mmc_host/mmc0/mmc0 encryptable_nonremovable[/color]
dev_mount sdcard /storage/sdcard0 1 /devices/virtual/block/cyasblkdevblk0
[color=green]# external sdcard[/color]
{
ums_sys_path = /sys/class/android_usb/f_mass_storage/lun1/file
android_secure_containers = enable
}
[color=green]# This partition is 300MB (the smallest I could make it using MiniTool Partition
# Widard) and is [b]not[/b] set to active. It does not mount, which is how I want it. I know
# I'm wasting 300MB of disk space, but that's ok by me.
# This line is here to prevent "damaged SD card" errors.[/color]
dev_mount sdcard1 /storage/extSdCard 2 /devices/virtual/block/cyasblkdevblk0
/system/bin/debuggerd - Make sure you rename the original to /system/bin/debuggerd.bin if you haven't already done so.
Code:
[color=green]#!/system/bin/sh[/color]
LOG=/data/link2sd-debuggerd.log
echo "$(date) mounting..." > $LOG
[color=green]# Delete or comment out this line if you want to make your external SD card into
# an internal and external SD card (both partitions set to active).
# I have not tried setting both partitions on my external SD card to active, so
# I don't know if they will both mount.
# This line binds the internal SD card's directory to the external SD card's
# directory. In other words both internal and external SD cards will be
# the same physical media. You will have duplicates in Music and Gallery.
# If you are not concerned with backward compatibility, you
# can delete or comment out this line.[/color]
mount -o bind /storage/sdcard0 /storage/extSdCard 1>>$LOG 2>>$LOG
[color=green]# Change "ext4" to "vfat" if you did not convert your internal SD card to EXT4.[/color]
mount -t ext4 -o rw,noatime,barrier=0,nobh,errors=continue /dev/block/mmcblk0p11 /data/sdext2 1>>$LOG 2>>$LOG
echo "" >> $LOG
echo "init.d" >> $LOG
[color=green]# Leave this line in if you want init.d support.[/color]
busybox run-parts /system/etc/init.d 1>>$LOG 2>>$LOG
echo "" >> $LOG
mount >> $LOG
echo "$(date) mount finished" >> $LOG
echo debuggerd.bin launched >> $LOG
exec /system/bin/debuggerd.bin
/system/etc/init.d/12binds - This is optional and requires more work than you might think and requires your internal card be EXT4, exFAT will not work. It also requires the "run-parts" line in /system/bin/debuggerd.
Code:
[color=green]#!/system/bin/sh[/color]
LOG=/data/symlink.log;
echo "Symlink" > $LOG
busybox mount -o rw,remount /system
busybox mount -o rw,remount /
cd /data/sdext2/data/
for APP in *; do
cd /data/sdext2/data/$APP;
for DIR in *; do
if [ $DIR != "lib" ]; then # don't bind the lib folder, Link2SD does stuff with it.
echo "" 1>>$LOG 2>>$LOG;
echo "Binding /data/sdext2/data/$APP/$DIR => /data/data/$APP/$DIR" 1>>$LOG 2>>$LOG;
mount -o bind "/data/sdext2/data/$APP/$DIR" "/data/data/$APP/$DIR" 1>>$LOG 2>>$LOG;
fi
done
done
busybox mount -o ro,remount /system
busybox mount -o ro,remount /
Make sure it is executable (chmod 755 /system/etc/init.d/12binds)
To make the above work:
If this is too much for you, don't do it.
Copy /data/data/app.package.name to /data/sdext2/data or if the folder already exists in /data/sdext2/data, copy the contents of /data/data/app.package.name to /data/sdext2/data/app.package.name. Use Root Explorer or any other root file explorer that will preserve the owner of the files and their permissions. Do not use the "move" option or you will be making new folders and trying to figure out what the owner and group should be!
Open each folder except lib in /data/data/app.package.name and delete everything in them.
Execute /system/etc/init.d/12binds or reboot.
I bought an SGS4 and promptly broke the SD card I got for it, so I took the one from my S2 and put it in the S4. I then changed the vold.fstab file back to stock. Unfortunately since the internal SD card is EXT formatted, it won't mount as an SD card. This means that any app that relies on the SD card may not work. Apps that use the path work if I mount the SD card via shell script, but there's a caveat: the files that get put there (e.g. $sdcard/Android/data/<app name>/cache/<stuff>) have their owner/group set to that of the app and no other app can use it without changing the files' owner, group, and permissions first. Camera and Gallery apps won't work at all regardless of whether or not I mount the SD card, at least not the ones I've tried (stock camera and gallery, Camera ICS, Gallery ICS, and Social Gallery). Otherwise the phone works fine without error.
Edit: If I mount a temporary file system (mount -t tmpfs /dev/null /storage/sdcard0), I can get the Camera to work, but the Gallery still complains and any pictures get deleted after reboot. This gave me an idea, though: mount the tmpfs and then bind /data/sdext2 to /storage/sdcard0. This worked, for the most part. Gallery apps still don't like it, but the Camera works. I still have to change the owner, group, and permissions to be able to do anything with pics.
For the record, this seems to work the best:
Code:
chown media_rw:media_rw /data/sdext2
chown media_rw:media_rw /data/sdext2/DCIM
chown media_rw:media_rw /data/sdext2/DCIM/*
chown media_rw:media_rw /data/sdext2/DCIM/Camera/*
chmod -r 775 /data/sdext2
/system/bin/debuggerd
Code:
#!/system/bin/sh
LOG=/data/debuggerd.log
echo "$(date) mounting..." > $LOG
mount -t ext4 -o rw,noatime,barrier=0,nobh,errors=continue /dev/block/mmcblk0p11 /data/sdext2 1>>$LOG 2>>$LOG
mount -t tmpfs /dev/null /storage/sdcard0 1>>$LOG 2>>$LOG
mount -o bind /data/sdext2 /storage/sdcard0 1>>$LOG 2>>$LOG
echo "" >> $LOG
echo "init.d" >> $LOG
/system/xbin/busybox run-parts /data/local/init.d 1>>$LOG 2>>$LOG
echo "" >> $LOG
mount >> $LOG
echo "$(date) mount finished" >> $LOG
echo debuggerd.bin launched >> $LOG
exec /system/bin/debuggerd.bin
I could change it back to exFAT, but I don't wanna.
egingell said:
I decided to write a script to do this automatically.
[size=+1]As before, I provide this with no warranties or guarantees. Use at your own risk. Make a NAND backup of at least System and Data before attempting.[/size]
The script assumes you have busybox and root access.
The script does not check for supported hardware. It has only been tested on the SPH-D710.
The script will check for /mnt/sdcard/external_sd, /mnt/emmc, and /mnt/sd-ext and that at least one is mounted. It bails otherwise. If your external SD card is mounted elsewhere, you can add it to line 9 of the script file (`mountpoint <real path to external SD (no symlinks)>`).
This script must be executed from a live boot (ie, not from recovery) using either Root Explorer, Scripter, a terminal emulator, ADB, or anything else that will run scripts as root.
The file must be on an EXT# partition (just put it in /data and you'll be fine) with 777 permissions unless you're using Scripter.
The script backs up your vold.fstab file to /data/vold.fstab.bak. If the backup file exists, the script will restore it, delete the Link2SD file, and delete the backup file.
Executing the script from Recovery is not advisable.
Executing the script after it has already been executed and the backup file no longer exists is also not advisable.
Your phone will reboot immediately after the script has executed.
Method 1 (terminal emulator or ADB shell):
Put the file from the zip into the /data directory.
Use the following commands from the shell:
Code:
su
chmod 777 /data/eg.link2sd.sh
sh /data/eg.link2sd.sh
Method 2 (Root Explorer | Root Browser):
Put the file from the zip into the /data directory.
Long tap the file, click "Permissions", check every box (the bottom row (there are only two boxes in that row) can be unchecked), and tap Ok.
Tap the file and tap "Execute".
Method 3 (Scripter):
Put the file from the zip wherever, but remember where.
Open Scripter, tap the "+", tap "Import", find the file, and tap it.
Tap the file in the list, tap "Run script", make sure "Execute script as root" is checked, and tap "Execute".
The full script:
Code:
#!/system/bin/sh
LOG=/data/testlog.log
VTEMP=/data/eg.vold.fstab
LTEMP=/data/eg.11link2sd
TEMPFILE=/data/eg.temp
BVOLD=/data/vold.fstab.bak
EXTMOUNTED=""
for N in `mountpoint /mnt/emmc` `mountpoint /mnt/sdcard/external_sd` `mountpoint /mnt/sd-ext`
do
if [ $N ]; then
echo "Found external card. ($N)";
EXTMOUNTED="Yes";
break;
fi
done
if [ ! $EXTMOUNTED ]; then
echo "Can't find external SD card. Make sure it's inserted and mounted and try again.";
exit;
fi
mount -o remount,rw /system
# System files
MOUNTPOINTS=/proc/mounts
VOLD=/system/etc/vold.fstab
LINK2SD=/system/etc/init.d/11link2sd
EXTPATH="";
EXTDEV="";
INTPATH="";
INTDEV="";
LINK2SDPATH="";
LINK2SDDEV="";
x=0;
while [ $x -lt $(cat $MOUNTPOINTS | wc -l) ]
do
let x=x+1;
LINE=`head -n $x $MOUNTPOINTS | tail -n 1`;
DEVICE=`echo "$LINE" | cut -d' ' -f1`;
POINT=`echo "$LINE" | cut -d' ' -f2`;
if [ $POINT = "/mnt/sdcard/external_sd" ] || [ $POINT = "/mnt/emmc" ] || [ $POINT = "/mnt/sd-ext" ]; then # It's the external SD
EXTPATH=$POINT;
EXTDEV=$DEVICE;
elif [ $POINT = "/mnt/sdcard" ]; then
INTPATH=$POINT;
INTDEV=$DEVICE;
elif [ $POINT = "/data/sdext2" ]; then
LINK2SDPATH=$POINT;
LINK2SDDEV=$DEVICE;
fi
done
if [ -f $BVOLD ]; then
echo "Restoring backup. ($BVOLD > $VOLD, '' > $LINK2SD)";
cp $BVOLD $VOLD;
rm $LINK2SD;
rm $BVOLD;
exit;
else
echo "Making backup. ($VOLD > $BVOLD)";
cp $VOLD $BVOLD;
fi
if [ $EXTPATH ] && [ $EXTDEV ]; then
echo "External SD ==";
echo "$EXTPATH: $EXTDEV";
fi
if [ $INTPATH ] && [ $INTDEV ]; then
echo "Internal SD ==";
echo "$INTPATH: $INTDEV";
fi
if [ $LINK2SDPATH ] && [ $LINK2SDDEV ]; then
echo "Link2SD ==";
echo "$LINK2SDPATH: $LINK2SDDEV";
fi
echo "" > $VTEMP;
echo "" > $LTEMP;
echo "" > $TEMPFILE;
echo "#!/system/bin/sh" > $LTEMP;
echo "#added by link2sd" >> $LTEMP;
echo "LOG=/data/link2sd-11link2sd.log" >> $LTEMP;
echo "echo \"\$(date) mounting...\" > \$LOG" >> $LTEMP;
echo "" >> $LTEMP;
VEXT="";
VINT="";
x=0;
while [ $x -lt $(cat $VOLD | wc -l) ]
do
let x=x+1;
LINE=`head -n $x $VOLD | tail -n 1`;
ACTION=`echo "$LINE" | cut -d' ' -f1`;
DEVID=`echo "$LINE" | cut -d' ' -f2`;
POINT=`echo "$LINE" | cut -d' ' -f3`;
PART=`echo "$LINE" | cut -d' ' -f4`;
DEVICE=`echo "$LINE" | cut -d' ' -f5`;
if [ "$POINT" = "$EXTPATH" ]; then # It's the external SD
echo "#$LINE" >> $TEMPFILE;
echo "INT 1" >> $TEMPFILE;
VEXT="$ACTION $DEVID $INTPATH $PART $DEVICE";
elif [ "$POINT" = "$INTPATH" ]; then
echo "#$LINE" >> $TEMPFILE;
echo "EXT 1" >> $TEMPFILE;
VINT="$ACTION $DEVID $EXTPATH 12 $DEVICE";
echo "mount -t vfat -o rw /dev/block/mmcblk0p$PART /data/sdext2 1>>\$LOG 2>>\$LOG" >> $LTEMP;
else
echo "$LINE" >> $TEMPFILE;
fi
done
x=0;
while [ $x -lt $(cat $TEMPFILE | wc -l) ]
do
let x=x+1;
LINE=`head -n $x $TEMPFILE | tail -n 1`;
ACTION=`echo "$LINE" | cut -d' ' -f1`;
if [ "$ACTION" = "EXT" ] && [ "$VEXT" ]; then
echo "$VEXT" >> $VTEMP;
elif [ "$ACTION" = "INT" ] && [ "$VINT" ]; then
echo "$VINT" >> $VTEMP;
else
echo "$LINE" >> $VTEMP;
fi
done
echo "" >> $LTEMP;
echo "mount >> $LOG" >> $LTEMP;
echo "\"\$(date) mount finished\" >> \$LOG" >> $LTEMP;
cp $LTEMP $LINK2SD;
cp $VTEMP $VOLD;
rm $LTEMP;
rm $VTEMP;
rm $TEMPFILE;
chmod 777 $LINK2SD;
mount -o remount,ro /system
reboot;
Click to expand...
Click to collapse
[email protected]_a51dtul:/ # sh /data/eg.link2sd.sh
sh /data/eg.link2sd.sh
/data/eg.link2sd.sh[16]: mountpoint: not found
/data/eg.link2sd.sh[16]: mountpoint: not found
/data/eg.link2sd.sh[16]: mountpoint: not found
Can't find external SD card. Make sure it's inserted and mounted and try again.
[email protected]_a51dtul:/ #
plz help.........my sd card second partion ext4
He... Plz help link2sd not work for htc 820 dual sim lolypop 5.0.2 full rooted or busybox.
Link2sd problem-any apps link success all linked but big problem just manually restart my phone show link2sd error mount open link 2sd and tap quckreboot, but not apps linked show my desktop alwas error view and mount script alwas error.
Plz help....how to work link2sd apps linked and mount script for lolypop 5.0.2 htc 820 dual
That script was written for the Galaxy S2 with ICS. You'll have to modify it to work in whatever device and OS you have and I don't have either of them, so you're on your own.
Sent from: SGS2 - JB 4.1.2 GB27 / SGS4 - JB 4.2.2 MF9
egingell said:
That script was written for the Galaxy S2 with ICS. You'll have to modify it to work in whatever device and OS you have and I don't have either of them, so you're on your own.
Sent from: SGS2 - JB 4.1.2 GB27 / SGS4 - JB 4.2.2 MF9
Click to expand...
Click to collapse
Mods like this eventually burn out extsdcards, when that happens the device won't boot, they also don't work without the modified sdcard inserted. If it ever burns out it is nearly impossible to get the device working again. Just a heads up.
Change Default VM Number in Lollipop
XDA Thread
Sent from: SGS5 - LP 5.1.1 / SGS4 - LP 5.0.1
Google seems to have closed outbound connections to the NTP port (123). Lucky, one can easily reopen it with the following script. Execute it as root post-boot with ROM Toolbox or similar.
Code:
#!/system/bin/sh
iptables -A OUTPUT -p udp --dport 123 -j ACCEPT
Edit: So it turns out that init.d is too soon. It must be executed post-boot using a script executer like ROM Toolbox, Tasker, Script Manager, etc.
Sent from: SGS5 - LP 5.1.1 / SGS4 - LP 5.0.1

Busybox command softlinker

Have busybox? Wish you could type "grep foo" instead of "busybox grep foo" ? This simple shell script checks your busybox for supported commands and softlinks them from /system/bin to wherever the first busybox it finds in the $PATH is.
Since I screwed up my links a couple times making this, there's also a script that strips every link to busybox out of /system/bin.
These scripts do basically no error checking. They require root access, but they don't check for it. If you don't know how to read a script to see what it does before you run it, don't run it.
That said, it's handy.
Code:
#!/system/bin/sh
# linky.sh: softlink busybox to all the commands it supports
# Now with zero error checking! Beware :P
# -speef
busybox &>/dev/null || exit 1
bbl=`busybox which busybox`
ready=0
busybox mount -o rw,remount /system
>./linky.log
for cmd in `busybox`
do
cmd=`echo $cmd|busybox awk -F, '{print $1}'`
if [ $ready -eq 0 ]
then
if [ $cmd == "functions:" ]
then
ready=1
continue
else
continue
fi
fi
echo ln -s $bbl /system/bin/$cmd
busybox ln -s $bbl /system/bin/$cmd &>> linky.log
done
busybox mount -o ro,remount /system
echo "see ./linky.log for errors!"
And its counterpart, which removes all links to busybox from /system/bin:
Code:
#!/system/bin/sh
# delinky.sh: remove all busybox links from /system/bin
# Now with zero error checking! Beware :P
# -speef
busybox &>/dev/null || exit 1
busybox mount -o rw,remount /system
for cmd in `busybox find /system/bin -type l -exec ls -l \{\} \; | busybox grep busybox|busybox awk '{print $6}'`
do
echo rm /system/bin/$cmd
busybox rm /system/bin/$cmd
done
busybox mount -o ro,remount /system

BT5 on android( i have tab 2+ pasted bt5.img on ext. card)

perm=$(id|cut -b 5)
if [ "$perm" != "0" ];then echo "This Script Needs Root! Type : su";exit;fi
busybox mount -o remount,rw /dev/block/mmcblk0p5 /system
export kit=/storage/extSdCard/BT5
export bin=/system/bin
export mnt=/data/local/mnt
mkdir -p $mnt
export PATH=$bin:/usr/bin:/usr/local/bin:/usr/sbin:/bin:/usr/local/sbin:/usr/games:$PATH
export TERM=linux
export HOME=/root
if [ -b /dev/loop2 ]; then
echo "Loop device exists"
else
busybox mknod /dev/loop2 b 7 0
fi
busybox mount -o loop,noatime -t ext2 $kit/bt5.img $mnt
busybox mount -t devpts devpts $mnt/dev/pts
busybox mount -t proc proc $mnt/proc
busybox mount -t sysfs sysfs $mnt/sys
busybox sysctl -w net.ipv4.ip_forward=1
echo "nameserver 8.8.8.8" > $mnt/etc/resolv.conf
echo "127.0.0.1 localhost bt5" > $mnt/etc/hosts
busybox chroot $mnt /bin/bash
echo "Shutting down BackTrack ARM For Xoom"
busybox umount $mnt/dev/pts
busybox umount $mnt/proc
busybox umount $mnt/sys
busybox umount $mnt
THIS WORKS ON TAB 2 ....when you have the BT5 folder on external card!!!!!!!!
obv. rooted tab 2 :silly:
mail me for more solutions for your probs !!!!!

ERROR: chroot: can't execute "/bin/bash" no such file or directory on Android

ERROR: chroot: can't execute "/bin/bash" no such file or directory on Android
Hi guys,
I have a problem with "change root" command when I setup ubuntu to run on android. My tablet is Samsung galaxy tab 3 10.1, android 4.4.2 . I followed this tutorial step by step: galaxytabhacks.com/galaxy-tab-10-1-hacks/how-to-install-ubuntu-linux-on-galaxy-tab-10-1-tabuntu(excuse me, I can't post link, please copy and paste help me) but when I run "bootubuntu" script it threw error as title above.
This is bootubuntu script
Code:
#modprobe ext2
mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system
export kit=/sdcard/ubuntu
export bin=/system/bin
if [ ! -d /data/local/ubuntu ]
then
mkdir /data/local/ubuntu
fi
export mnt=/data/local/ubuntu
export PATH=$bin:/usr/bin:/usr/sbin:/bin:$PATH
export TERM=linux
export HOME=/root
export bbox=/system/xbin/busybox
$bbox mknod /dev/block/loop255 b 7 255
$bbox losetup /dev/block/loop255 /sdcard/ubuntu/ubuntu.img
$bbox mount -t ext2 /dev/block/loop255 /data/local/ubuntu
$bbox mount -t devpts devpts $mnt/dev/pts
$bbox mount -t proc proc $mnt/proc
$bbox mount -t sysfs sysfs $mnt/sys
sysctl -w net.ipv4.ip_forward=1
echo "Setting /etc/resolv.conf to Google Open DNS 8.8.8.8 and 8.8.4.4"
echo "nameserver 8.8.8.8" > $mnt/etc/resolv.conf
echo "nameserver 8.8.4.4" >> $mnt/etc/resolv.conf
echo "Setting localhost on /etc/hosts "
echo "127.0.0.1 localhost" > $mnt/etc/hosts
echo "READY TO ROCK AND ROLL BABY! "
echo "Brought to you by NexusOneHacks.net and the open source community! "
echo " "
chroot $mnt /bin/bash #error here
#After exit command is executed clear it all up
echo " "
echo "Shutting down Ubuntu"
$bbox umount $mnt/dev/pts
$bbox umount $mnt/proc
$bbox umount $mnt/sys
$bbox umount $mnt
$bbox losetup -d /dev/block/loop255 &> /dev/null
And this is result
Code:
Ubuntu Chroot Bootloader v0.1
Ubuntu Bootloader is now installed!
This process does NOT damage Android OS!
Original Installer by Charan Singh
Modified for Ubuntu Chroot by Max Lee at AndroLinux.com ,G2Hacks.com and NexusOneHacks.net
To enter the Ubuntu Linux console just type 'bootubuntu'
[email protected]:/sdcard/ubuntu # bootubuntu
net.ipv4.ip_forward = 1
Setting /etc/resolv.conf to Google Open DNS 8.8.8.8 and 8.8.4.4
Setting localhost on /etc/hosts
READY TO ROCK AND ROLL BABY!
Brought to you by NexusOneHacks.net and the open source community!
chroot: can't execute '/bin/bash': No such file or directory
Shutting down Ubuntu
1|[email protected]:/sdcard/ubuntu #
I read lot of thread about this error, but it on ubuntu only so I can't solve it.
Can anyone help me? Thanks so much!
this only my suggestion pal but do you have the bash binary
ballerd said:
this only my suggestion pal but do you have the bash binary
Click to expand...
Click to collapse
I don't have bash file and bin dir, I dont know how to find it too

Categories

Resources