Boot-Time Auto-SuperLog! [12 Apr 2013] - Atrix 4G Android Development

Boot-Time Auto-Superlog! [12 Apr 2013]
USERS --- TESTERS --- DEVS​Plumb the depths of Middle Droid with Auto-Superlog!​
So…
Your device doesn't finish booting
It reboots on its own (and you may not know it)
An application or feature crashes (and you may not know it)
Generally speaking, any manually-launched app or tool could miss key events leading to random reboot or application crash.
Problem addressed with Auto-Superlog!​
cm10-auto-superlog-v1.0.zip (3MB): http://www.mediafire.com/?cf5f9rq4z7p6gep
This flashable zip is tested working on my Atrix running CWM Recovery 5.0.2.0 and CM10 SuperLite. It should also work on epinter’s CM10 4.1.x builds and on close relatives. Not sure about 4.2.x yet.
In this exciting age of alpha-beta ROM testing, my lightweight Auto-Superlog, presently built on epinter’s versatile CM10 boot image (for demo purposes), can help just about anyone, whether end-user, tester or developer!
In fact it is already helping me track down abnormal battery drain and shutdown problems!
Alternatively instead of flashing the boot-time version, you can extract “auto-superlog.sh” from the flashable zip and manually execute it at run time.
Features
Automatically launches at boot-time under “class_start core” --- just after ROM filesystems are mounted, thus maximizing the likelihood of capturing key events, even if phone does not finish booting
Comprehensive log set includes: system build properties (getprop), kernel configuration file (from /proc/config.gz), kernel dmesg and system logcat --- all in sync, all in ASCII text format, and all stored in a single gzipped, time-stamped tar file on $EXTERNAL_STORAGE/auto-superlog for easy access and analysis.
Android events are quietly, nimbly and continuously streamed via kernel “dmesg” and system “logcat” commands. The dmesg log is pushed at 2-second intervals (default) with a 1MB ring buffer which is cleared on each pass. Logcat is configured to log “main” and “system” events with a generous 10MB buffer to help in discerning error trends.
Access real-time dmesg and logcat output right on your device by tapping the /data/auto-superlog directory using a (root) file explorer.
Log file contents are time stamped using absolute time ([YYYY-]MM-DD HH:MM:SS), enabling users to correlate Android events with the outside world
Filename timestamps show when your system was rebooted
Self-cleaning feature: On reboot, your most recent superlog is gzipped and archived to $EXTERNAL_STORAGE and then is removed from /data/auto-superlog so only your most recent superlog remains on the /data partition.
Shell script: auto-superlog.sh is stored under /system/bin, enabling users to extract and execute it at run-time and/or customize.
How to kill dmesg and logcat? Use the ps and grep commands: http://stackoverflow.com/questions/3117095/stopping-an-android-app-from-console (It’s a sheepish way of saying “mechanization of this feature is still in work” lol)
Instructions
Nandroid Backup current ROM (security blanket)
Flash zip if running epinter CM10 4.1.x or close relative (e.g. SuperLite)
Reboot and relax.
…OR, if you don’t want to flash the zip, but still want the run-time features of auto-superlog, simply extract /system/bin/auto-superlog.sh from zip and do this…
copy auto-superlog.sh to /system/bin (Tip: mount /system/bin as read-write (rw), then revert to ro when done)
chmod 0755 /system/bin/auto-superlog.sh
sh /system/bin/auto-superlog.sh (using Script Manager or other tool, as root)
Click to expand...
Click to collapse
After launching the script, just tap the Home button to resume other activity as the loggers are now running in background. Then you will have real-time streaming dmesg and logcat (as well as getprop and kernel config) at your fingertips --- literally.
The advantage of flashing the zip (if it’s compatible with your ROM) is that you are more likely to capture key events leading to a failed boot, random reboot or application crash.
Screenshots
​
Boot Image Source Code
This is the only change I made to CM10 boot.img...
Code:
ramdisk/init.olympus.rc ...
# sendust7 (12 Apr 2013)
service auto-superlog /system/bin/sh /system/bin/auto-superlog.sh
class core
# class main
# class late_start
user root
group system
# disabled
oneshot
# sendust7 (12 Apr 2013)
Documentation
dmesg: http://unixhelp.ed.ac.uk/CGI/man-cgi?dmesg+8
logcat: http://developer.android.com/tools/debugging/debugging-log.html#outputFormat
Android Encryption: http://source.android.com/tech/encryption/android_crypto_implementation.html
from Android Encryption…"This magic was accomplished by requiring all services to be in 1 of 3 groups: core, main and late_start. Core services are never shut down after starting. main services are shutdown and then restarted after the disk password is entered. late_start services are not started until after /data has been decrypted and mounted.”
Click to expand...
Click to collapse
Thoughts and Ideas: This has been a fun project so far. Time permitting, I may be able to service bug fixes and add more goodies like event filtering.
Disclaimer: Standard disclaimers apply.
Credits:Emerson Pinter (CM10 for Atrix 4g), Cyanogenmod Team

Very nice!
The OS considers the internal SD as EXTERNAL_STORAGE in assigning the env variable which is perhaps the reason you should too:
Booted without external sd mounted:
Code:
[email protected]:/ $ echo $EXTERNAL_STORAGE
/storage/sdcard0
Booted with external sd mounted:
Code:
[email protected]:/ $ echo $EXTERNAL_STORAGE
/storage/sdcard0
Possibly just tweak this part of your script:
Before
Code:
/system/bin/mount -t vfat /dev/block/mmcblk1p1 $EXTERNAL_STORAGE
After
Code:
/system/bin/mount -t vfat /dev/block/mmcblk0p18 $EXTERNAL_STORAGE
This then sends the archive to a location that will always exist (sdcard0).
I mention as I don't always have external SD mounted.
Sent from my MB860 using Tapatalk 2

Thanks sendust7
Good job !

Related

How to install ubuntu on the Droid 4

How to install ubuntu on the Droid 4
Note to mods: this thread is a branch off of this thread
Huge thanks to zacthespack for creating the ubuntu installer app and original boot script and to zeroktal for modifying the script to work on the D4 and helping me get it working on my device.
I decided to take my experience in setting this up and put it into a how-to so that others could enjoy the experience of having ubuntu on the Droid 4. If zackthespac or zeroktal have any problems with me making and putting this guide up, please let me know and I will remove it.
Knowledge Required:
working knowledge of command line
working knowledge of vi
OR the ability to learn how to use both
Tools Required:
A rooted Motorola Droid 4
BusyBox (Android Market)
Terminal Emulator (Android Market)
Android VNC Viewer (Android Market)
Ubuntu Installer App (Android Market)
zeroktal's ubuntud4.zip file (attached to this post and mediafire)
Vi Cheat Sheet (lagmonster.org)
Step by Step:
Install BusyBox, Terminal, and Android VNC Viewer
Install and run Ubunutu Installer App
Follow the on-screen instructions and click next
Download either the Small or Large image to your phone, (use zeroktal's ubuntud4.zip file instead of the boot script provided in the guide) after the image downloads (will take a while because the file is HUGE) click next
For this screen, the instructions differ from the app.
1. With your D4 plugged into your PC in USB Mass Storage, create a directory (folder) called ubuntu in the EXTERNAL sdcard's root*
2. Extract the image you downloaded to that directory
3. Download and extract the attached .sh (ununtud4.zip) to that directory
4. Disconnect your phone from your PC
5. Open terminal and run the following commands:
su [ENTER]
mount -o remount,rw,exec,suid /dev/block/vold/179:1 /mnt/sdcard-ext [ENTER]
cd /mnt/sdcard-ext/ubuntu [ENTER]
sh ubuntud4.sh [ENTER]
960x540 [ENTER]**​If you get an error message: ubuntud4.sh: 45: syntax error: end of file unexpected (expecting "then") see troubleshooting section below.​killall -TERM Xtightvnc [ENTER]
vncserver :1 -geometry 960x540 [ENTER]**​6. Open androidVNC app and enter the following settings:
Nickname: Anything you want
Password: ubuntu
Address: localhost
Port: 5901
Color Format: 24-bit color (4 bpp)
7. Hit connect
8. Hit your menu soft button and then set input mode to touchpad
9. You have ubuntu on your Droid 4!
To "shut down" ubuntu:
press the menu button, select disconnect in VNC
In terminal type this command 3 times (terminal will close itself when you are done):
exit [ENTER]
To "start up" ubuntu again:
Follow steps 5-8 above
Troubleshooting:
If you get the error message: ubuntud4.sh: 45: syntax error: end of file unexpected (expecting "then") you are about to have fun with vi at the command line.
Do the following from inside terminal:
su [ENTER]
cd /mnt/sdcard-ext/ubuntu [ENTER]
vi ubuntud4.sh [ENTER]​If you see ^M or ^ at the end of any line (remember to scroll all the way to the right to see the end of long lines) remove it. once you do that, everything should work just fine. (See the Vi Cheat Sheet above for help with Vi)
Note: Vol Up + E is [ESC] by default in this terminal emulator
Notes:
* It does not have to be on the external SD, but if you put it on the internal SD you will have to modify things as needed-- if you dont know what needs to be changed, just put it on the external SD.
** Screen size can be whatever you want it to be, but 960x540 is the size of the D4 screen.
*** This is a fairly involved process... especially when it comes to editing the .sh file in vi things can get very frustrating and hard, but just take your time and you will get it. As always, doing anything with root access on your phone, especially on the command line has risks. I am not responsible if anything goes wrong with your phone... proceed at your own risk!
greekchampion04 said:
Notes:
* It does not have to be on the external SD, but if you put it on the internal SD you will have to modify things as needed-- if you dont know what needs to be changed, just put it on the external SD.
** Screen size can be whatever you want it to be, but 960x540 is the size of the D4 screen.
*** This is a fairly involved process... especially when it comes to editing the .sh file in vi things can get very frustrating and hard, but just take your time and you will get it. As always, doing anything with root access on your phone, especially on the command line has risks. I am not responsible if anything goes wrong with your phone... proceed at your own risk!
Click to expand...
Click to collapse
I actually got it up and running on my internal sdcard partition. Pretty much just have to modify the Mount remount command, and a few lines in the script.
Here's the original command
Code:
mount -o remount,rw,exec,suid /dev/block/vold/179:1 /mnt/sdcard-ext
And the modified one
Code:
mount -o remount,rw,exec,suid /dev/block/vold/179:57 /mnt/sdcard
Only things you have to change are the device location(179:57) and mount location(drop the -ext after sdcard)
Now, after that you also have to modify the script a bit. Just go through it, and anywhere that you see sdcard-ext, drop the -ext off the end.
thanks for putting that up for everybody! like i said, if you know what you are doing its not a hard swap to make.
Is anyone else getting just a gray screen when they remote in? What could be causing this?
i had that same problem at first... did you use zeroktal's ubuntud4.zip file? or did you use the ubuntu.sh file included in the app?
I used the sh file included. I did however fix the problem, when mounting at the start i confused vold with void. I did not get the file system mounted properly. This method does work!! however I am currently trying to get bash on my droid to replace sh as the shell. I've checked the forums but have not found anything yet about someone installing bash on the droid 4. With no way for nandroids I feel i should wait before I kill sh.
Sent from my DROID4 using XDA App
If you mod your init.sh in your root directory to the following, your vnc will work on startup without issue. It will also shutdown vnc on exit.
#!/bin/bash
#############################################
# Asks User to screen size and saves as REZ #
#############################################
#echo "Now enter the screen size you want in pixels (e.g. 800x480), followed by [ENTER]:"
#read REZ
##############################################
# Pick which desktop environment to use, this#
# is done by having a xstartup file for each #
# desktop, then renaming the one you want to #
# use to 'xstartup' before boot #
##############################################
echo "Please select which Desktop environment you want to use, type the number to select it then press [ENTER]"
echo "1 - LXDE"
echo "2 - Gnome"
echo "Make your Selection:"
read DESKTOP
if [ $DESKTOP == 1 ]
then
mv /root/.vnc/lxstartup /root/.vnc/xstartup
fi
if [ $DESKTOP == 2 ]
then
mv /root/.vnc/gxstartup /root/.vnc/xstartup
fi
###########################################
# Tidy up previous LXDE and DBUS sessions #
###########################################
rm /tmp/.X* > /dev/null 2>&1
rm /tmp/.X11-unix/X* > /dev/null 2>&1
rm /root/.vnc/localhost* > /dev/null 2>&1
rm /var/run/dbus/pid > /dev/null 2>&1
############################################################
# enable workaround for upstart dependent installs #
# in chroot'd environment. this allows certain packages #
# that use upstart start/stop to not fail on install. #
# this means they will have to be launched manually though #
############################################################
dpkg-divert --local --rename --add /sbin/initctl > /dev/null 2>&1
ln -s /bin/true /sbin/initctl > /dev/null 2>&1
###############################################
# start vnc server with given resolution and #
# DBUS server, (and optionally an SSH server) #
###############################################
dbus-daemon --system --fork > /dev/null 2>&1
/etc/init.d/ssh start
vncserver :1 -geometry 960x540
echo
echo "If you see the message 'New 'X' Desktop is localhost:1' then you are ready to VNC into your ubuntu OS.."
echo
echo "If VNC'ing from a different machine on the same network as the android device use the 1st address below:"
##########################################
# Output IP address of android device #
##########################################
ifconfig | grep "inet addr"
echo
echo "If using androidVNC, change the 'Color Format' setting to 24-bit colour, and once you've VNC'd in, change the 'input mode' to touchpad (in settings)"
echo
echo "To shut down the VNC server and exit the ubuntu environment, just enter 'exit' at this terminal - and WAIT for all shutdown routines to finish!"
echo
###############################################################
# Spawn and interactive shell - this effectively halts script #
# execution until the spawning shell is exited (i.e. you want #
# to shut down vncserver and exit the ubuntu environment) #
###############################################################
/bin/bash -i
#########################################
# Disable upstart workaround and #
# kill VNC server (and optionally SSH) #
# Rename used xstartup to its first file#
#########################################
killall -TERM Xtightvnc
/etc/init.d/ssh stop
Also save the follow lines between ### as remount.sh on your system partition. Then chmod 755 /system/remount.sh. Now you can just run run from a terminal /system/remount.sh and voila it remounts correctly and starts ubuntu(with the above fixes). Im still working on the unmounts.
####### for the internal sd card
mount -o remount,rw,exec,suid /dev/block/vold/179:57 /mnt/sdcard
/mnt/sdcard/ubuntu/ubuntu.sh
######
OR
####### for the external sd card
mount -o remount,rw,exec,suid /dev/block/vold/179:1 /mnt/sdcard-ext
/mnt/sdcard-ext/ubuntu/ubuntu.sh
#######
great stuff!
feel free
Feel free and take, modify, repost or edit anything I touch.
QUESTION:
After I delete all the ^M and ^ what do i do next? I try to hit the command ":x" to exit and save changes but it just creates another line. Also when I press VOL UP + E to escape nothing happens.
PhanTuhC said:
QUESTION:
After I delete all the ^M and ^ what do i do next? I try to hit the command ":x" to exit and save changes but it just creates another line. Also when I press VOL UP + E to escape nothing happens.
Click to expand...
Click to collapse
In vi, the command to save and exit is :wq (probably short for write and quit).
remember, read up on the vi quick-reference guide: http://www.lagmonster.org/docs/vi.html
OK I fixed it but now its not letting me connect with androidVNC. All the settings entered is correct but when I try to connect it says:
"VNC connection failed!" localhost/127.0.0.1:5901 - Connection refused"
ok, i've gone thru this a few times (slowly and deliberately) and must be missing something...the directions seem pretty straightforward! here's what i know...
busy/terminal/vnc are all installed
small 2.5gb image is unzipped in /sdcard-ext/ubuntu directory
the attached .sh file from page 1 is in the same directory
i removed all ^M using vi
but when I try sh ubuntud4.sh i get an error...
"mkdir failed for /data/local/mnt/ubun, No such file or directory"
(plus a few other errors)
should the directory be "ubun" or "ubuntu"? am I typing something incorrectly?
copy and paste new script
Copy and paste the new scripts I posted. They will fix your problem. Remember to use the remount script from /system/ the rest will work perfectly if you are root. I'll check back later on your progress.
Ok, well I started from scratch (deleted both .img and .sh files) and it's still not working.
I have all the apps installed (and yes rooted, SU works just fine)
I used Ubuntu Installer app to download the image zip (tried both the large and small img)
I downloaded the .sh file from the first post
The /sdcard-ext/ubuntu/ folder now has two files: "ubuntu.img" and "ubuntud4.sh"
All ^M characters have been removed from .sh file
Still no joy...
Ideas? What am I missing?
In terminal, I can set SU permissions and the mount/cd commands work just fine...it's the last sh command that spits out a bunch of errors about not being able to create/find the directories.
I'm going to format the sdcard and try again...any help is appreciated.
Update: Even after re-formatting the SD and following the steps exactly, no luck!
Did you remember to remount the sdcard with exec and suid permissions?
Andbuntu will work much better than this method. It works on every single phone with modification to the "environmental variables".
http://code.google.com/p/andbuntu/
Follow the directions in the script to make the process much easier than the first post.
instructions:
generate an image with rootstock on an ubuntu computer.
put it on /sdcard/ubuntu/ubuntu.img
run the script on your phone with "sh /path/to/script"
Here is the script. http://andbuntu.googlecode.com/svn/trunk/uboot
Also, run "firstRun" to make things like terminals work properly.
Adamoutler: That didnt work for me. The permissions were incorrect on the mounted partitions.
Sent from my DROID4 using XDA App

[RECOVERY/BOOTSTRAP]Tweaked Safestrap v2.00a (ICS Leak) 06-13-2012

************************************
************************************
Note: Please uninstall Hashcode's Safestrap before you try installing this one. To accomplish this properly, you have to do two things:
1. Open up the Safestrap app from your launcher, and choose "Uninstall Recovery". Let it finish. It'll tell you whether or not it worked.
2. Then, go to Settings - Apps and find Safestrap. Click "Uninstall".
************************************
************************************
Installation of this app requires root privileges. If the installation does
not work, it is likely because you either:
a) don't have busybox installed.
b) you do have busybox installed but it doesn't have the functions we
need.
No problem. Just do this through adb or a terminal on the phone:
Code:
$ su
# mount -o remount,rw /system
# cp /system/xbin/busybox /system/xbin/busybox.old
# cp /data/data/com.hashcode.droid4safestrap/files/busybox /system/xbin/
# chmod 755 /system/xbin/busybox
# exit
Now it should work without a hitch.
************************************
************************************
Those of you who came from the Droid 3 might remember my customized version of Hashcode's Safestrap, which included a console, improved user-interface, non-safe flashing, etc.
I've finally got it to the point where I think it would be okay to release out in the wild. That being said, I'm not responsible for anything dumb you do to your own device.
I wouldn't bother using the non-safe flashing capabilities yet, seeing as how there hasn't really been any official releases using the new ICS kernels that have been leaked as of late. This feature is handy if you're a developer testing out update.zips for /systemorig, but for the average person you'd best pay heed to the warnings and just use Safestrap as it was originally intended; that is, leaving your /systemorig partition intact and only mess around with your "safe" /system. (Or /preinstall, actually, but that's not really important.)
The console is beyond useful. Editing build.prop settings on the fly without having to boot up and do it in a terminal emulator or via adb on the phone is much easier. If you know what you're doing, you can even extract single files from your old backups, modify your old backups, etc. That's just a small fraction, but those of you who would care about this functionality don't need me to say how important it can be.
I've included statically compiled versions of "bash" and "vim" so that there aren't any dependencies on the libraries usually found in /system/lib. Thus, you can use all of these utilities without having either /system or /systemorig mounted. You're free to add your own binaries in your home folder, which is located at /cache/.safestrap/home, or just pop them onto your sdcard.
Also, I have a battery monitor running so it will tell you what level your battery is at, and have put a lot of work into the visual appearance of the user-interface. There are so many things I've modified that it would be impossible for me to list them all here.
Anyways, try it out and let me know what you guys think. I hope you like it!
For those of you who are interested, I always post my sources on Github. You can find my code repositories here:
https://github.com/buddyrich
The .APK can be downloaded from my DropBox via the link below:
http://db.tt/tZdmUHl1
=========================
RECOVERY MENU REFERENCE
=========================
Select Highlighted Item - Enter or Power
Scroll Up - Volume Up or Left Arrow
**Note: The Left/Right Arrow keys may sound weird but since the menu is displayed in portrait mode, it just feels like you are pushing Up/Down.**
Scroll Down - Volume Down or Right Arrow
Direct Menu Selection - Hit the corresponding number/letter at the beginning of each menu item.
**ie: from the main menu, hit "6" to jump to the advanced menu.**
Go Back / Cancel - Caps Lock
===================
CONSOLE REFERENCE
===================
Keys:
--------------------
Tab - Tab
** Note: The Tab key is your best friend when using bash. It will auto-complete file/directory names for you, or list out the possible choices if you double-tap it after entering a few letters.
SYM - Alt
Shift - Shift
OK - Control
Caps Lock - ESC
OK+Shift - Toggle Caps Lock
OK+SYM - Toggle Alt Lock
** Note: The LED beside the Caps Lock button will illuminate when either Caps Lock or Alt Lock is enabled.
OK+Backspace - Force exit
OK+A - Home
OK+E - End
OK+C - Stop current process, ie: if a program you are running chokes up.
=========================
bash Commands:
--------------------
Here are a few of the more useful bash commands that you will use:
===========
ls, ls -a, ls -l, ll
===========
Code:
/ {}$ ls
- "ls" lists the files and directories within the current directory.
- You can also add a path after it to look for certain files or directories.
Code:
/ {}$ ls -a
- "ls -a" will list all files and directories, including hidden ones starting with a ".", ie: .bashrc in /cache/.safestrap/home. (The bash startup script).
Code:
/ {}$ ls -l
- "ls -l" will do a long listing, showing permissions, file sizes, etc.
Now, instead of using those parameters, I've made aliases within the .bashrc script so you will probably just want to type:
Code:
/ {}$ ll
- "ll" is an alias for "ls -a -l", so it will list all files/directories, hidden or not and list their properties.
Code:
/ {}$ ll
- By putting a path after "ll", it will single out the file. Add a "*" in there to act as a wildcard to list multiple files with the same first few characters.
- ie: "ll /system/lib/libc*" would display all the files and directories starting with "libc" within /system/lib as well as their properties.
========
cd
========
Code:
/ {}$ cd (path)
- Change directory. Pretty self-explanatory. Try doing:
Code:
/ {}$ cd ~/
- This takes you to the home folder. Pretty useless here but this is usually pretty handy in other scenarios.
Code:
/ {}$ cd ../
- Using "../" as your target will cause you to drop down a single directory in the tree.
**** Don't forget to hit tab to auto-complete directory/file names for you whenever you've already entered the first few characters. More accurate and much less typing. ****
=======
mv
=======
Code:
/ {}$ mv (source) (destination)
- "mv" is short for move. The source is the path to the file/directory you want to move, and I don't think i need to tell you what the destination is.
=======
rm
=======
Code:
/ {}$ rm (-r -f) (target)
- "rm" is used to delete the targetted files.
- "-r" means to recurse, or go into every inner directory automatically, erasing as it goes.
- You'll use the -r flag a lot, because you can't delete directories without it unless you use "rmdir", which is just more typing.
"-f" means force in case of permission errors, as long as you are root.
========
cp
========
Code:
/ {}$ cp (-f -a) (source) (destination)
- Copy the source file or directory to the destination.
- Use "-f" to force the copying, in the event of a potential overwrite.
- Use "-a" to maintain permissions of the original, you'll want to use this whenever you are copying anything important. I just use it all the time, but sometimes it won't work, such as when copying from an /sdcard to either the /system or /data partition.
-This is because the file system of your /sdcard doesn't care about permissions.
=========================
============
[VIM REFERENCE]|
============
Vim deserves, and has, entire websites devoted to it's use. Here are some of the basics.
------------
Using Vim|
------------
From the console, simply type:
Code:
/ {}$ vim
Where is obviously replaced by the name of the file you are editing.
Multiple files can be opened at once by just adding them as parameters to vim:
Code:
/ {}$ vim file1 file2 file3 file4 filen
---------------
Insert Mode |
---------------
This is the mode you want to be in to make any visible changes to the file you are editing.
- Enter Insert Mode by pushing "i" when vim opens.
- Exit Insert Mode by pushing Capslock.
Keys:
------
Backspace - In insert mode, deletes the previous character.
Capslock - Exits insert mode
---------------
Visual mode |
---------------
By typing in "v" instead of "i", you will enter visual mode; this is Vim's fancy way of saying you will be selecting text.
Keys:
------
- Copy or Cut text by hitting "y" or "d" after you've made a selection
- Paste with "p" or "P" (that is, Shift+p). Shift-"p" puts the text before the cursor whereas plain lowercase "p" will paste it after.
- When you're done highlighting what you want to either cut or copy, just hit Capslock to go back to Command Mode.
-------------------
Command Mode |
-------------------
Vim starts out in Command mode. It seems confusing but once you get used to it, you can't help but hate Notepad.
Some of the more common commands are listed below.
Keys:
------
u - Undo
Shift+r (Usually denoted as R) - Enter Replace Mode, where you are replacing text instead of inserting it.
[#]yy - Yank (copy) the current line if you just entered "yy", or copy "#" lines if you enter #yy, ie: 5yy to copy 5 lines.
[#]dd - Delete (cut) the current line, or delete # lines if preceded by a #.
p - Pastes after the cursor
Shift+p (usually denoted as P) - Pastes before the cursor
:[#] - (Ignore the square brackets; a colon followed by a number goes to that particular line in the text file you are editing. eg: ":5" goes to line 5. (Obviously, don't type the quotation marks in.)
Note: - If you are in Insert mode, you will have to push Capslock to exit and be allowed to enter Command Mode by entering a ":"
- It's fairly common practice to just hit Capslock twice whenever you're done inserting so that you are sure to be able to hit ":" and proceed to enter another command.
:w - Write (save) the currently open file.
:q - Quit. If you haven't saved since making any changes, it will prompt you to either save your changes or append a "!" after "q" to quit without saving. (See below)
:q! - Force quit without saving.
:wq - Save and then quit.
:e [path to filename] Opens up another file; you can use bash command-line completion to scan the current directory, or otherwise just enter another path.
:next or rev - Aptly named, move to the next or previous file if you opened vim with two or more files as parameters, ie:
Code:
/ {}$ vim file1 file2
:/[text] - Search for "text". ie: ":/search" will find instances of the text "search" in the current file and highlight them.
Note: You need to make sure you are aware of regular expressions/escape characters before using this reliably; it's not broken if you can't seem to search for a quotation mark or other special characters, you need to precede them by a \. ie: to look for a double-quote symbol " you would enter :/\". The \ tells it that the next character is meant to be taken literally and not symbolically.
:/[text]/[moretext]/gc - Replace "text" with "moretext" everywhere in the file and ask confirmation for each change. If you forget to type in the "gc" at the end, it'll just replace everywhere without asking you for confirmation.
That's all I'm going to put here. There are tons of guide out there and I've already preloaded a pretty awesome configuration (.vimrc located at /cache/.safestrap/home) and runtime files. If you want to quickly access the configuration file, you can type ",,e" in Command Mode and it will automatically pop open.
================
COLOR CHANGING
================
1. If you want to change the color scheme, you need to figure out what the RGB code for the color you want is. Here's a website that provides a large table of colors and their corresponding RGB color code:
http://web.njit.edu/~kevin/rgb.txt.html
For example, let's say we like the "SlateGray4" color from the table linked above want to use it for the menus in both Safe and Non-Safe mode. As you can see, in the "R;G;B; Dec" column, the three codes we are interested in are 108, 123 and 139.
2. Now that you know the color codes, in our case 108, 123 and 139, we simply do the following:
a) Push 7 from the main menu, or scroll down and select "console menu".
b) Push 1, or scroll down and select "open console"
(Don't panic if it takes a few seconds to load the console; on the first initialization or after wiping the /cache partition, it will take a few seconds to reconfigure itself.)
c) At the prompt, enter the following:
Code:
/ {}$ ns_rgb 108 123 139
/ {}$ s_rgb 108 129 139
/ {}$ cc
/ {}$ exit
Now, it'll take another second or two and when the menu pops back up, you'll see that it is the color we chose from the table. The "ns_rgb" command takes three parameters, each of which correspond to the R, G and B values of the color code, and uses them for the "Non-Safe" (hence the "ns") menu color.
Similarly, the "s_rgb" command, (well technically, it's a bash function but anyways...) takes the same three parameters. It is applied to the "Safe" menu color.
The "cc" command actually sets the color, so don't forget to enter it. Otherwise, you won't notice a change when you exit out from the console.
Feel free to experiment with different colors! If you don't what you've done and just want to reset it back to the way it way, just wipe the cache partition:
a) Push 3, or scroll down to "wipe menu".
b) Push 1, or just hit Enter on "wipe cache".
c) Confirm your selection by pushing 8 or scrolling down and selecting "yes - wipe cache".
=================================================
More to come as I have more time.
Awesome, just a couple questions:
1) where is the dropbox download
2) if I already have the hashcode safestrap installed, how does one install yours? And what happens if I am already running a custom ROM?
Sent from my XT894 running ICS
Good call, I should make that clear.
Make sure you uninstall Hashcode's Safestrap, both inside the app and from the Android Settings menu before you install this .APK.
- download the pimped apk, uninstalled safestrap recovery, uninstalled old safestrap
- installed pimped safestrap, install new safestrap recovery, reboot
looks fine
anyone who restorerd a full backup of ics leak with safestrap 2.0?
friend got a problem, and system was unbootable and lost root....
Yeah, I've done it about four times today. No problems using either my modified version or Hashcode's original Safestrap v2.00.
It was no problem recovering from a busted /system partition either; just fastbooted the /system and /preinstall partitions only from the .219 leak, then rebooted the phone into the stock recovery and re-applied the .208 leaked update .zip file. Re-rooted with the technique I posted the other day without a hitch.
Didn't even lose any data...
Rick#2 said:
Yeah, I've done it about four times today. No problems using either my modified version or Hashcode's original Safestrap v2.00.
It was no problem recovering from a busted /system partition either; just fastbooted the /system and /preinstall partitions only from the .219 leak, then rebooted the phone into the stock recovery and re-applied the .208 leaked update .zip file. Re-rooted with the technique I posted the other day without a hitch.
Didn't even lose any data...
Click to expand...
Click to collapse
I mean full restore in safestrap, not advanced restore.
After restore from systemorig cames an "error while restoring systemorig!" And system damage.
...Tapatalk
Rennert said:
I mean full restore in safestrap, not advanced restore.
After restore from systemorig cames an "error while restoring systemorig!" And system damage.
...Tapatalk
Click to expand...
Click to collapse
I'm not following you here, this happened to you using my version?
I've done it countless times while testing this before I released it and have been working with this code for a long time; it's pretty foolproof.
Rick#2 said:
I'm not following you here, this happened to you using my version?
I've done it countless times while testing this before I released it and have been working with this code for a long time; it's pretty foolproof.
Click to expand...
Click to collapse
No, this was tested with hashcodes safestrap. Restore in your version doesn't tested, but not need at time;-)
...Tapatalk
Having some issues with getting safestrap installed in the 208 ICS leak. The app installs fine, click install and it says install complete, but I have no safestrap. Even after a reboot it still says "Not Installed" in the safestrap app. Anyone else experiencing this issue?
Sent from my DROID4 using Tapatalk
jgardner said:
Having some issues with getting safestrap installed in the 208 ICS leak. The app installs fine, click install and it says install complete, but I have no safestrap. Even after a reboot it still says "Not Installed" in the safestrap app. Anyone else experiencing this issue?
Sent from my DROID4 using Tapatalk
Click to expand...
Click to collapse
make sure u installed/updated busybox
That was exactly it. Realized shortly after posting it. Thanks!
Sent from my DROID4 using Tapatalk
So I have tried to restore 2 different backups using your safestrap and I keep on getting MD5 mismatch errors. I have tried deleting and regenerating the checksum file via ADB, disabled signature check, changed the folder name, pretty much everything I could think of. So whats going on?
An MD5 error would indicate that your backup files don't match the checksum that was generated at the time the backups were initially generated, which most likely means that your backup files may have become corrupted... unfortunately, this can happen with any files stored on an SD card.
Don't worry too much though, there still a really good chance that you can manually restore your data, although if your MD5's aren't matching there's a tiny possibility that your backup files are toast.
*** I'll assume you are trying to restore a "safe" system backup. If it's a "non-safe" backup, then just interchange "/systemorig" and "non-safe" for "/system" and "safe", respectively. ***
You have to manually wipe your /data and /cache partitions in the wipe menu, then format "/system" in the mounts menu. This way you have a clean slate to extract your backups to.
Try this from within the console in the recovery. (Depending on whether you backed up to the internal (/emmc) or external (/sdcard) card, just mount the required partition as follows:
*** Don't worry if you get a message saying the device can't mount because it is busy, that just means it's already mounted. ***
Internal card:
Code:
{}$: mount /emmc
External card:
Code:
{}$: mount /sdcard
(To be sure, it won't hurt if you just mount both of them.)
I'll assume you used the external sdcard which is mounted at /sdcard. Now:
Code:
{}$: cd /sdcard/safestrap/backup
If you list this directory (using "ll", or "ls -l"), you'll see a list of backup directories, prefixed by either "safe" or "nonsafe" and followed by the date and time of the backup. Remember, you can use the Tab key to autocomplete file/directory names so you don't have to type in the entire path. Here's an example:
Code:
/sdcard/safestrap/backup {}$ ll
total 192
d---rwxr-x 6 1000 1015 32768 Jun 24 04:42 ./
d---rwxr-x 3 1000 1015 32768 Jun 6 04:41 ../
d---rwxr-x 5 1000 1015 32768 Jun 6 04:41 nonsafe-2012-05-25.19.22.55/
d---rwxr-x 2 1000 1015 32768 Jun 8 20:42 nonsafe-2012-06-08.13.35.00/
d---rwxr-x 2 1000 1015 32768 Jun 20 03:13 safe-2012-06-19.20.10.44/
d---rwxr-x 3 1000 1015 32768 Jun 24 13:17 safe-2012-06-23.16.25.49/
/sdcard/safestrap/backup {}$
Let's use "safe-2012-06-19.20.10.44" for my example, substitute your own directory name as I'm sure it'll be different.
Go ahead and list the contents by entering the next two commands:
Code:
/sdcard/safestrap/backup {}$: cd safe-2012-06-19.20.10.44
/sdcard/safestrap/backup/safe-2012-06-19.20.10.44 {}$: ll
You should see something like:
Code:
/sdcard/safestrap/backup {}$: cd safe-2012-06-19.20.10.44
/sdcard/safestrap/backup/safe-2012-06-19.20.10.44 {}$ ll
total 1117760
d---rwxr-x 2 1000 1015 32768 Jun 20 03:13 ./
d---rwxr-x 6 1000 1015 32768 Jun 24 04:42 ../
----rwxr-x 1 1000 1015 74135552 Jun 20 03:13 cache.ext3.tar*
----rwxr-x 1 1000 1015 225547776 Jun 20 03:12 data.ext3.tar*
----rwxr-x 1 1000 1015 201 Jun 20 03:13 nandroid.md5*
----rwxr-x 1 1000 1015 280272384 Jun 20 03:12 system.ext3.tar*
----rwxr-x 1 1000 1015 564430848 Jun 20 03:11 systemorig.ext3.tar*
/sdcard/safestrap/backup/safe-2012-06-19.20.10.44 {}$
Now that you're at the proper path for the backup you want to restore, we can manually extract the files from the backups. (If you haven't already done so, remember to wipe /data, /cache and /system.)
We have to mount /system, /data and /cache:
Code:
/sdcard/safestrap/backup/safe-2012-06-19.20.10.44 {}$ mount /system
/sdcard/safestrap/backup/safe-2012-06-19.20.10.44 {}$ mount /data
/sdcard/safestrap/backup/safe-2012-06-19.20.10.44 {}$ mount /cache
*** Don't worry if you get a message saying the device can't mount because it is busy, that just means it's already mounted. ***
Code:
/sdcard/safestrap/backup/safe-2012-06-19.20.10.44 {}$ tar xvf system.ext3.tar -C /
Wait a minute or two for it to finish, then:
Code:
/sdcard/safestrap/backup/safe-2012-06-19.20.10.44 {}$ tar xvf data.ext3.tar -C /
Wait some more... then:
Code:
/sdcard/safestrap/backup/safe-2012-06-19.20.10.44 {}$ tar xvf cache.ext3.tar -C /
Done. If you want, you can restore your /systemorig partition now but you probably don't want to do that, not if your MD5's don't match up.
Assuming you just restored a "safe" system backup and you are in "safe" mode, you can cross your fingers and reboot. If you aren't in safe mode, switch over to it from the safe-boot menu before you reboot.
At this point, you should have restored that backup manually. Hope that helps, it's always a bummer to lose your data.
You sir need a medal. That was the best response I could have expected. I will try this later at work. I regenerated the checksum file but like you said, it has to be at the time of the backup.
Hey man, no prob. I figure I might as well do it step by step so that others can reference this in the event of a similar situation. Hope it works out for you.
To be honest, I got frustrated and gave up. I have discovered that on the 7-4 AOKP build, if I lose data all I have to do is wipe cache and dalvik cache and boom, I have have 4G. Now if only I can get a init.d tweak to clear both on startup then all I would have to do is reboot the phone to restore data. So long story short, I'm sticking with the non ICS-Leak AOKP, no need to risk going off the upgrade path and alot less of a hassle.
@Rick#2
new Safestrap 2.10 for Droid4 is out, can you pimp this one too?

[INIT.D][10-05-2012]Super APP2SD Script [MAJOR UPDATE][BETA]

UPDATES, WARNINGS, AND INSTALLATION STEPS ARE AVAILABLE IN THE 2ND POST
WHAT DOES THIS SCRIPT DO?
* It is the only method, that I am aware of to have apps trully run, and be installed directly to the external storage without completely switching the internal storage with the external storage.
This bings different benefits to different people:
1 - If you have a device that comes from factory with only a small amount of storage available, you can now install as many apps, and apps as big as the partition you setup to use with this script. For example, if you have a phone with only 512 MB of app storage, you can now install games that take over 1GB of app storage so long as your external partition has the space available.
2 - If you bought a 16GB device and wish you had bought a 32GB device, this is great for you as well (I'm one of these). With this script, your apps will not take up any space in your internal storage, which means that your 16GB (or whatever is left of it after factory partitioning, 11.66 GB in my case) is now available for pictures, videos, downloads, backups, or whatever else you might want to put there or have easy access to when you connect your device to your computer.
3 - If you have a lot of Android games, this is great for you too, specially if you're playing games that take a lot of space. Just get a large MicroSD (I have a 64GB partitioned to 32/32) and put as much space as you need in the second partition, and now you can have all your games intalled at the same time. No need to keep uninstalling games so that you can install other ones.
* Once and Done, across the board setup. That's right, launchers, keyboards and widgets will run from the external storage natively, something never done before in Android as far as I know.
This means that once you have the script up and running, you're good to go until the next time you reflash your /system partition. No need to choose what apps to move. No symlinks or anything. Your apps now belong in the external storage, plain and simple.
* No need to backup all your stuff before running the script (and eventually no need to back up your stuff when you want to disable it either).
That's right, the script does the hard work for you. All your stuff gets safely moved to the external storage, with all ownerships and permissions intact. It all happens so smoothly that some people have a hard time telling that the script is already at work. Nothing gets deleted from the internal storage until you're certain that everything is working as expected either. So even if something goes wrong, as long as you have ADB, all your stuff can go back to normal without a problem
(Even though you don't have to backup and restore in order to get the script going, it's always greatly recommended that you keep a backup of your apps).
* Simple intallation:
To get the script going all you have to do is download it, extract it, and run 3 commands in the terminal. It will then ask you a couple of questions, and then you'll be all set. The one downfall is that because the script requires user input (no, the required information cannot be picked from a list), the script cannot be run from a recovery zip. However, I'll emphasize once again that it only takes 3 commands to get the script going.
Also, the script comes with an options file that allows you to setup device specific variables, making the script malleable to work on just about any Android device. Just open the USER_OPTIONS file before runing the install script, and as long as you have the variables there set correctly, the script should be compatible with your device.
* You can still use the external partition for other stuff if you want to. Just remember that it's mounted to /mnt/sd-ext (or /storage/sd-ext in JB). So if you still have a ton of space left in the partition and need the space, you can still use it. Just ensure not to touch the folders Android, app and data.
* Now this is a bit more technically, but in theory, you could a third partition for this script instead of the second partition, and then still be able to use app2sd solutions, though personally I don't see what advantage there would be to doing this since apps would still be in the external storage no matter what.
WHAT DOES THIS SCRIPT NOT DO?
*** IT CANNOT BE CONVERTED INTO A RECOVERY ZIP DUE TO USER INPUT REQUIREMENT ***
*** YOU CANNOT PICK AND CHOOSE WHAT APPS TO MOVE, THAT'S PLAIN AND SIMPLE NOT THE PURPOSE OF THIS SCRIPT ***
SCREENSHOTS
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Above you can see my storage screen. If you add the amount of used space and the amount of available space, it's ~18 GB, well over the available 11.66GB in the internal storage. Also note that when the script is enabled, the bar displaying storage usage is unreliable. All other information is reliable, including, and most importantly, the amount of available free space.
Above you can see the output of some commands in the terminal. The most important part of the output for mount above are
Code:
/dev/block/mmcblk0p12 on /mnt/temp/data type ext4 (rw,relatime,barrier=1,journal_async_commit,data=ordered,noauto_da_alloc,discard)
/dev/block/mmcblk1p2 on /mnt/sd-ext/data type ext4 (rw,nosuid,nodev,noatime,barrier=1,data=ordered)
/dev/block/mmcblk1p2 on /data/media/Android type ext4 (rw,nosuid,nodev,noatime,barrier=1,data=ordered)
/dev/block/mmcblk1p2 on /data/app type ext4 (rw,nosuid,nodev,noatime,barrier=1,data=ordered)
/dev/block/mmcblk1p2 on /data/data type ext4 (rw,nosuid,nodev,noatime,barrier=1,data=ordered)
As you can see, mmcblk1p2, the external storage, is mounted to /data/app, /data/data and /data/media/Android, which means that as far as Android is concerned, those folders are in the external storage. Also note that all these mounts took place before /sdcard itself was mounted, meaning that the script is ensuring that these mounts take place soon enough in the boot process to avoid problems related to mounting the app storage locations after Android has loaded the available apps.
Finally, the fact that mmcblk0p12 is mounted to /mnt/temp/data is important because of the next two commands
The output of du -sh shows the amount of storage used by a folder, and as such because the internal storage is mounted to /mnt/temp/data;
/mnt/temp/data/app = internal /data/app = 8KB
/mnt/temp/data/data = internal /data/data = 72KB
/mnt/temp/data/media/Android = internal /data/media/Android = 4KB
whereas
/data/app = 1GB
/data/data = 624.3 MB
/data/media/Android = 5.6 GB
For a grand total of 7.22 GB of used app storage in the external storage as opposed to 84 KB in the internal storage.
CREDITS
*smaw51 - Testing
*ArangeLTX - Testing and Debugging
*Laggan - Testing
*aadiflesher - Testing
*Others who tested the script but weren't in direct contact with me.
*People who said it wasn't possible to run widgets, launchers and keyboards from External Storage (They provided the challenge I needed to make this work)
If anybody needs help or if anything doesn't work, I'll help through irc (much quicker than posting here) on freenode - #and-host
UPDATES:
09-26-2012: Major Update, Overhauled most of previous code.
09-27-2012: Found badass typo in one of the files, fixed and uploaded correction.
09-27-2012: Added install Script.
10-02-2012: Corrected install script so that things now run properly. Don't forget to double check USER_OPTIONS and set ENABLED=true
10-02-2012: Added MMCBLKXPX variable to user options so now devices that mount SD-EXT to different block can use script easily.
10-03-2012: More fixes to the install script, also added check for storage location as well as user input. Started working on compatibility for devices where /sdcard/Android is in different partition from /data
10-03-2012: Updated this post with more organized information.
10-04-2012: Modified script so that debugging output works properly in JB
10-05-2012: Finished working on compatibility for devices with /sdcard and /data in different partitions (PENDING TESTING)
10-05-2012: Added automatic detection for such devices ^ (New variable is automatically created in USER_OPTIONS, called fukedupFS)
10-05-2012: Added extra security for $deletepostmove (Will not take effect until stage 3 is detected)
10-05-2012: Added switch on install script to do a clean install, (using sh ./install-a2sd -clean) which will erase all current options/vars and reset stage to 0.
WARNINGS:
1 - PROCEED WITH THE FOLLOWING STEPS AT YOUR OWN RISK. IF ANYTHING BREAKS I'LL GLADLY TRY TO HELP (IF I CAN), BUT YOU DO WHAT YOU DO AT YOUR OWN RESPONSIBILITY.
2 - THE INSTALLATION SCRIPT REQUIRES USER INPUT, WHICH MEANS THAT IT CANNOT BE MADE INTO A RECOVERY ZIP. DO NOT BOTHER TO ASK FOR ONE. IF YOU CAN'T LEARN HOW TO USE THE TERMINAL, THEN JUST STICK TO OTHER SUCKY APP2SD SOLUTIONS.
3 - THIS SCRIPT IMPLEMENTS INIT.D BY DEFAULT, IF YOU ALREADY HAVE INIT.D FUNCTIONALITY MAKE SURE TO CHANGE:
Code:
/system/bin/logwrapper busybox run-parts /system/etc/init.d
TO
Code:
# /system/bin/logwrapper busybox run-parts /system/etc/init.d
IN THE B]sysinit[/B] FILE.
4 - THIS SCRIPT IMPLEMENTS INIT.A, WHICH IS ESSENTIALLY LIKE INIT.D, BUT HAPPENS EXTREMELY EARLY AT BOOT TIME, IT IS SUGGESTED THAT REGULAR USERS DO NOT PUT ANY SCRIPTS IN INIT.A UNLESS THEY KNOW WHAT THEY'RE DOING, JUST USE INIT.D FOR OTHER SCRIPTS.
5 - UPDATE YOUR BUSYBOX TO THE LATEST VERSION (1.20.2 AT THE WRITING OF THIS). SOME EARLIER VERSIONS OF BUSYBOX ARE KNOWN TO NOT HAVE SOME OF THE REQUIRED SWITCHES FOR THE COMMANDS USED IN THE SCRIPT.
6 - AT THIS POINT THE SCRIPT REQUIRES THAT YOU HAVE A SECOND PARTITION IN YOUR MICROSD FORMATTED TO EXT4, ANYTHING ELSE WILL NOT WORK. THIS MAY CHANGE IN THE FUTURE, BUT AT THIS POINT IT'S A REQUIREMENT.
7 - FULLY READ THE INSTALLATION INSTRUCTIONS, MORE THAN ONCE IF POSSIBLE, BEFORE RUNNING THE SCRIPT. FAILING TO COMPREHEND WHAT'S GOING ON CAN POSSIBLY LEAVE YOUR DEVICE SEMI-BRICKED/CAUSE MAJOR HAVOC AND FORCE-CLOSES AND YOU'LL HAVE TO RESTORE A BACKUP. MORE THAN ANYTHING MAKE SURE TO BACKUP YOUR APPS.
INSTALLATION:
1 - Download the attached file on your device or PC.
2 - Extract the files and move it to an easy to access location in your device, such as /sdcard. Open USER_OPTIONS and ensure that all variables correctly apply to your device, LEAVE deletepostmove='false' until later. Set ENABLED='true' once you're reviewed everything.
3 - Open a terminal app (Rom Toolbox and such probably won't work because the script requires user input)
4 - Assuming that you moved all 6 files to /sdcard, execute the following commands in the terminal:
Code:
su
cd /sdcard
sh ./install-a2sd
You can also perform a clean install by using the command:
Code:
sh ./install-a2sd -clean
5 - The script will ask a couple of questions, answer them (ask someone for help if you're not sure).
6 - If all went well (The script will tell you that folders were created, files were copied and permissions were set) you'll be told that upon pressing enter your device will be rebooted. Press ENTER when ready or reboot manually if it fails to reboot on its own.
7 - STAGE 1 - NOTHING WILL HAVE NOTICIABLY CHANGED UPON THE FIRST REBOOT. This is normal. The first reboot will only garther many variables needed for the script to run properly, it will also give the opportunity to review the variables and ensure that everything is ok, so that you can disable the script in case the gathered variables are not correct, so that things don't get broken unecessarily. Please take a look at:
Code:
/sdcard/Tweaked.Scripts/A2SD/options/vars
If all looks good in there (even if you don't understand what the variables are for, ensure that the paths make sense, don't worry if you don't have /mnt/sd-ext and /mnt/temp, or /storage/sd-ext and /storage/temp as these will be created).
Reboot again after reviewing the variables.
8 - STAGE 2 - ONCE AGAIN, WHEN YOU REBOOT, NOTHING WILL APPEAR TO HAVE HAPPENED. In fact, this is not the case this time. If all variables were correct in STAGE 1, every app along with their data and files will have started to be copied over to the external storage as soon as the device finished booting. You should be able to see the process for this by opening the terminal and running the command:
Code:
logcat | busybox grep "01a2sd"
You can also run the following command in the terminal to ensure that there are extra mounts that did not exist prior:
Code:
mount
***THIS IS THE MOST IMPORTANT STEP IN THE PROCESS. MAKE SURE THAT YOU DO NOT REBOOT YOUR DEVICE UNTILL THE FOLLOWING FILE IS CREATED:
Code:
/sdcard/Tweaked.Scripts/A2SD/DEVICE_IS_READY
Failing to do so is the single worst mistake that you can do. Rebooting the device before the copying is done might cause all your apps to look like they're not installed, as well as major FCs, to the point where stuff is unusable and you have to restore a backup.
Just be patient during this step, specially if you already have a lot of apps installed, even more so if you have games that use a large amount of space.
9 - STAGE 3 - After rebooting from STAGE 2, the device will mount the external storage in every location where apps would reside in the internal storage. This is why it's extremely important that STAGE 2 is completed properly, because unless everything has been moved properly, files that were not copied will seem like they don't exist, possibly causing FCs and major havoc.
If everything went ok, it will actually look like nothing happened, but in fact, everything should be running from the external storage. You can confirm this by running the following command in the terminal:
Code:
mount
You should see three mounts that weren't there before that look like
Code:
/dev/block/mmcblk1p2 on /data/media/Android type ext4 (rw,nosuid,nodev,noatime,barrier=1,data=ordered)
/dev/block/mmcblk1p2 on /data/app type ext4 (rw,nosuid,nodev,noatime,barrier=1,data=ordered)
/dev/block/mmcblk1p2 on /data/data type ext4 (rw,nosuid,nodev,noatime,barrier=1,data=ordered)
At this point, it should be safe to open USER_OPTIONS in /sdcard/Tweaked.Scripts/A2SD/options and change deletepostmove='true'. Just remember that with this variable set on, all your apps will be wiped from external storage. This means that if you reboot without your MicroSD or if you lose the stuff in the MicroSD your alls will be gone. Becase of this, ensure that you have your apps backed up somewhere.
TweakerL said:
To install, download attached file (then rename it to 01a2sd) or copy code and save it to (01a2sd).
Copy the file to /system/etc/init.d (Can be done with any file manager that has root access)
Change permission to 755 (Can be done with most file managers with root access)
Change Options in script to your liking.
Enjoy the extra storage after reboot.
Code:
#! /system/bin/sh
########################################################################################################
########################################################################################################
## ##
## Super APP2SD by TweakerL ##
## Visit us at http://and-host.com ##
## Chat with us on freenot at #and-host ##
## ##
########################################################################################################
########################################################################################################
export PATH=/sbin:/system/sbin:/system/bin:/system/xbin
########################################################################################################
## Options #############################################################################################
## ##
## Feel free to change these: ##
## ##
## moveAndroid: Moves /sdcard/Android to external storage. ##
## moveApps: Not yet implemented ##
## moveData: Not yet implemented ##
## ##
## deletepostmove: If 'true ' Deletes files from internal storage after they have been moved. ##
## ##
## pruneoldlogs: If 'true' Deletes logs older than X hours set in prunehoursold. ##
## prunehoursold: If 'X' greater than 0 logs older than X hours will be deleted ##
## If 'X' equal 0 all logs will be deleted ##
## ##
## debugging: If 'true' files will be created in /sdcard for debugging purposes ##
## ##
moveAndroid='true' ##
##
deletepostmove='true' ##
##
pruneoldlogs='true' ##
prunehoursold='1' ##
##
debugging='false' ##
########################################################################################################
########################################################################################################
## Constants ###########################################################################################
## ##
## Don't touch these unless you're told to by someone who knows what they're doing: ##
## ##
append_android='/Android' ##
append_data='/data' ##
append_obb='/obb' ##
append_ext4='/ext4' ##
append_tweaked='/Tweaked.Scripts' ##
append_movethis='/movethis.txt' ##
append_temp='/temp' ##
append_media='/media' ##
append_A='A' ##
append_logs='/logs' ##
##
data='/data' ##
########################################################################################################
########################################################################################################
if [ -f /sbin/busybox -o -f /system/sbin/busybox -o -f /system/xbin/busybox -o -f /system/bin/busybox ]
then
has_busybox='true'
fi
if busybox blkid | busybox egrep -i "mmcblk1p2" > /dev/null
then
has_mmcblk1p2='true'
fi
if busybox blkid | busybox egrep -i "mmcblk1p2" | busybox awk '{print $4}' | busybox cut -f2 -d'"' > /dev/null
then
is_ext4='true'
fi
if [ $has_busybox == 'true' -a $has_mmcblk1p2 == 'true' -a $is_ext4 == 'true' ]
then
# DEBUGGING
# Get vars part 1
if [ $debugging == 'true' ]
then
set > /sdcard/vars.1
fi
# END DEBUGGING
# Start defining functions
makedir () {
if [ ! -d $1 ]
then
busybox mkdir -p $1
fi
busybox chmod $2 $1
busybox chown $3:$4 $1
}
# End defining functions
mnt_sd=$( busybox mount | busybox egrep -i '/sdcard' | busybox awk '{print $3}' )
mnt=$( busybox dirname $mnt_sd )
sd_uid=$( busybox ls -ln $mnt_sd | busybox egrep -i "Android" | busybox awk '{print $3}' )
sd_gid=$( busybox ls -ln $mnt_sd | busybox egrep -i "Android" | busybox awk '{print $4}' )
blk_ext4=$( busybox ls -lR /dev | busybox egrep -i "mmcblk1p2 ->" | busybox awk '{print $11}' )
blk_data=$( busybox mount | busybox egrep -m 1 '/data' | busybox awk '{print $1}' )
mnt_ext4=$mnt$append_ext4
ext_data=$mnt_ext4$data
ext_android=$ext_data$append_android
mnt_temp=$mnt_ext4$append_temp
temp_android=$mnt_temp$append_media$append_android
datetime=$( busybox date -Iseconds )
sd_android=$mnt_sd$append_android
sd_tweaked=$mnt_sd$append_tweaked
tweaked_logs=$sd_tweaked$append_logs
txt_movethis=$sd_tweaked$append_movethis
makedir $sd_tweaked 775 $sd_uid $sd_gid
data_media=$( busybox dirname $( busybox find /data -type d -follow -name 'Tweaked.Scripts' ) )
data_android=$data_media$append_android
data_uid=$( busybox ls -lnd $data | busybox awk '{print $3}' )
data_gid=$( busybox ls -lnd $data | busybox awk '{print $4}' )
android_uid=$( busybox ls -ln $data_media | busybox egrep -i "Android" | busybox awk '{print $3}' )
android_gid=$( busybox ls -ln $data_media | busybox egrep -i "Android" | busybox awk '{print $4}' )
# DEBUGGING
# Get vars part 2
if [ $debugging == 'true' ]
then
set > /sdcard/vars.2
busybox diff /sdcard/vars.1 /sdcard/vars.2 | busybox grep "+" | busybox egrep -v "@|_=" > /sdcard/vars.txt
fi
# END DEBUGGING
busybox chmod 775 $sd_tweaked
busybox chown $android_uid:$android_gid $sd_tweaked
makedir $tweaked_logs 775 $sd_uid $sd_gid
echo 'Logging Started' > $tweaked_logs/a2sd-$datetime.log
echo '' >> $tweaked_logs/a2sd-$datetime.log
busybox mount -o remount,rw /
makedir $mnt_ext4 775 $data_uid $data_gid
busybox mount $blk_ext4 $mnt_ext4
sleep 1
makedir $mnt_temp 775 $data_uid $data_gid
busybox mount $blk_data $mnt_temp
sleep 1
makedir $ext_data 775 $data_uid $data_gid
makedir $ext_android 775 $android_uid $android_gid
busybox mount -o bind $ext_android $data_android
sleep 3
busybox mount -o remount,ro /
if [ $moveAndroid == 'true' ]
then
busybox find $temp_android -type f -follow -print > $txt_movethis
fi
if [ $moveAndroid == 'true' ]
then
echo 'Copying files from internal storage to external storage\n' >> $tweaked_logs/a2sd-$datetime.log
while read line
do
source=$line
destappend=$append_A$( echo "$line" | busybox cut -f2-100 -d'A' )
dest=$ext_android/$destappend
destfolder=$( busybox dirname $dest )
if [ ! -f "$dest" ]
then
if [ ! -d "$destfolder" ]
then
busybox mkdir -p "$destfolder"
fi
busybox cp -pdf "$source" "$dest"
if [ -f "$dest" ]
then
echo -e $source'\ncopied to\n'$dest'\n' >> $tweaked_logs/a2sd-$datetime.log
else
echo -e 'Failed to copy: '$source'\n' >> $tweaked_logs/a2sd-$datetime.log
fi
else
echo -e 'Already exists: '$dest'\n' >> $tweaked_logs/a2sd-$datetime.log
fi
if [ $deletepostmove == 'true' ]
then
if [ -f "$dest" ]
then
busybox rm -f "$line"
if [ ! -f "$line" ]
then
echo -e 'deletepostmove = true - Deleted: '$source'\n' >> $tweaked_logs/a2sd-$datetime.log
echo -e '____________________________________________________________ ' >> $tweaked_logs/a2sd-$datetime.log
else
echo -e 'Failed to delete: '$source'\n' >> $tweaked_logs/a2sd-$datetime.log
echo -e '____________________________________________________________ ' >> $tweaked_logs/a2sd-$datetime.log
fi
fi
fi
done < $txt_movethis
busybox rm -f $txt_movethis
busybox chmod -R 775 $ext_android/*
busybox chown -R $android_uid:$android_gid $ext_android/*
fi
busybox umount $mnt_temp
if [ $pruneoldlogs == 'true' ]
then
(( prunehours = ($prunehoursold * 60) ))
find $tweaked_logs -mmin +$prunehours -exec rm {} \;
echo "All logs older than "$prunehoursold" hours old have been deleted"
fi
echo -e '\nEnd of Log' >> $tweaked_logs/a2sd-$datetime.log
fi
Click to expand...
Click to collapse
Where to find premission? Please advice.
Sent from my GT-N8000 using xda app-developers app
andylam16 said:
Where to find premission? Please advice.
Sent from my GT-N8000 using xda app-developers app
Click to expand...
Click to collapse
use a root file browser then press and hold on the file, select permissions. Change to: Owner (rwx), group and other (rx)
Sent from my GT-N8013 using Tapatalk 2
My device doesn't have intI. D folder in system/Etc
I have to create new folder?
Rename the file without . Txt?
Sent from my GT-N8000 using Tapatalk 2
lm that guy said:
use a root file browser then press and hold on the file, select permissions. Change to: Owner (rwx), group and other (rx)
Sent from my GT-N8013 using Tapatalk 2
Click to expand...
Click to collapse
Thanks bro, is r = read , w = write , x = ???
Please advice.
Sent from my GT-N8000 using xda app-developers app
andylam16 said:
Thanks bro, is r = read , w = write , x = ???
Please advice.
Sent from my GT-N8000 using xda app-developers app
Click to expand...
Click to collapse
Execute
Sent from my GT-N8013 using Tapatalk 2
lm that guy said:
Execute
Sent from my GT-N8013 using Tapatalk 2
Click to expand...
Click to collapse
Got it, thanks!:thumbup:
Sent from my GT-N8000 using xda app-developers app
kaipro said:
My device doesn't have intI. D folder in system/Etc
I have to create new folder?
Rename the file without . Txt?
Sent from my GT-N8000 using Tapatalk 2
Click to expand...
Click to collapse
+1
fauzin said:
+1
Click to expand...
Click to collapse
I suggest this thread: http://forum.xda-developers.com/showthread.php?t=1883125
Sent from my GT-N8013 using Tapatalk 2
kaipro said:
My device doesn't have intI. D folder in system/Etc
I have to create new folder?
Rename the file without . Txt?
Sent from my GT-N8000 using Tapatalk 2
Click to expand...
Click to collapse
Check link in my sig for my other thread where you can get the init.d enabler.
After did the procedure as mentioned nothing happened the apps still go to the scared not the external. Please advice anything I missed. Thanks
Sent from my GT-N8000 using xda app-developers app
---------- Post added at 10:54 AM ---------- Previous post was at 10:12 AM ----------
One more thing there is a file "99testinit" inside the init.d , do I need to anything about it?
Sent from my GT-N8000 using xda app-developers app
andylam16 said:
After did the procedure as mentioned nothing happened the apps still go to the scared not the external. Please advice anything I missed. Thanks
Sent from my GT-N8000 using xda app-developers app
---------- Post added at 10:54 AM ---------- Previous post was at 10:12 AM ----------
One more thing there is a file "99testinit" inside the init.d , do I need to anything about it?
Sent from my GT-N8000 using xda app-developers app
Click to expand...
Click to collapse
Exactly same as me.
Sent from my GT-N8000 using Tapatalk 2
If you guys read everything, this is still an early version. At the moment, only /sdcard/Android is getting moved, which is the location that stores extra files downloaded by apps, not the apps themselves. If the script is running, you can go on terminal and type:
Code:
df -h
and you should see mmcblk1p2 (which is the ext4 partition in the MicroSD) and how much space is being used, which is the amount of space that should be getting saved from the internal storage. Also, if you look under storage under settings, the amount of space available should have increased considerably, specially if you have a lot of games.
I'll be working on the other two parts throughout this week (moving APK and DATA) Then you will be able to notice a bigger difference, although it will always look like apps are installed in the internal storage, even when they're in the external storage.
The reason for this is because the script works by mounting the external storage to:
/data/app (not yet implemented)
/data/data (not yet implemented)
/data/media/Android (already implemented)
while at the same time copying the contents of those locations from internal to external then wiping them from internal. Essentially when it's all said and done, the OS pretty much thinks that nothing has changed, except that whenever anything gets written to those folders it takes space from the external storage instead of internal.
A good way to test it would be to download a free gameloft game like MIB3 or Six Guns. Take a look at storage before installing. After you install MIB3, your available storage should drop by roughly 500MB, but if you're using the script, even at preview stage, the available storage will only drop by about 30MB, even though storage settings will say that the game takes up ~500MB.
Also, you can mount your normal data partition and take a look at how much space is being used there, as opposed to the external partition like this:
(All the following commands in terminal)
make sure which partition is mounted to /data
# mount
mount data to temp location (assuming data is mmcblk0p12)
# mount /dev/block/mmcblk0p12 /mnt/ext4/temp
check amount of space used in internal storage:
# du -dh /mnt/ext4/temp/media/Android
check amount of space used in external storage
# du -dh /mnt/ext4/data/Android
In the future I'll add to the script a way to automatically calculate the amount of space saved
The script itself is not working. Init.d is working, did rename the file and changed permission. I use script manger and try to run the script but it's got error,
Sent from my GT-N8000 using xda app-developers app
htainlin said:
The script itself is not working. Init.d is working, did rename the file and changed permission. I use script manger and try to run the script but it's got error,
Sent from my GT-N8000 using xda app-developers app
Click to expand...
Click to collapse
I'm gonna be uploading a new version soon with more debugging so I can see why people might have issues.
EDIT - Done updating OP
Is there any recommendations for the partition other than ext4, like swap size and what not? I also assume a reboot is required in order to get it to run right? I am still getting insufficient storage available when updating apps in the play store. I was getting that error before, even though I have plenty of space, like more than 10 gb on the internal memory so I don't know if it is just a batch update issue on the play store with my note for whatever reason. But even individual updates stop with an insufficient storage error.
I have tried using both the attached file in the op as well as the copy and paste method. The file should have no extension once in place right?
It seems as though it is still not working right
I have init.d working, confirmed with the test file and your method, Busybox installed, partitions with 0 swap and 1024 size at ext4
I have not been able to locate a log created, where is it dumped to to see if it is even running the script?
EDIT: never-mind, I figured out why my stuff was't updating but still able to add new apps, in rom tool box, I set it to install to sd card after most of my apps were already put on the internal memory. Just switched it to auto and it fixed it up
smaw51 said:
Is there any recommendations for the partition other than ext4, like swap size and what not? I also assume a reboot is required in order to get it to run right? I am still getting insufficient storage available when updating apps in the play store. I was getting that error before, even though I have plenty of space, like more than 10 gb on the internal memory so I don't know if it is just a batch update issue on the play store with my note for whatever reason. But even individual updates stop with an insufficient storage error.
I have tried using both the attached file in the op as well as the copy and paste method. The file should have no extension once in place right?
It seems as though it is still not working right
I have init.d working, confirmed with the test file and your method, Busybox installed, partitions with 0 swap and 1024 size at ext4
I have not been able to locate a log created, where is it dumped to to see if it is even running the script?
EDIT: never-mind, I figured out why my stuff was't updating but still able to add new apps, in rom tool box, I set it to install to sd card after most of my apps were already put on the internal memory. Just switched it to auto and it fixed it up
Click to expand...
Click to collapse
Had a similar problem when i had the tf201, kept getting an error whenever playstore started installing an app after the initial download, and i had the same problem a couple of days ago with the note which i resolved by deleting all odex files in the data\apps folder, i used es file explorer, navigated to the app folder and did a search for 'odex', then deleted them, i can now install apps again
Dont know if this is the same issue as yours , and ive just now seen your edit, so i see youve resolved it, so no worries, hopefully our solutions will help out others
Edit: dont quote me but my particular issue i 'think' has something to do with titanium backup, so for those having 'inssuficient storage errorr' in the playstore AND you have titanium backup, this may help
It might be a restore from backup in general issue, after you mention you used titanium. I used my backup pro to restore apps and data from my tf 700 to the my note. Only halfsies worked but maybe that caused some issues.
This is going to be very nice one apk and data are enabled to move to sd
how do I know that I have ext4 in my SDcard? and if I dont have it , How do I make ext4 ?
Thanks

[Module] ts-binds (Abandoned)

ts-binds
ts-binds basically make use of “bind” parameter of the “mount” available in your Android environment
Development Abandoned!
This project has been abandoned. This is because I personally do not require ts-binds anymore. Refer announcement post here: https://forum.xda-developers.com/showpost.php?p=79150883&postcount=237
What does it do
Essentially, this "binding" method is widely used to save space on internal storage!
Derived from a very long-living trick for users who are struggling with the internal storage space available on their phones, while at the same time has the benefit of inserting an SD card, ts-binds will make use of already available functions on your device, to mirror a path to another path, effectively making both paths indistinguishable.
For example, if you mirror the `Download` folder on Internal with the `Stuff from Internet` folder on your SD Card, the same list of cat pictures will be shown on both directories when navigated via a file manager, and any changes will take effect on both paths but only the folder in the external path is physically modified.
This saves space because the files physically reside on the external storage instead of internal storage.
Further read
To maintain a similar "Description" of the module, I had to trim down the OP of the thread. There are a total of 3 places where I host the module's description To read documentation, please go to my website
Alternative modules with the same purpose
Magic Folder Binder (really advanced compared to this module!)
Magisk Foldermount (may be abandoned)
Links
Documentation
→ DOWNLOAD ZIPs (Also available in Magisk Repo)
GitHub
Changelogs
Verbose changelog for Magisk releases
Nice work!
Module has been accepted into the repository. Now it is available for install and update via Magisk.
Since the creation of this thread, there has been 4 newer versions, the latest being 1.0.4.
Hi @TechnoSparks!
I have the following problem:
I had set folder list line like this:
folderbind ogi "$sd/Ogi" "$int/Ogi"
and after reboot my log file looks like this:
Log initialised at: Sat Aug 12 19:50:30 CEST 2017
2017-08-12 19:50:30:
Difference found between cached and original user list
2017-08-12 19:50:30:
Updated cached list
2017-08-12 19:50:30:
sdcard 7788-9789 mounted
2017-08-12 19:50:30:
Binding all entries
2017-08-12 19:50:31:
Bind aborted: Folder '/mnt/media_rw/7788-9789/Ogi' as source doesn't exist!
2017-08-12 19:50:31:
All entries were processed
2017-08-12 19:50:31:
Script execution completed
What could be wrong?
Thank you.
---------- Post added at 06:58 PM ---------- Previous post was at 06:57 PM ----------
ogisha said:
Hi @TechnoSparks!
I have the following problem:
I had set folder list line like this:
folderbind ogi "$sd/Ogi" "$int/Ogi"
and after reboot my log file looks like this:
Log initialised at: Sat Aug 12 19:50:30 CEST 2017
2017-08-12 19:50:30:
Difference found between cached and original user list
2017-08-12 19:50:30:
Updated cached list
2017-08-12 19:50:30:
sdcard 7788-9789 mounted
2017-08-12 19:50:30:
Binding all entries
2017-08-12 19:50:31:
Bind aborted: Folder '/mnt/media_rw/7788-9789/Ogi' as source doesn't exist!
2017-08-12 19:50:31:
All entries were processed
2017-08-12 19:50:31:
Script execution completed
What could be wrong?
Thank you.
Click to expand...
Click to collapse
BTW, both folders exist.
ogisha said:
Hi @TechnoSparks!
I have the following problem:
I had set folder list line like this:
folderbind ogi "$sd/Ogi" "$int/Ogi"
and after reboot my log file looks like this:
Log initialised at: Sat Aug 12 19:50:30 CEST 2017
2017-08-12 19:50:30:
Difference found between cached and original user list
2017-08-12 19:50:30:
Updated cached list
2017-08-12 19:50:30:
sdcard 7788-9789 mounted
2017-08-12 19:50:30:
Binding all entries
2017-08-12 19:50:31:
Bind aborted: Folder '/mnt/media_rw/7788-9789/Ogi' as source doesn't exist!
2017-08-12 19:50:31:
All entries were processed
2017-08-12 19:50:31:
Script execution completed
What could be wrong?
Thank you.
---------- Post added at 06:58 PM ---------- Previous post was at 06:57 PM ----------
BTW, both folders exist.
Click to expand...
Click to collapse
Hello
This seems to be a very odd issue, but it could be that ts-binds cannot access the folder via the hardcoded address of "/mnt/media_rw/". this is a perfect opportunity for me to troubleshoot this. Thank you for the report.
It would be great if you could run these commands (without the hashtags) on your terminal emulator and report back with the output (whether text or screenshots, your choice):
Code:
# if [ -d "/storage/7788-9789/Ogi" ]; then echo Exists; else echo Nope; fi
# ls -a1 /mnt
it would also be a great addition if you could copy the file "/proc/mounts" and attach it here.
And may I know what device are you using and the respective ROM version?
TechnoSparks said:
Hello
This seems to be a very odd issue, but it could be that ts-binds cannot access the folder via the hardcoded address of "/mnt/media_rw/". this is a perfect opportunity for me to troubleshoot this. Thank you for the report.
It would be great if you could run these commands (without the hashtags) on your terminal emulator and report back with the output (whether text or screenshots, your choice):
it would also be a great addition if you could copy the file "/proc/mounts" and attach it here.
And may I know what device are you using and the respective ROM version?
Click to expand...
Click to collapse
Commands' output:
HWEVA:/ $ su
HWEVA:/ # if [ -d "/storage/7788-9789/Ogi" ]; then echo Exisge/7788-9789/Ogi" ]; then echo Exists; else echo Nope ; fi <
Nope
HWEVA:/ # ls -a1 /mnt
.
..
appfuse
asec
expand
ext_sdcard
media_rw
obb
runtime
sdcard
secure
user
HWEVA:/ #
mounts file attached:
https://mega.nz/#!VF8wHIAb!hVPzmAVoBEWhLUehostkfb7kXOAELVA4iSsqMiooY3E
Device's information:
BOARD
EVA-L09
BOOTLOADER
unknown
BRAND
HUAWEI
CPU_ABI
arm64-v8a
DEVICE
HWEVA
DISPLAY
EVA-L09C432B386
FINGERPRINT
HUAWEI/EVA-L09/HWEVA:7.0/HUAWEIEVA-L09/C432B386:user/release-keys
HARDWARE
hi3650
HOST
wuhjk0154cna
ID
HUAWEIEVA-L09
MANUFACTURER
HUAWEI
MODEL
EVA-L09
PRODUCT
EVA-L09
SERIAL
MWS7N17104001072
TAGS
release-keys
TYPE
user
UNKNOWN
unknown
USER
test
CODENAME
REL
INCREMENTAL
C432B386
RELEASE
7.0
SDK_INT
24
RADIO
21.258.05.00.030
Root Access:
Access Granted
SU:
su found
UID/GID:
uid=0(root)
gid=0(root)
groups=0(root)
context=u:r:su:s0
Utils:
busybox
toybox
toolbox
Path:
/sbin:/vendor/bin:/system/sbin:/system/bin:/system/xbin:/system/vendor/bin:/vendor/xbin:/system/vendor/xbin:/product/bin:/product/xbin
Path:
/sbin/
Version:
13.3:MAGISKSU (topjohnwu)
Permissions:
rwxrwxrwx
Owner:
root:root
SELinux:
Enforcing
Path:
[/system/xbin/]
Permissions:
r-xr-xr-x
Owner:
root:shell
Thank you!
ogisha said:
Commands' output:
HWEVA:/ $ su
HWEVA:/ # if [ -d "/storage/7788-9789/Ogi" ]; then echo Exisge/7788-9789/Ogi" ]; then echo Exists; else echo Nope ; fi <
Nope
HWEVA:/ # ls -a1 /mnt
.
..
appfuse
asec
expand
ext_sdcard
media_rw
obb
runtime
sdcard
secure
user
HWEVA:/ #
mounts file attached:
https://mega.nz/#!VF8wHIAb!hVPzmAVoBEWhLUehostkfb7kXOAELVA4iSsqMiooY3E
Device's information:
BOARD
EVA-L09
BOOTLOADER
unknown
BRAND
HUAWEI
CPU_ABI
arm64-v8a
DEVICE
HWEVA
DISPLAY
EVA-L09C432B386
FINGERPRINT
HUAWEI/EVA-L09/HWEVA:7.0/HUAWEIEVA-L09/C432B386:user/release-keys
HARDWARE
hi3650
HOST
wuhjk0154cna
ID
HUAWEIEVA-L09
MANUFACTURER
HUAWEI
MODEL
EVA-L09
PRODUCT
EVA-L09
SERIAL
MWS7N17104001072
TAGS
release-keys
TYPE
user
UNKNOWN
unknown
USER
test
CODENAME
REL
INCREMENTAL
C432B386
RELEASE
7.0
SDK_INT
24
RADIO
21.258.05.00.030
Root Access:
Access Granted
SU:
su found
UID/GID:
uid=0(root)
gid=0(root)
groups=0(root)
context=u:r:su:s0
Utils:
busybox
toybox
toolbox
Path:
/sbin:/vendor/bin:/system/sbin:/system/bin:/system/xbin:/system/vendor/bin:/vendor/xbin:/system/vendor/xbin:/product/bin:/product/xbin
Path:
/sbin/
Version:
13.3:MAGISKSU (topjohnwu)
Permissions:
rwxrwxrwx
Owner:
root:root
SELinux:
Enforcing
Path:
[/system/xbin/]
Permissions:
r-xr-xr-x
Owner:
root:shell
Thank you!
Click to expand...
Click to collapse
EDIT: never mind, when i return from work today i will create an exclusive simple troubleshooting script for you! This is to ease the troubleshooting.
----
I have to say something weird is happening. The terminal should say the directory exists on the location i mentioned.
From the way you present your things, it seemed that you know what you are doing and is good with terminal. Could you report if you can "ls Ogi" when you changed the working directory to "/mnt/media_rw/7788-9789", "/storage/7788-9789" and "/mnt/ext_sdcard"?
Out of curiosity, I have seen issues in regards to sdcardfs with Magic Folder Binder module, and is wondering if your issue also has to do with it. Please run "grep sdcardfs /system/build.prop" and return me the output. Just some extra for fun note: My module isn't really ready to handle issues with sdcardfs and i may need to implement Magic Folder Binder's methods (persist off for build prop entry)
Also make sure the Ogi folder still exists tho lel ?
Sorry for having the commands not enclosed in the code tags. I am replying to this on the go
TechnoSparks said:
EDIT: never mind, when i return from work today i will create an exclusive simple troubleshooting script for you! This is to ease the troubleshooting.
Click to expand...
Click to collapse
Thanks. ?
--
I have to say something weird is happening. The terminal should say the directory exists on the location i mentioned. From the way you present your things, it seemed that you know what you are doing and is good with terminal. Could you report if you can "ls Ogi" when you changed the working directory to "/mnt/media_rw/7788-9789", "/storage/7788-9789" and "/mnt/ext_sdcard"?
--
Here comes the output:
HWEVA:/ $ su
HWEVA:/ # cd /mnt/media_rw/7788-9789
sh: cd: /mnt/media_rw/7788-9789: No such file or directory
2|HWEVA:/ # cd /storage/7788-9789
sh: cd: /storage/7788-9789: No such file or directory
2|HWEVA:/ # cd /mnt/ext_sdcard
HWEVA:/mnt/ext_sdcard # ls Ogi
HWEVA:/mnt/ext_sdcard #
BTW, both Ogi folders are empty.
--
Out of curiosity, I have seen issues in regards to sdcardfs with Magic Folder Binder module, and is wondering if your issue also has to do with it.
--
Magic Folder Binder did not work for me.
The developer was not interested in investigating the problem. ?
--
Please run "grep sdcardfs /system/build.prop" and return me the output. Just some extra for fun note: My module isn't really ready to handle issues with sdcardfs and i may need to implement Magic Folder Binder's methods (persist off for build prop entry)
--
Here comes the output:
HWEVA:/ $ su
HWEVA:/ # grep sdcardfs /system/build.prop
1|HWEVA:/ #
--
Also make sure the Ogi folder still exists tho lel ?
--
Yeah, both do and both are empty. ?
--
Sorry for having the commands not enclosed in the code tags. I am replying to this on the go
--
No problem at all. ?
Thank you. ?
ogisha said:
Thanks.
--
I have to say something weird is happening. The terminal should say the directory exists on the location i mentioned. From the way you present your things, it seemed that you know what you are doing and is good with terminal. Could you report if you can "ls Ogi" when you changed the working directory to "/mnt/media_rw/7788-9789", "/storage/7788-9789" and "/mnt/ext_sdcard"?
--
Here comes the output:
HWEVA:/ $ su
HWEVA:/ # cd /mnt/media_rw/7788-9789
sh: cd: /mnt/media_rw/7788-9789: No such file or directory
2|HWEVA:/ # cd /storage/7788-9789
sh: cd: /storage/7788-9789: No such file or directory
2|HWEVA:/ # cd /mnt/ext_sdcard
HWEVA:/mnt/ext_sdcard # ls Ogi
HWEVA:/mnt/ext_sdcard #
BTW, both Ogi folders are empty.
--
Out of curiosity, I have seen issues in regards to sdcardfs with Magic Folder Binder module, and is wondering if your issue also has to do with it.
--
Magic Folder Binder did not work for me.
The developer was not interested in investigating the problem.
--
Please run "grep sdcardfs /system/build.prop" and return me the output. Just some extra for fun note: My module isn't really ready to handle issues with sdcardfs and i may need to implement Magic Folder Binder's methods (persist off for build prop entry)
--
Here comes the output:
HWEVA:/ $ su
HWEVA:/ # grep sdcardfs /system/build.prop
1|HWEVA:/ #
--
Also make sure the Ogi folder still exists tho lel
--
Yeah, both do and both are empty.
--
Sorry for having the commands not enclosed in the code tags. I am replying to this on the go
--
No problem at all.
Thank you.
Click to expand...
Click to collapse
Thank you for the output. It seemed that I may have found the issue. My script unreliably pulled the wrong sdcard serial ID when the "grep"ing was run. In your mounts the line:
Code:
/dev/block/bootdevice/by-name/system /dev/magisk/dummy/system/bin/79b77788-9789-4a7a-a2be-b60155eef5f4.sec ext4 ro,seclabel,relatime,data=ordered 0 0
came first before the sdcard mounting line:
Code:
/dev/block/vold/public:179:193 /mnt/media_rw/7EB2-43FD vfat rw,dirsync,nosuid,nodev,noexec,relatime,uid=1023,gid=1023,fmask=0007,dmask=0007,allow_utime=0020,codepage=437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 0
The first line contains sequences of which matches my regular expression here:
Code:
sdname=$(grep -m 1 -Eo "[0-9A-F]{4}-[0-9A-F]{4}" /proc/mounts)
Possible fix: Reliably get the whole "media_rw" line before extracting SD card's serial
Please test the following pre-release: https://drive.google.com/file/d/0ByQKilNkFEpAaW02RGJoRUZGcUU/view?usp=sharing
TechnoSparks said:
Thank you for the output. It seemed that I may have found the issue. My script unreliably pulled the wrong sdcard serial ID when the "grep"ing was run. In your mounts the line:
came first before the sdcard mounting line:
The first line contains sequences of which matches my regular expression here:
Possible fix: Reliably get the whole "media_rw" line before extracting SD card's serial
Please test the following pre-release: https://drive.google.com/file/d/0ByQKilNkFEpAaW02RGJoRUZGcUU/view?usp=sharing
Click to expand...
Click to collapse
Thank you. I have tested it. Log file now looks like this:
-----
Log initialised at: Tue Aug 15 19:30:54 CEST 2017
2017-08-15 19:30:55:
Cached the user list
-----
Anything I copy to internal Ogi folder does not show up in external Ogi folder. ?
Thank you again. ??
ogisha said:
Thank you. I have tested it. Log file now looks like this:
-----
Log initialised at: Tue Aug 15 19:30:54 CEST 2017
2017-08-15 19:30:55:
Cached the user list
-----
Anything I copy to internal Ogi folder does not show up in external Ogi folder.
Thank you again.
Click to expand...
Click to collapse
Thank you for the report again and apologies for the new issue. I have able to pinpoint the issue and it seems to be a grammar error for bash.
I have corrected the issue and this is another test package for you to test: https://drive.google.com/open?id=0ByQKilNkFEpAaW02RGJoRUZGcUU
The reason why the content didn't show up was because no binding process were made. As you can see in the log, there is no "Binding all entries". Hopefully this one will finally squash the issue!
As you may notice, the "beta" also contains some changes, mainly just some cleanup and a new description.
TechnoSparks said:
Thank you for the report again and apologies for the new issue. I have able to pinpoint the issue and it seems to be a grammar error for bash.
I have corrected the issue and this is another test package for you to test: https://drive.google.com/open?id=0ByQKilNkFEpAaW02RGJoRUZGcUU
The reason why the content didn't show up was because no binding process were made. As you can see in the log, there is no "Binding all entries". Hopefully this one will finally squash the issue!
As you may notice, the "beta" also contains some changes, mainly just some cleanup and a new description.
Click to expand...
Click to collapse
Everything went fine according to log file.
Now Ogi folder on internal sdcard has disappeared and file 0 bytes long named Ogi appeared.
Folder Ogi on external sdcard stayed untouched.
Thanks again. ?
ogisha said:
Everything went fine according to log file.
Now Ogi folder on internal sdcard has disappeared and file 0 bytes long named Ogi appeared.
Folder Ogi on external sdcard stayed untouched.
Thanks again.
Click to expand...
Click to collapse
This is abnormal. For the first patch, I could blame myself for not testing it myself before publishing it to you. The reason was because i did a simple test on the terminal on nested command substitution ( $() ) and it worked, so I called it a job done. However I didn't expect it to not work if the nested command substitution is placed as a conditional, hence the past issue. The second revision fixed this by well, not using nested command substitution. The second version is personally tested and my folders are now binded correctly and working as expected like 1.0.4
Also, please tell me what file manager are you using.
I think this must have to do with the ROM or the kernel, since the modifications that I did to try to fix your previous issues was just related to how SD card serial ID is pulled. Let's check if the system recognises the folder via terminal.
Code:
cd /storage/emulated/0
ls -al | grep Ogi
check if the output is similar to this:
Code:
drwxrwx--x 1 root sdcard_rw 131072 2017-08-17 04:25 Ogi
Emphasis on the "drwxr-xr-x". If yours is similar, then continue below. Otherwise please report that it didnt.
Great! It seems that most probably it has something to do with the ROM, but not with the kernel. Next, I'd like for you to "cd" into it, then create a text file by running this simple line:
Code:
echo date > text.txt
Now, check if the text file exists on SD Card folder, by using a file manager.
TechnoSparks said:
This is abnormal. For the first patch, I could blame myself for not testing it myself before publishing it to you. The reason was because i did a simple test on the terminal on nested command substitution ( $() ) and it worked, so I called it a job done. However I didn't expect it to not work if the nested command substitution is placed as a conditional, hence the past issue. The second revision fixed this by well, not using nested command substitution. The second version is personally tested and my folders are now binded correctly and working as expected like 1.0.4
Also, please tell me what file manager are you using.
I think this must have to do with the ROM or the kernel, since the modifications that I did to try to fix your previous issues was just related to how SD card serial ID is pulled. Let's check if the system recognises the folder via terminal.
check if the output is similar to this:
Emphasis on the "drwxr-xr-x". If yours is similar, then continue below. Otherwise please report that it didnt.
Click to expand...
Click to collapse
I am using MiXplorer file manager. I had tried Total Commander, but results are the same.
Here is the output:
HWEVA:/ $ cd /storage/emulated/0
HWEVA:/storage/emulated/0 $ ls -al | grep Ogi
ls: ./Ogi: Cross-device link
1|HWEVA:/storage/emulated/0 $
Obviously, there is no text file. ?
BTW, when I delete Ogi file on internal sdcard, put folderbind line in folder list under comment and reboot, Ogi folder on internal sdcard reappears.
Great! It seems that most probably it has something to do with the ROM, but not with the kernel. Next, I'd like for you to "cd" into it, then create a text file by running this simple line:
Now, check if the text file exists on SD Card folder, by using a file manager.
Click to expand...
Click to collapse
Output:
1|HWEVA:/storage/emulated/0 $ cd Ogi
/system/bin/sh: cd: /storage/emulated/0/Ogi: Cross-device link
2|HWEVA:/storage/emulated/0 $ cd ./Ogi
/system/bin/sh: cd: /storage/emulated/0/Ogi: Cross-device link
2|HWEVA:/storage/emulated/0 $
Thank you for your patience.
ogisha said:
I am using MiXplorer file manager. I had tried Total Commander, but results are the same.
Here is the output:
HWEVA:/ $ cd /storage/emulated/0
HWEVA:/storage/emulated/0 $ ls -al | grep Ogi
ls: ./Ogi: Cross-device link
1|HWEVA:/storage/emulated/0 $
Obviously, there is no text file.
BTW, when I delete Ogi file on internal sdcard, put folderbind line in folder list under comment and reboot, Ogi folder on internal sdcard reappears.
Output:
1|HWEVA:/storage/emulated/0 $ cd Ogi
/system/bin/sh: cd: /storage/emulated/0/Ogi: Cross-device link
2|HWEVA:/storage/emulated/0 $ cd ./Ogi
/system/bin/sh: cd: /storage/emulated/0/Ogi: Cross-device link
2|HWEVA:/storage/emulated/0 $
Thank you for your patience.
Click to expand...
Click to collapse
Sorry for the length of time i took to reply. I have been busy
Hmm.. This is not a bug, but rather an incompatibility. Huge chances that your kernel may contain modifications different from the norm. But let's see if I can workaround from the current method, since the terminal says it's a cross-device link. For this, I need a single file /proc/mounts to be inspected. Can you hand me that file, please?
I am also assuming that your kernel does support binding folders (default and expected behaviour across linux kernels).
TechnoSparks said:
Sorry for the length of time i took to reply. I have been busy
Hmm.. This is not a bug, but rather an incompatibility. Huge chances that your kernel may contain modifications different from the norm. But let's see if I can workaround from the current method, since the terminal says it's a cross-device link. For this, I need a single file /proc/mounts to be inspected. Can you hand me that file, please?
I am also assuming that your kernel does support binding folders (default and expected behaviour across linux kernels).
Click to expand...
Click to collapse
Please see what you can do.
Mounts attached.
Thank you.
ogisha said:
Please see what you can do.
Mounts attached.
Thank you.
Click to expand...
Click to collapse
After a closer look, it seems that your device really does have sdcardfs turned on!
Let's use a simple buildprop entry to turn it off, hopefully it will work (although i know this seems so simple). You may use this new beta: https://drive.google.com/open?id=0ByQKilNkFEpAcmVxbkhsaUhSRHM
TechnoSparks said:
After a closer look, it seems that your device really does have sdcardfs turned on!
Let's use a simple buildprop entry to turn it off, hopefully it will work (although i know this seems so simple). You may use this new beta: https://drive.google.com/open?id=0ByQKilNkFEpAcmVxbkhsaUhSRHM
Click to expand...
Click to collapse
It still the same like previous.
Thank you.
ogisha said:
It still the same like previous.
Thank you.
Click to expand...
Click to collapse
Please try again with a newer version: https://drive.google.com/uc?id=0ByQKilNkFEpAcmVxbkhsaUhSRHM&export=download
TechnoSparks said:
Please try again with a newer version: https://drive.google.com/uc?id=0ByQKilNkFEpAcmVxbkhsaUhSRHM&export=download
Click to expand...
Click to collapse
Still not working. :crying:

[Q] How to debug soft brick (SONY logo)

I'm building my own LineageOS from source for a while now. Updating it via `repo sync`, adding own patches and rebuilding has always worked fine. Until recently the phone gets soft bricked, stuck at the SONY logo on white screen and I can't figure out why.
Now I'm looking for a way to find the issue, i.e. debug that brick, get some logs or anything which allows me to fix that. `adb logcat` doesn't work as it is stuck way to early for that.
What are my options for getting logs, messages, errors, anything that may help?
With help from @linckandrea I got the following to work which I document here for others to benefit:
1. Create a file `init.log.sh` with following content and executable permission
Bash:
#! /vendor/bin/sh
_date=`date +%F_%H-%M-%S`
logcat -b all -v time -f /cache/logcat_${_date}.txt &
cat /proc/kmsg > /cache/kmsg_${_date}.txt
2. Copy it to /vendor/bin e.g. via
Bash:
PRODUCT_COPY_FILES += $(PLATFORM_PATH)/config/init/init.log.sh:$(TARGET_COPY_OUT_VENDOR)/bin/init.log.sh
in the makefiles
3. Add the following to (any) init.rc, e.g. init.yoshino.rc:
Code:
service logx /vendor/bin/init.log.sh
user root
group root system
seclabel u:r:su:s0
oneshot
on post-fs
start logx
4. Either find a context with access to /cache (maybe "system_app") and use that in "seclabel" instead of "su" or disable SELinux with
Bash:
BOARD_KERNEL_CMDLINE += androidboot.selinux=permissive
This will dump kernel logs to /cache which can be accessed with e.g. TWRP after a failed boot.

Categories

Resources