Related
Links to Ubuntu 10.10 Image and Startup Script (around 1.5GB download):
NOTE: YOU NEED SPEEDMOD KERNEL FOR THE GALAXY S FOR THIS TO BOOT
OTHER USERS ENCOUNTERING ERRORS MAY LIKE TO TRY REMOVING "-o noatime" FROM ubuntu.sh OR RE-INSTALLING THE LATEST BUSYBOX
http://www.megaupload.com/?d=L9S70C8V
http://www.megaupload.com/?d=MS1KUUGW
http://www.megaupload.com/?d=YCMNO224
http://www.megaupload.com/?d=H6XZX9JB
MD5 Sums (in case any of the downloads corrupt)
b243ded14a3e7d96c12a752c1480e9f8 ubuntu.zip.001
e01f7934478062172a4c7a0a4a376b92 ubuntu.zip.002
76d69b740bfb2ddb9c0d26abca969b89 ubuntu.zip.003
567c842b8a9433535665353a26368338 ubuntu.zip.004
Open with 7Zip or similar to unzip.
{
"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"
}
What is this?
An ubuntu 10.10 maverick (with LXDE window manager) machine in your pocket. Perfectly usable from the phone itself using a VNC client, this allows you to install any ubuntu software onto your phone and have it with you always. Coupled with the (potential) ability for your phone to be hooked up to a television with TV Out (works with the Nokia TV Out cable available on eBay), and for (supposedly any) HID-compliant bluetooth keyboard and mouse to be linked up to the phone (requires Android 2.2), this really does become a PC in your pocket.
Requirements:
- android phone
- superuser + busybox
Included:
- 3.5GB virtual machine image (ubuntu.img) with ubuntu and certain applications pre-installed (listed below). The image is resizable with uec-resize-image, although FAT32 (the most likely format of your SD Card) has a maximum file size of <4GB.
- A script to boot into ubuntu from android (ubuntu.sh)
- A script to start the VNC Server and other startup commands. This is contained within the ubuntu.img file at /root/init.sh, accessible and modifiable once ubuntu.img has successfully booted.
How to boot:
- Place ubuntu.sh and ubuntu.img in the same directory in your SD storage.
- Enter a terminal and enter 'su' to become a superuser (root).
- Navigate to the directory where you placed the files (e.g. "cd /sdcard/external_sd/ubuntu").
- Execute the script by typing "sh ubuntu.sh".
Tip: Some android terminal emulators (e.g. better terminal) allow you to specify an initial command that is run as soon as you launch the application. Multiple initial commands can be defined by pressing return between each command when you define it, so for example the initial command:
su <return>
cd /sdcard/external_sd/ubuntu <return>
sh ubuntu.sh <return>
will boot you into ubuntu and start the VNC server as soon as you launch the terminal application. All that remains is to VNC into it before you can start using it.
Note: I have noticed that some android apps with process/activity management options (e.g. Spare Parts) possibly interfered with the running of Ubuntu and would kill "inactive" shell emulators (even when they were just idling) - thus killing the idling ubuntu environment. Also, I found it to be at its most stable after a fresh reboot of the phone.
How to connect:
Once you have booted the image (see instructions above), you simply need to fire up your VNC client of choice (androidVNC or pocketcloud VNC are good options), and simply add a new VNC server with address localhost, port 5900, and password 'ubuntu' - then hit connect.
- androidVNC has the advantage of pinch to zoom and generally feels nicer - set colour to 24bpp when adding the connection, and Input mode to touchpad once connected (this sometimes resets and needs re-doing at the start of a session).
- pocketcloud VNC has the advantage that no intermediate text input window is required when doing text input and may be preferred by some people.
- It has been suggested that the Dingul hangul keyboard is good for direct access to common command line characters such as / and * etc. It is however in Korean but can be set to use a QWERTY keyboard.
What software is pre-installed?
Base System (with all updates as of 19/02/11:
Ubuntu 10.10 (Maverick) Core
LXDE (Lightweight Windows-like GUI) with tightvnc server.
Applications (with all updates as of 19/02/11):
Firefox, Thunderbird, openoffice.org suite, GIMP Image Editor, Emacs Text Editor (geared towards programming), C and C++ build-essential, Java JDK, Python, TeXlive and TeXmaker LaTeX editor, Transmission BitTorrent Client, eVince PDF Viewer, File Manager, Terminal, Image Viewer, Leafpad Text Editor, Synaptic Package Manager and Ubuntu Software Center with all repositories enabled (Ubuntu Software Center is pretty and well organized - but bloated and slow), SSH server, Gnash (GNU flash player/plugin for Firefox - as there is no official generla flash pluging for armel CPUs)..
Obviously, you are free to add and remove apps as you see fit (through Synaptic or Ubuntu Software Center)..
I hope people find this useful, and that it works without too many problems.
Martin Rhodes ([email protected], fire314 @ XDA).
Note: If anyone ends up creating a custom ubuntu.img using rootstock, remember to create the directory /data/local/tmp within it as this is where the linux system will be expecting to find its temporary directory if booted (chroot'd) from android - and it is not there by default.
Ok so say I want to call my girlfriend or text her. Will it include GSM/3G, or do I have to use regular Android for that? And Android won't be gone? I have a Galaxy Tab. Really want something different than Android on it, but I want it to function as a phone aswell, since it's my primary phone
I'm from Norway btw Don't know if that matters.
the 4th link doesnt work could you post another ? thanx
imazighen said:
the 4th link doesnt work could you post another ? thanx
Click to expand...
Click to collapse
Same here.
Can you please post the ubuntu.sh only?
Ty.
Edit:
Here another howto, with a working link:
http://nexusonehacks.net/nexus-one-hacks/how-to-install-ubuntu-on-your-nexus-oneandroid/
I'm very interested.
How much space i need in the sdcard?
And..Can you rescue the link from megaupload?
Thank
I am also very interested in this but am also unable to download the fourth file. I checked out the link provided by ttf above but that version will take a little too much work for me.
Thanks
Now link are working. I'm downloading
"Please wait while booting ubuntu.img this can take some time..."
I'm stuck.
EDIT: Sorry..But this is my error. I'm waiting for a confirmation message but there isn't. After i tried to connect VNC and it works!.
How can i shoutdown Ubuntu now?
that's interesting. I use Ubuntu both at work and home, so I would surely love this
@Syntex123 - You VNC (Remote Desktop) to the Ubuntu FROM your android device, so basically, you access it through a VNC Client on your android, just like any other app - you can switch back and forth between android apps (including of course the one that you make calls from etc.)
I believe there are numerous threads on ubuntu for the galaxy tab, just search "ubuntu on galaxy tab" in the forum search bar.
@Legolas - the file is 3.5GB, but can be resized from within another Linux machine using uec-resize-image. To shut it down, just type 'exit' in the terminal emulator that you started it from and wait.
@ Everyone
The fourth link not working is a general megaupload.com error probably caused due to heavy load. Try again later if you experience it..
Cheers.
ubuntu.sh below:
#!/bin/sh
##################################################################
# Ubuntu/LXDE bootscript for Samsung Galaxy S (and others) #
##################################################################
# by Martin Rhodes (fire314)- [email protected] #
# compiled with trial and error and help from a number of blogs. #
# credits: coralic, David Jensen, debdroid, blog commenters, XDA #
# Tested on Ultimate 7.0 and Darky 9.3 #
###########################################################################
# to re-enable error output, remove the " > /dev/null 2>&1" from commands #
###########################################################################
echo "WARNING: If you have more than 255 apps installed on the SDCard, then mounting the ubuntu.img will fail!"
echo
echo "Apps on the SDCard associate with an encrypted loop device, and there are only 256 available to the system."
echo
echo "You have to go to Settings -> Manage Applications -> On SDCard, and move some apps back to phone storage in order to free up a loop device for ubuntu. Make sure you reboot the phone after doing this, then try again."
echo
echo "Please wait while booting ubuntu.img.. This can take some time..."
echo
###################################################################################
# export environment variables #
###################################################################################
export HOME=/root
export USER=root
export PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:$PATH
export TERM=vt100
###################################################################################
########################################################
# make directories required by the chroot environment #
########################################################
busybox mkdir /data/local/mnt > /dev/null 2>&1
busybox mkdir /data/local/mnt/proc > /dev/null 2>&1
busybox mkdir /data/local/mnt/sys > /dev/null 2>&1
busybox mkdir /data/local/mnt/dev > /dev/null 2>&1
busybox mkdir /data/local/mnt/dev/pts > /dev/null 2>&1
busybox mkdir /data/local/mnt/sdcard > /dev/null 2>&1
busybox mkdir /data/local/mnt/external_sd > /dev/null 2>&1
########################################################
###########################################################
# create a loop far, far away and mount ubuntu.img on it #
###########################################################
busybox mknod /dev/block/loop255 b 7 255 > /dev/null 2>&1
busybox losetup /dev/block/loop255 ./ubuntu.img > /dev/null 2>&1
busybox mount -o noatime /dev/block/loop255 /data/local/mnt > /dev/null 2>&1
###########################################################
######################################################################
# mount the phone's sdcard storage so it's accessible from ubuntu #
######################################################################
busybox mount -o bind /sdcard /data/local/mnt/sdcard > /dev/null 2>&1
busybox mount -o bind /sdcard/external_sd /data/local/mnt/external_sd > /dev/null 2>&1
#######################################################################
#################################################################
# mount linux system on our chroot environment and chroot to it #
#################################################################
busybox mount -t proc proc /data/local/mnt/proc > /dev/null 2>&1
busybox mount -t devpts devpts /data/local/mnt/dev/pts > /dev/null 2>&1
busybox mount -t sysfs sysfs /data/local/mnt/sys > /dev/null 2>&1
busybox chroot /data/local/mnt /root/init.sh > /dev/null 2>&1
#################################################################
#########################################
# chroot exited: umount everything #
#########################################
echo
echo "Exiting chroot environment and sync'ing memory to storage.."
echo "DO NOT EXIT until finished - doing so may corrupt the ubuntu.img!"
echo
busybox sync
busybox umount -f /data/local/mnt/sys > /dev/null 2>&1
busybox umount -f /data/local/mnt/dev/pts > /dev/null 2>&1
busybox umount -f /data/local/mnt/proc > /dev/null 2>&1
busybox umount -f /data/local/mnt/sdcard > /dev/null 2>&1
busybox umount -f /data/local/mnt/external_sd > /dev/null 2>&1
##########################################
Yaa...Thank. It's perfectly work
Only one problem: i tried to resize the image with the tool said by you.
But every time i try:
uec-resize-image ubuntu.img 2G ubu.img
it gives me an error about "consistency" (or something like this)..Can you help me?.
(Hovewer..Very great work)
@fire314
Any chance to perform the same with backtrack distrib or a more minimalistic one?
What about doing the same with another "android rom img" as a virtual environment to test different roms? (i'm actually trying to do so)
Edit:
Thanks for the .sh
can you use wine on it to emulate windows programs?
pixiejoe said:
can you use wine on it to emulate windows programs?
Click to expand...
Click to collapse
I think it can be done
Yep - it's full blown Ubuntu so Wine will work fine! But because it's using VNC sound doesn't work...
well, mine doesent work
it just writes down all the messages and thats it dunno why
Maranevim said:
well, mine doesent work
it just writes down all the messages and thats it dunno why
Click to expand...
Click to collapse
Your CPU uses an ARM architecture. As far as I know, win32 binaries are compiled for x86 or x64 so you won't get any windows binaries running through wine on Linux on ARM.
In short: Wine won't help you run windows programs on your Galaxy.
I just tried to run ubuntu, and i got al the messages within a blink of a eye.
Then tried to connect using 2 VNC programs, and both couldn't connect.
So it's bugged, or it's fake.
mathijs727 said:
I just tried to run ubuntu, and i got al the messages within a blink of a eye.
Then tried to connect using 2 VNC programs, and both couldn't connect.
So it's bugged, or it's fake.
Click to expand...
Click to collapse
It work pretty well, i did it following this howto : http://nexusonehacks.net/nexus-one-hacks/how-to-install-ubuntu-on-your-nexus-oneandroid/
Took me a few minutes to figure this out, so I thought to share
This is taken from some scripts I use in CF-Root, you might need to change it slightly for other CWM3 kernels (like prefixing busybox to various commands, etc).
updater-script
Assumptions:
- rootfs is mounted as rw, so we can write temporary files anywhere (ram disk)
- you put a "myscript.sh" in the system folder inside the update
All this script does is extract whatever you have in update.zip/system folder to /tmp/update, and run the myscript.sh file.
Code:
ui_print("Extracting files ...");
package_extract_dir("system", "/tmp/update");
set_perm(0, 0, 0755, "/tmp/update/myscript.sh");
run_program("/tmp/update/myscript.sh");
myscript.sh
Assumptions:
- all busybox commands are symlinked in /sbin, this is usually the case for CWM3 kernels
Code:
#!/sbin/busybox sh
# get file descriptor for output
OUTFD=$(ps | grep -v "grep" | grep -o -E "update_binary(.*)" | cut -d " " -f 3);
# same as progress command in updater-script, for example:
#
# progress 0.25 10
#
# will update the next 25% of the progress bar over a period of 10 seconds
progress() {
if [ $OUTFD != "" ]; then
echo "progress ${1} ${2} " 1>&$OUTFD;
fi;
}
# same as set_progress command in updater-script, for example:
#
# set_progress 0.25
#
# sets progress bar to 25%
set_progress() {
if [ $OUTFD != "" ]; then
echo "set_progress ${1} " 1>&$OUTFD;
fi;
}
# same as ui_print command in updater_script, for example:
#
# ui_print "hello world!"
#
# will output "hello world!" to recovery, while
#
# ui_print
#
# outputs an empty line
ui_print() {
if [ $OUTFD != "" ]; then
echo "ui_print ${1} " 1>&$OUTFD;
echo "ui_print " 1>&$OUTFD;
else
echo "${1}";
fi;
}
# --- example usage ---
# empty line after "Extracting ..." from updater-script
ui_print;
# give the user some status
ui_print "doing something (1 of 4)";
# assume this won't take more than 30 seconds
progress 0.25 30;
# you'd do something useful here
sleep 15s;
# update status
ui_print "- done with something (1 of 4)";
# we're done, make sure the progress bar is at 25%
set_progress 0.25;
# empty line
ui_print;
# repeat this a few times ;)
ui_print "doing something (2 of 4)";
progress 0.25 30;
sleep 15s;
ui_print "- done with something (2 of 4)";
set_progress 0.50;
ui_print;
ui_print "doing something (3 of 4)";
progress 0.25 30;
sleep 15s;
ui_print "- done with something (3 of 4)";
set_progress 0.75;
ui_print;
ui_print "doing something (4 of 4)";
progress 0.25 30;
sleep 15s;
ui_print "- done with something (4 of 4)";
set_progress 1.00;
ui_print;
# done !
ui_print "done! rebooting!";
How, what, why ?
While updater-script is fine for a lot of things, like installing a new ROM and whatnot, anything sufficiently complicated still has to be done through shell scripts, because a great many things just cannot be easily done in edify. It's nice to be able to give the user some status when doing these operations. There are modded versions of CWM that make the same thing possible in other ways, like simply writing to STDOUT or STDERR. This requires either a custom update_binary or recovery binary, though.
This works because communication between recovery and update_binary is through a file descriptor (pipe). Recovery runs update_binary with the FD as command line parameter. Because the shell script is run as a child process of update_binary, it can write the same commands to that FD (commands recovery listens for), because child processes inherited FD numbers and access rights.
So, all the script has to do is figure out which FD to write to, and pass it the right commands. Finding the FD isn't difficult, as it is passed on the command line and so is listed in the output of ps. Some grep and cut magic retrieve it. See the OUTFD=$(...) line. The right commands are defined in the functions at the top.
Note: this is all taken from my rfs<=>ext4 conversion script for CF-Root/ext4. Slightly adjusted, hopefully it still works as expected
Enjoy!
Thank you chainfire
Sent from my GT-I9000 using Tapatalk
Thanks for this chainfire.
Precisely what I was looking for! You're my hero today, man!
Hi Chainfire
Thanks for your tricks, I'm using it for an almost bulletproof MTD flash script.
BTW, i'd like to call some set_perm commands. But set_perm isn't a recognized command for update-binary.
IDK if I'm clear.
Do you have some advise on that?
RolluS said:
BTW, i'd like to call some set_perm commands. But set_perm isn't a recognized command for update-binary.
Click to expand...
Click to collapse
I've sort this writing equivalent functions:
Code:
set_perm() { # same as set_perm command in updater-script, for example:
#
# set_perm 0 3003 02750 "/system/bin/netcfg"
#
# sets user:group to 0:3003 and perm to 02750 for the file /system/bin/netcfg
$CHOWN $1:$2 $4
$CHMOD $3 $4
}
set_perm_recursive() { # same as set_perm command in updater-script, for example:
#
# set_perm_recursive 0 2000 0755 0755 "/system/bin"
#
# sets uid:gid to 0:2000 and perm to 0755 for folders and 0755 for files recursively in /system/bin
$CHOWN -R $1:$2 $5
$CHMOD $3 $5
#chmod recursive of folder
$FIND $5/* -type d |while read folder; do
$CHMOD $3 $folder
done
#chmod recursive of files
$FIND $5/* -type f |while read file; do
$CHMOD $4 $file
done
}
There is no error handling (yet), so be carrefull when calling these functions
no FD, no output
Chainfire said:
This works because communication between recovery and update_binary is through a file descriptor (pipe). Recovery runs update_binary with the FD as command line parameter. Because the shell script is run as a child process of update_binary, it can write the same commands to that FD (commands recovery listens for), because child processes inherited FD numbers and access rights.
So, all the script has to do is figure out which FD to write to, and pass it the right commands. Finding the FD isn't difficult, as it is passed on the command line and so is listed in the output of ps. Some grep and cut magic retrieve it. See the OUTFD=$(...) line.
Click to expand...
Click to collapse
finding the FD is difficult on an SGY phone under MT 2.0 kernel, because is is not passed as command line param and therefore not in the ps output.
can anyone give an example of a working FD ?
the expression returns "" on my SGY, and no output is readable from script.
above zip as one file with the (.*) business removed from FD expression in myscript.sh
I don't see that ps gives me a "FD" in its output. whatever that really is. /tmp/recovery.log says that /sbin/recovery has no command line params either on SGY
from recov.log:
I:Set boot command "boot-recovery"
Command: "/sbin/recovery"
there is no FD in the command line ! where is it then ?
I'll test this in a bit. Nice hack b/w.
any news?
Thanks for this trick. What I wanted to do is to redirect stdout (and stderr) of my script to the UI. I know that you can see this in "show logs", but I wanted it to display right during the installation. Here is what I came up with:
Code:
#!/sbin/busybox ash
OUTFD=$(ps | grep -v "grep" | grep -o -E "update_binary(.*)" | cut -d " " -f 3);
/sbin/busybox ash $* 2>&1 |
while read -r line
do
echo "ui_print $line" >&$OUTFD;
echo "ui_print " >&$OUTFD;
done
If you save this as "scripts/stdoutwrapper.sh", you can do something like this:
Code:
package_extract_dir("scripts", "/tmp/update");
set_perm(0, 0, 0755, "/tmp/update/stdoutwrapper.sh");
run_program("/tmp/update/stdoutwrapper.sh", "/tmp/update/myscript.sh", "param1", "param2");
In myscript.sh, use any shell commands. The output will be redirected to the UI. Therefore, you should be able to write scripts that work both on the command line and in recovery without changes.
Please note: As all output will be printed, the tricks with set_progress etc. don't work. It would probably be possible to use a prefix to identify commands that should be executed, not printed, so you could do e.g. "echo '<#>set_progress 0.25'".
what value does OUTFD have? find out like below:
adb shell
ps
then /sbin/recovery might have PID 2166 on SGY phone
su
ls -l --color=never /proc/2166/fd
may give you e.g.
3 -> /dev/tty0
so 3 is your OUTFD !
now grep it accordingly for the script. use MT kernel 2.0 on SGY for above capability
time saver
edify Scripts may be tested by executing update-binary directly:
update-binary version output package
An example would be:
update-binary 2 stdout /sdcard/update.zip
Just noticed Chainfire's ui_print shell script in the latest SuperSU zip, and that lead me here.
Here are some updated versions (for CWM6?); ui_print and set_perm from SuperSU and the other 2 from my tinkering today:
Code:
OUTFD=$2;
ZIP=$3
ui_print() {
echo -ne "ui_print $1\n" > /proc/self/fd/$OUTFD;
echo -ne "ui_print\n" > /proc/self/fd/$OUTFD;
}
set_perm() {
chown $1.$2 $4
chown $1:$2 $4
chmod $3 $4
}
show_progress() { echo "progress $1 $2" > /proc/self/fd/$OUTFD; }
set_progress() { echo "set_progress $1" > /proc/self/fd/$OUTFD; }
ex:
show_progress 1.34 0;
ui_print "Hello world!";
set_progress 0.5;
ui_print " "; #blank line
set_progress 1.34;
ui_print "Done!";
Also worth noting he just uses busybox unzip to extract files from the flashable zip directly and goes from there.
ex:
ui_print "Extracting files!"
cd /tmp
unzip -o "$ZIP"
mai77 said:
what value does OUTFD have?
Click to expand...
Click to collapse
I put ui_print "Test: $OUTFD" in a script and the value of OUTFD appears to increase with every zip flashed.
Not much use knowing it in that case.
Nice work, I used this in my little zip. However, it doesn't work with TWRP. Is there any way to accomplish that?
sorry to put this here but could anyone direct me towards the cwm or TWRP version for "jxjpb" (asia) baseband pls?
klenamenis said:
Nice work, I used this in my little zip. However, it doesn't work with TWRP. Is there any way to accomplish that?
Click to expand...
Click to collapse
TWRP names the extracted update-binary "updater", so you can add something like this (or modify the regex in the existing line):
Code:
[ $OUTFD != "" ] || OUTFD=$(ps | grep -v "grep" | grep -o -E "updater(.*)" | cut -d " " -f 3)
_that said:
TWRP names the extracted update-binary "updater", so you can add something like this (or modify the regex in the existing line):
Code:
[ $OUTFD != "" ] || OUTFD=$(ps | grep -v "grep" | grep -o -E "updater(.*)" | cut -d " " -f 3)
Click to expand...
Click to collapse
Shouldn't be necessary with any reasonably current recovery. That was just a hack Chainfire wrote to get the FD back in the CWM3 days.
All that should be required (and has always worked for me) is to make the update-binary your shell script, then:
Code:
OUTFD=$2;
See my other updated commands above. And some zips I've made which should provide good references for people: Nexus Louder, Xposed Framework Installer, and Nexus BootUnlocker. All available in my Odds and Ends thread, linked in my sig.
osm0sis said:
Shouldn't be necessary with any reasonably current recovery. That was just a hack Chainfire wrote to get the FD back in the CWM3 days.
All that should be required (and has always worked for me) is to make the update-binary your shell script, then:
Code:
OUTFD=$2;
Click to expand...
Click to collapse
Yes, that works if you replace the whole update-binary with a shell script, but this method is for scripts that are called from the updater-script when using a binary updater.
I've recently switched to a shell script as updater too, but I had to write my own zip signing program because busybox unzip was unable to extract files from a zip signed by SignApk.
osm0sis said:
See my other updated commands above. And some zips I've made which should provide good references for people: Nexus Louder, Xposed Framework Installer, and Nexus BootUnlocker. All available in my Odds and Ends thread, linked in my sig.
Click to expand...
Click to collapse
Wow, nice collection! I remember some other posts from you that were very helpful, thanks!
_that said:
Yes, that works if you replace the whole update-binary with a shell script, but this method is for scripts that are called from the updater-script when using a binary updater.
I've recently switched to a shell script as updater too, but I had to write my own zip signing program because busybox unzip was unable to extract files from a zip signed by SignApk.
Wow, nice collection! I remember some other posts from you that were very helpful, thanks!
Click to expand...
Click to collapse
Nice! My misunderstanding then.
And ah yes, the old "1 and 8" issue with unzip. Might be resolved in the latest busybox 1.22.1 but I'm not 100% about that, and it'll be awhile before that makes it into recoveries.
I'd love to get hold of your zip signer if that'd be okay. I have Chainfire's solution, but I was still running into some verification problems (I think) from the MinSignApk whole file resigning.
osm0sis said:
And ah yes, the old "1 and 8" issue with unzip. Might be resolved in the latest busybox 1.22.1 but I'm not 100% about that, and it'll be awhile before it makes it into recoveries.
Click to expand...
Click to collapse
Exactly! I learned a lot about the zip format while researching this.
osm0sis said:
I'd love to get hold of your zip signer if that'd be okay. I have Chainfire's solution, but I was still running into some verification problems (I think) from the MinSignApk whole file resigning.
Click to expand...
Click to collapse
Argh! I saw your original question in that thread but I never found the solution because there were so many pages in between...
I ended up with a hack that appears to resemble Chainfire's minsignapk, but I didn't need to write my own zipadjust. Basically I simply sign the zip normally with signapk, then I unpack and repack the whole archive using 7zip (bonus: slightly better compression), and then I run the whole-zip-signer on the archive.
Here is my SignWholeFile.jar - the source code is just too ugly to publish. View attachment SignWholeFile.jar If you find that it works better than Chainfire's version, I'll clean the source and release it.
This is the script I use for signing:
Code:
#!/bin/sh
KEYDIR=~/android/aosp/build/target/product/security
SIGNAPK=~/android/aosp/prebuilts/sdk/tools/lib/signapk.jar
SIGNWHOLEFILE=~/android/src/signapk/SignWholeFile.jar
java -jar $SIGNAPK -w $KEYDIR/testkey.x509.pem $KEYDIR/testkey.pk8 "$1" "$1.signed.zip"
mv "$1" "$1.unsigned"
signedzip=$(readlink -f "$1.signed.zip")
[ -d /tmp/signapk2 ] && rm -rf /tmp/signapk2
mkdir /tmp/signapk2
pushd /tmp/signapk2
unzip $signedzip
rm $signedzip
7z a -r -mx=9 $signedzip *
#7z a -r $signedzip *
popd
mv "$1.signed.zip" "$1"
java -jar $SIGNWHOLEFILE $KEYDIR/testkey.x509.pem $KEYDIR/testkey.pk8 "$1" "$1"
Busybox Uninstaller v1.0 - Removes busybox and its +600 symlink files
It will backup all files before they are deleted + activity log written to sdcard
{
"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"
}
This is for Samsung phones only. Other phones need changes in sdcard mount position
Always do a nandroid backup before flashing anything.
Use at your own risk.
How to use - Flash from recovery method:
Download attached zip file from this post
Copy the file you downloaded to external sd card
Boot into stock recovery (volume up+home+power), and select "apply update from external storage". Now select the Busy_Box_Uninstaller_v1.0-signed.zip file downloaded above
If you use CWM Recovery, you can put the zip file in internal or external SD
Busybox will be completely removed with its +600 symlink files
Click to expand...
Click to collapse
How to use: run script in terminal:
This part does not apply for the beginners. If you don't understand this shell, use the recovery version attached
You can try the below shell script to run from terminal with root rights.
It just misses one line to remove the busybox main package at end of script. The attached zip will delete the package in updater-script rather than in the script. Either remove the busybox package manually when done or add the rm line at the end of script
Actual features:
This small script will remove busybox from /system/xbin and from /system/bin.
It will search and remove all symlinks installed in the above 2 folders. Those are over 600 files !
It will make a backup for each file before deleting it. Backups are located on the external sdcard.
If backup file fails (sdcard full), it will abort and last file that failed the backup will not be removed. You can just resume the process later when you fixed the free space issue for backup.
Backup in tar.gz format with path in filename for easier restore if needed.
Will not overwrite any files during backup.
Log file written in sdcard backup directory.
Number of files deleted displayed when done.
Click to expand...
Click to collapse
To come: Depending on demand and my time, I think at:
Search for busybox in all phone and sets path to look for symlinks to delete. However, not sure if it is welcome!
Date/Time stamped backup folder. No need to delete a previous backup to proceed with script.
Code cleaning (was a bit hard as android and busybox shell are very restrictive).
Click to expand...
Click to collapse
Below is the shell code base used for those who want to know or give ideas to enhance it. Keep in mind it is busybox shell, very limited compared to Bash...
Code included is to run in terminal and will put backup files to internal sdcard (recovery version will put the backup on external sd)
I could include another shell, but would make the zip file bigger in size
Also, did not rely on android built in shell (/bin/sh) to avoid variations depending on shell version with devices / kernels
Code:
#!/bin/sh
bkdir="/sdcard/bb-uninstall" ;
if [ -d "$bkdir" ] ;
then
busybox echo "Backup folder $bkdir already exists. Please remove it to proceed...">>$bkdir/__Error_Backup_Folder_Already_Exists__.txt ;
busybox echo "Backup folder \"$bkdir\" already exists. Please remove it to proceed..." ;
exit 1 ;
else
busybox mkdir $bkdir ;
if [ ! -d "$bkdir" ] ;
then
busybox echo "Backup folder \"$bkdir\" could not be created" ;
busybox echo "Check if sdcard is present, mounted, has free space or you have permissions!!" ;
exit 1 ;
fi ;
fi ;
bbdir="/system/xbin /system/bin" ;
ndeletes=0 ;
for bbpath in $bbdir ;
do
for f in $(busybox find $bbpath -type l) ;
do
gnr=$(busybox readlink $f) ;
if echo "$gnr" |busybox grep -q busybox ;
then
busybox echo -e "$f \t is linked to \t $gnr ---> backup up in sdcard then deleted">>$bkdir/bb-uninstall.log ;
bkfile=`busybox echo "$f" | busybox tr '/' '.'` ;
bkfile=bak$bkfile ;
busybox tar zcf $bkdir/$bkfile.tar.gz -C / ${f:1} ;
if [ ! -f "$bkdir/$bkfile.tar.gz" ] ;
then
busybox echo "Error while creating backup file \"$bkdir/$bkfile.tar.gz\"" ;
busybox echo "File \"$f\" was not deleted" ;
busybox echo "Check free space on \"$bkdir\" or if you have needed permissions" ;
busybox echo "Uninstall will stop. Launch it again after fixing write issue to \"$bkdir\"" ;
exit 1 ;
fi ;
busybox echo "$f linking to $gnr backed-up. Now deleting" ;
busybox rm $f ;
ndeletes=`busybox expr $ndeletes + 1` ;
else busybox echo "$f is not linked to busybox, but to $gnr ---> file not deleted">>$bkdir/bb-uninstall.log ;
fi ;
done
done
echo >>$bkdir/bb-uninstall.log ;
echo "=========================================">>$bkdir/bb-uninstall.log ;
echo " Busybox Uninstaller v1.0 Completed !! ">>$bkdir/bb-uninstall.log ;
echo "=========================================">>$bkdir/bb-uninstall.log ;
echo " - Details - ">>$bkdir/bb-uninstall.log ;
echo "Number of deleted files: $ndeletes">>$bkdir/bb-uninstall.log ;
echo "Busybox cleaned folders: \"$bbdir\"">>$bkdir/bb-uninstall.log ;
echo "Backup folder: \"$bkdir\"">>$bkdir/bb-uninstall.log ;
echo "Log file: \"$bkdir/bb-uninstall.log\"">>$bkdir/bb-uninstall.log ;
echo >>$bkdir/bb-uninstall.log ;
echo "=========================================">>$bkdir/bb-uninstall.log ;
echo "Brought to you by [email protected]">>$bkdir/bb-uninstall.log ;
echo "=========================================">>$bkdir/bb-uninstall.log ;
echo ;
echo "=========================================" ;
echo " Busybox Uninstaller v1.0 Completed !! " ;
echo "=========================================" ;
echo " - Details - " ;
echo "Number of deleted files: $ndeletes" ;
echo "Busybox cleaned folders: \"$bbdir\"" ;
echo "Backup folder: \"$bkdir\"" ;
echo "Log file: \"$bkdir/bb-uninstall.log\"" ;
echo ;
echo "=========================================" ;
echo "Brought to you by [email protected]" ;
echo "=========================================" ;
FAQ / Updates
To be completed
Done
Any feedback and ideas about the code is welcome
Thank you so much for ur work! Sorry I'm out of thnx today! will surely thank u 2morrow!
Been looking for this a long time!:victory:
The-Droidster said:
Thank you so much for ur work! Sorry I'm out of thnx today! will surely thank u 2morrow!
Been looking for this a long time!:victory:
Click to expand...
Click to collapse
Please give feedback here after you try it
Updated instructions for the beginners
Tried, everything ok. Thanks
Sent from my GT-I9100
But why ?
I m sorry to question you on this, but why would one want to remove busybox ? given that there are 600+ symlinks .. but what is the benefit / effects of removing it or NOT removing it ?
Knowing this would educate people as to why people people should do this... its a solid noob question which should be added to the OP FAQ/ description if you ask me ... no offense
nayak.aj said:
I m sorry to question you on this, but why would one want to remove busybox ? given that there are 600+ symlinks .. but what is the benefit / effects of removing it or NOT removing it ?
Knowing this would educate people as to why people people should do this... its a solid noob question which should be added to the OP FAQ/ description if you ask me ... no offense
Click to expand...
Click to collapse
When you install busybox in a folder, it creates about 328 symlinks in install folder (xbin often). Most cwm roms add to this a symlink for all commands to the bin folder.
Now, each busybox version comes with its active applets. You can end up with shortcuts installed by a previous version but that are not supported by the actual version.
At worst, some apps can have unpredictable behaviour. If link is removed, app will just end with a not found (also causing impredictable behaviour) . Actually, i never had any of these supposed issues, but why keep non working shortcuts in your system path?
This script is for people that tested so many web installers and busybox versions mainly. Flashing a full ROM in odin will clean it too.
Personally, when I change busybox version, i would use it to clean previous install. Why uninstall a program and leave hundreds of files?
Sent from my GT-I9100 using Tapatalk 2
Phil3759 said:
When you install busybox in a folder, it creates about 328 symlinks in install folder (xbin often). Most cwm roms add to this a symlink for all commands to the bin folder.
Now, each busybox version comes with its active applets. You can end up with shortcuts installed by a previous version but that are not supported by the actual version.
At worst, some apps can have unpredictable behaviour. If link is removed, app will just end with a not found (also causing impredictable behaviour) . Actually, i never had any of these supposed issues, but why keep non working shortcuts in your system path?
This script is for people that tested so many web installers and busybox versions mainly. Flashing a full ROM in odin will clean it too.
Personally, when I change busybox version, i would use it to clean previous install. Why uninstall a program and leave hundreds of files?
Sent from my GT-I9100 using Tapatalk 2
Click to expand...
Click to collapse
So to resume, this script exists just because it can be done and because someone, somewhere, somehow may someday need it.
perfect example you install a Rom it comes with all applets installed you check the busybox version and its old so you wish to remove all applets then install new busybox.
Sent from my GT-I9100 using Tapatalk 2
When I uninstall an app, I hate when it leaves folders and files around
And busybox around installers can leave up to +600 of such files in just 2 folders, and you can install elsewhere too
Now, a clean approach is to install busybox in a custom folder and add it to path. No trash over the system. However, some apps look for it selectively in system folders and not in path
nayak.aj said:
I m sorry to question you on this, but why would one want to remove busybox ? given that there are 600+ symlinks .. but what is the benefit / effects of removing it or NOT removing it ?
Knowing this would educate people as to why people people should do this... its a solid noob question which should be added to the OP FAQ/ description if you ask me ... no offense
Click to expand...
Click to collapse
Why would anyone want to leave 600 files on their phone if they dont need them?
karendar said:
So to resume, this script exists just because it can be done and because someone, somewhere, somehow may someday need it.
Click to expand...
Click to collapse
Plenty of people in plenty of places with issues arising from installing busybox from market many a day will need it
Sent from my GT-N7000 using xda app-developers app
This will come handy in the future. Thanks for this!
Hey congrats on your work.I have a problem if you can provide help:i flashed the uninstaller via stock recovery but after phone reboot wifi couldn't obtain ip adress.
Any help?
Invalid_GR said:
Hey congrats on your work.I have a problem if you can provide help:i flashed the uninstaller via stock recovery but after phone reboot wifi couldn't obtain ip adress.
Any help?
Click to expand...
Click to collapse
Can you attach the file here
Code:
/sdcard/bb-uninstall/bb-uninstall.log
Also, under that folder you have a backup of each deleted file, so keep it so you can restore if needed
Sounds like some files in system/bin were removed wrongly, but I doubt my script would do it as I tested it fully and I even include the specific temporary busybox needed for the script
Post the log file so I can see
Phil3759 said:
Can you attach the file here
Code:
/sdcard/bb-uninstall/bb-uninstall.log
Also, under that folder you have a backup of each deleted file, so keep it so you can restore if needed
Sounds like some files in system/bin were removed wrongly, but I doubt my script would do it as I tested it fully and I even include the specific temporary busybox needed for the script
Post the log file so I can see
Click to expand...
Click to collapse
First of all thanx for the quick responce.Here is the file you asked :
https://dl.dropbox.com/u/98804712/bb-uninstall.log
(sorry xda didn't allow me to upload a log file so dropbox it is)
Invalid_GR said:
First of all thanx for the quick responce.Here is the file you asked :
https://dl.dropbox.com/u/98804712/bb-uninstall.log
(sorry xda didn't allow me to upload a log file so dropbox it is)
Click to expand...
Click to collapse
Problem seems in your system toolbox symlinks hijacked by a bad busybox installer
Code:
/system/bin/cat is linked to /system/bin/busybox ---> backup up in sdcard then deleted
/system/bin/chmod is linked to /system/bin/busybox ---> backup up in sdcard then deleted
/system/bin/chown is linked to /system/bin/busybox ---> backup up in sdcard then deleted
/system/bin/date is linked to /system/bin/busybox ---> backup up in sdcard then deleted
/system/bin/dd is linked to /system/bin/busybox ---> backup up in sdcard then deleted
/system/bin/df is linked to /system/bin/busybox ---> backup up in sdcard then deleted
/system/bin/dmesg is linked to /system/bin/busybox ---> backup up in sdcard then deleted
/system/bin/hd is linked to /system/bin/busybox ---> backup up in sdcard then deleted
/system/bin/id is linked to /system/bin/busybox ---> backup up in sdcard then deleted
/system/bin/ifconfig is linked to /system/bin/busybox ---> backup up in sdcard then deleted
/system/bin/insmod is linked to /system/bin/busybox ---> backup up in sdcard then deleted
/system/bin/ionice is linked to /system/bin/busybox ---> backup up in sdcard then deleted
/system/bin/kill is linked to /system/bin/busybox ---> backup up in sdcard then deleted
/system/bin/ln is linked to /system/bin/busybox ---> backup up in sdcard then deleted
/system/bin/ls is linked to /system/bin/busybox ---> backup up in sdcard then deleted
/system/bin/lsmod is linked to /system/bin/busybox ---> backup up in sdcard then deleted
/system/bin/mkdir is linked to /system/bin/busybox ---> backup up in sdcard then deleted
/system/bin/mount is linked to /system/bin/busybox ---> backup up in sdcard then deleted
/system/bin/mv is linked to /system/bin/busybox ---> backup up in sdcard then deleted
/system/bin/netstat is linked to /system/bin/busybox ---> backup up in sdcard then deleted
/system/bin/printenv is linked to /system/bin/busybox ---> backup up in sdcard then deleted
/system/bin/ps is linked to /system/bin/busybox ---> backup up in sdcard then deleted
/system/bin/renice is linked to /system/bin/busybox ---> backup up in sdcard then deleted
/system/bin/rm is linked to /system/bin/busybox ---> backup up in sdcard then deleted
/system/bin/rmdir is linked to /system/bin/busybox ---> backup up in sdcard then deleted
/system/bin/rmmod is linked to /system/bin/busybox ---> backup up in sdcard then deleted
/system/bin/route is linked to /system/bin/busybox ---> backup up in sdcard then deleted
/system/bin/sleep is linked to /system/bin/busybox ---> backup up in sdcard then deleted
/system/bin/sync is linked to /system/bin/busybox ---> backup up in sdcard then deleted
/system/bin/top is linked to /system/bin/busybox ---> backup up in sdcard then deleted
/system/bin/touch is linked to /system/bin/busybox ---> backup up in sdcard then deleted
/system/bin/umount is linked to /system/bin/busybox ---> backup up in sdcard then deleted
/system/bin/uptime is linked to /system/bin/busybox ---> backup up in sdcard then deleted
All these entries should have been kept linked to toolbox instead of busybox. But, probbaly some third party busybox installer (market installers, a ROM you installed...) linked them to busybox without resetting toolbox links
So, as they are linked to busybox, they got deleted and you end up with a corrupted toolbox installation
Try this below script:
Code:
#!/system/bin/sh
toolbox ln -s /system/bin/toolbox /system/bin/cat
toolbox ln -s /system/bin/toolbox /system/bin/chmod
toolbox ln -s /system/bin/toolbox /system/bin/chown
toolbox ln -s /system/bin/toolbox /system/bin/date
toolbox ln -s /system/bin/toolbox /system/bin/dd
toolbox ln -s /system/bin/toolbox /system/bin/df
toolbox ln -s /system/bin/toolbox /system/bin/dmesg
toolbox ln -s /system/bin/toolbox /system/bin/hd
toolbox ln -s /system/bin/toolbox /system/bin/id
toolbox ln -s /system/bin/toolbox /system/bin/ifconfig
toolbox ln -s /system/bin/toolbox /system/bin/insmod
toolbox ln -s /system/bin/toolbox /system/bin/ionice
toolbox ln -s /system/bin/toolbox /system/bin/kill
toolbox ln -s /system/bin/toolbox /system/bin/ln
toolbox ln -s /system/bin/toolbox /system/bin/ls
toolbox ln -s /system/bin/toolbox /system/bin/lsmod
toolbox ln -s /system/bin/toolbox /system/bin/mkdir
toolbox ln -s /system/bin/toolbox /system/bin/mount
toolbox ln -s /system/bin/toolbox /system/bin/mv
toolbox ln -s /system/bin/toolbox /system/bin/netstat
toolbox ln -s /system/bin/toolbox /system/bin/printenv
toolbox ln -s /system/bin/toolbox /system/bin/ps
toolbox ln -s /system/bin/toolbox /system/bin/renice
toolbox ln -s /system/bin/toolbox /system/bin/rm
toolbox ln -s /system/bin/toolbox /system/bin/rmdir
toolbox ln -s /system/bin/toolbox /system/bin/rmmod
toolbox ln -s /system/bin/toolbox /system/bin/route
toolbox ln -s /system/bin/toolbox /system/bin/sleep
toolbox ln -s /system/bin/toolbox /system/bin/sync
toolbox ln -s /system/bin/toolbox /system/bin/top
toolbox ln -s /system/bin/toolbox /system/bin/touch
toolbox ln -s /system/bin/toolbox /system/bin/umount
toolbox ln -s /system/bin/toolbox /system/bin/uptime
Copy paste it in a sh file using notepad++ with EOL Conversion set to unix format and run it in a su terminal
If complicated for you, use attached file:
- download toolbox_fix.txt
- rename it to toolbox_fix.sh (do not open it or edit it in windows notepad or it will be corrupted)
- put it in /system/bin in your phone using a program like root explorer (you have to mount /system as rw in root explorer)
- in root explorer, long press the file name and select to change permissions, check all boxes there
- save settings
- open terminal and type:
Code:
su
sh /system/bin/toolbox_fix.sh
Now, reboot and all should be fine
If not, in terminal type:
Code:
su
ls -l /system/bin >/sdcard/ls_log.txt
And attach here the ls_log file you will find in root of your sdcard
Please report back if this fixed your issue. If it is the case (which I am quiet sure), I will edit my uninstaller script to automatically make these symlinks for people in situations like you
Once again thanx for your help.Yeah i used a market bustbox installer..Before i try anything could you please make clear what exactly i must do in the last step when you say "open terminal" sorry if it's noob level question..
Invalid_GR said:
Once again thanx for your help.Yeah i used a market bustbox installer..Before i try anything could you please make clear what exactly i must do in the last step when you say "open terminal" sorry if it's noob level question..
Click to expand...
Click to collapse
Download this application from market and install it:
https://play.google.com/store/apps/details?id=jackpal.androidterm
Then, open it (it is the terminal)
Then, you type the 2 commands line in code I told you
Do not forget to mount /system as rw in root explorer and set file permissions like described above
HTC One M8.
I have done HTCdev with http://htc-one.wonderhowto.com/how-to/unlock-bootloader-root-your-htc-one-m8-0154444/
then rooted
Then did S-OFF with http://firewater-soff.com/instructions/
Then, to be able to write to /system, you need more steps. From recovery, it works easily. From live running system, the default stock ROM has a write protection. This WP can be removed easily by loading a kernel module:
http://forum.xda-developers.com/showthread.php?t=2701816
then:
Code:
insmod /mnt/sdcard/Download/wp_mod_m8.ko
mount -o remount,rw /system
Now, I want to run random scripts.
First, check if the stock ROM has the same issue as my previous phone:
Code:
[email protected]_m8:/ # echo $PATH
/sbin:/vendor/bin:/system/sbin:/system/bin:/system/xbin:/vendor/bin
[email protected]_m8:/ # ls -l /system/sbin
/system/sbin: No such file or directory
1|[email protected]_m8:/ #
That's exactly what we need: a folder that is in PATH, that does not exist, and should exist somewhere we can create it. So:
Code:
insmod /mnt/sdcard/Download/wp_mod_m8.ko
mount -o remount,rw /system
mkdir /data/local/bin
ln -s /data/local/bin/ /system/sbin
Then, create two small scripts in there: do vi /system/sbin/vibrate , then i to enter insert mode, paste this code, esc, :x ... or use any other editor if you want:
Code:
#!/system/xbin/ash
#
i="$1"
[ "$i" = "" ] && i=400
# default value for voltage_level at boot is 3100 mV.
v=3100
vmin=1200
[ $i -gt 0 ] 2>/dev/null || {
echo "Invalid argument '$i'; should be a number below 9999 ms."
exit 1
}
[ $i -gt 9999 ] && {
echo "Invalid argument '$i'; should be below 9999 ms."
exit 1
}
[ "$2" != "" ] && {
[ $2 -ge $vmin ] 2>/dev/null || {
echo "Invalid argument '$2'; should be a number between $vmin and ${v} mV."
exit 1
}
[ $2 -gt $v ] && {
echo "Invalid argument '$2'; should be below ${v} mV."
exit 1
}
}
[ "$i" = "" ] && { echo "Provide argument: time in ms." ; exit 1 ; }
[ "$2" = "" ] && {
echo "Voltage not provided. Using default $v mV."
} || {
v=$2
echo "Using voltage argument $v mV."
}
echo $v > /sys/devices/virtual/timed_output/vibrator/voltage_level
echo "$i" > /sys/devices/virtual/timed_output/vibrator/enable
It was an old code for HTC Sensation; voltage does not work anymore, but duration does.
A shorter script for flash, and create the init script:
Code:
echo "echo 255 > /sys/class/leds/flashlight/brightness" > /system/sbin/flashlight
echo "#!/system/bin/sh
# /system/etc/init.qcom.bt.sh
/data/local/bin/vibrate
/system/sbin/flashlight" > /data/local/bin/rc.init
chmod 755 /system/sbin/flashlight
chmod 755 /system/sbin/vibrate
chmod 755 /data/local/bin/rc.init
Now, the tricky part: make the init script run at boot. Edit /system/etc/init.qcom.bt.sh , and below the comment, insert this line:
Code:
/data/local/bin/rc.init &
Reboot, enjoy Your phone flashes and vibrates at boot. As is, this is almost useless. But, now you can create system scripts, and run them at boot ... you can do pretty much anything you do on a classic Linux machine.
Because scripts are put in a folder which is in the default system $PATH, all apps or widgets can run those scripts. This vibrate script can be called for example from a Tasker or ScriptManager widget.
I love vibrate, because it's a small noise; I tail it to any command that is likely to take more than 1mn to run. Having a ScriptManager widget running it also helps me check the system load. If phone seems slow, and vibration does not happen at once, then the phone has big load, and I shall wait for things to settle.
/system/etc/init.qcom.bt.sh was not a random choice. To understand why: open /init.target.rc , and now, search a script that is run ... at boot ... with user root ... and that lays in /system. Many scripts are run as user, or stored outside /system.
Now, it's up to you to create scripts that are usefull to you.
Hey thanks for the directions but I tried running the command mnt/sdcard/download/wp_mod.ko and I got a "failed exec format error"....
rgolnazarian said:
Hey thanks for the directions but I tried running the command mnt/sdcard/download/wp_mod.ko and I got a "failed exec format error"....
Click to expand...
Click to collapse
This is completely unrelated and offtopic. Either your file does not have exec bit, or wrong interpreter, or stored on partition that has noexec.
Hmmm ... why is the quoted message different from the one I received by email ???
Any way, even if you are in /, "mnt/sdcard/download/wp_mod.ko" is an invalid command. A module can not be executed, it must be inserted; see tutos about it.
I've seen lots of people saying its not possible to make the shield an all in one solution for downloading, but after hours of tinkerering I've got a semi easy way of running the above services (and tons more) from the shield. This does requrie a bit of command line-fu , but I think I've got most of the hard work done. When its all said and done, we'll have a working entware-ng installation ( https://github.com/Entware-ng/Entware-ng)
--This guide is a work in progress, there are a few other items I'll add that will improve user experience, but as it stands now it should work as intended. I also haven't gotten a samba config to work yet, so if anyone can figure it out, let me know and I'll update a section on it
I've addapted this guide from a few github projects , but that likely means some commands/steps are actually useless on the shield:
https://github.com/erichlf/AndroidSeedBox
(will add other sources later)
AS ALWAYS MAKE A BACKUP OF DATA -- I AM NOT RESPONSIBLE IF YOUR DEVICE LOSES DATA (to my knowledge, there is no risk of bricking your device doing this, at worst a factory reset/reflash)
Pre-reqs:
Shield has to have ROOT
ADB set up on PC
Busybox : http://www.apkmirror.com/apk/jrummy-apps-inc/busybox-for-android/
Rom Toolbox Lite : Not on apk mirror, so side load from your favorite place
For this process, I recommend having your shield next to your computer, and share inputs with your monitor. You can do 90% of it from an ADB shell, but a few parts you will need to use a terminal on the shield itself, and keyboard is way easier than controller
Install Busybox on the shield, but use the oldest version available (I think the wget for 1.26 messes with the process)
run "ADB Shell" and run these commands on the shield (You can copy/paste multiple lines into the cmd window):
Code:
su
mount -o rw,remount /
ls /data/entware-ng >/dev/null 2>&1 || mkdir /data/entware-ng
cd .; ln -s /data/entware-ng /opt
ls /data/entware-ng/rootbin >/dev/null 2>&1 || mkdir /data/entware-ng/rootbin
cd .; ln -s /data/entware-ng/rootbin /bin
ls /data/entware-ng/rootlib >/dev/null 2>&1 || mkdir /data/entware-ng/rootlib
cd .; ln -s /data/entware-ng/rootlib /lib
ls /data/entware-ng/tmp >/dev/null 2>&1 || mkdir /data/entware-ng/tmp
cd .; ln -s /data/entware-ng/tmp /tmp
ls /data/entware-ng/home >/dev/null 2>&1 || mkdir /data/entware-ng/home
ls /data/entware-ng/home/root >/dev/null 2>&1 || mkdir /data/entware-ng/home/root
ls /data/entware-ng/home/user >/dev/null 2>&1 || mkdir /data/entware-ng/home/user
chmod 0755 /data/entware-ng/home/root
chown root.root /data/entware-ng/home/root
chmod 0755 /data/entware-ng/home/user
We've set up our staging area, and created a new home directory.
Now lets install Entware
Code:
ls /data/entware-ng/bin >/dev/null 2>&1 || mkdir /data/entware-ng/bin
ls /data/entware-ng/lib >/dev/null 2>&1 || mkdir /data/entware-ng/lib
ln -s /system/bin/sh /bin/sh
wget http://pkg.entware.net/binaries/armv7/installer/entware_install.sh -O /data/entware-ng/entware_install.sh
sh /data/entware-ng/entware_install.sh
Now lets install a new Busybox and Wget
Code:
/opt/bin/opkg install busybox
/opt/bin/opkg install wget
cd /bin; ln -s /data/entware-ng/bin/busybox sh
cd /bin; ln -s /data/entware-ng/bin/busybox echo
cd /bin; ln -s /data/entware-ng/bin/busybox rm
cd /bin; ln -s /data/entware-ng/bin/busybox rmdir
cd /bin; ln -s /data/entware-ng/bin/busybox sed
cd /bin; ln -s /data/entware-ng/bin/busybox mkdir
cd /bin; ln -s /data/entware-ng/bin/busybox head
cd /bin; ln -s /data/entware-ng/bin/busybox sort
cd /bin; ln -s /data/entware-ng/bin/busybox dirname
cd /bin; ln -s /data/entware-ng/bin/busybox ln
cd /bin; ln -s /data/entware-ng/bin/busybox mv
cd /bin; ln -s /data/entware-ng/bin/busybox cat
cd /bin; ln -s /data/entware-ng/bin/busybox chown
cd /bin; ln -s /data/entware-ng/bin/busybox chmod
cd /bin; ln -s /data/entware-ng/bin/busybox pgrep
This next step may be optional. Sets up resolv.conf (which may already exist, I'm not sure) and mtab (I don't know what this is)
Code:
echo nameserver 8.8.8.8 >/data/entware-ng/etc/resolv.conf
ls /etc >/dev/null 2>&1 || mkdir /etc
mount -o rw,remount /system
ls /etc/resolv.conf >/dev/null 2>&1 && rm /etc/resolv.conf
cd .; ln -s /data/entware-ng/etc/resolv.conf /etc/resolv.conf
cd .; ln -s /proc/mounts /etc/mtab
Create Passwd file
Code:
echo root:x:0:0:root:/opt/home/root:/bin/sh >/data/entware-ng/etc/passwd
echo shell:x:2000:2000:shell:/opt/home/user:/bin/sh >>/data/entware-ng/etc/passwd
cd .; ln -s /data/entware-ng/etc/passwd /etc/passwd
echo root:x:0:root >/data/entware-ng/etc/group
echo shell:x:2000:shell >>/data/entware-ng/etc/group
cd .; ln -s /data/entware-ng/etc/group /etc/group
echo /bin/sh > /etc/shells
echo PATH=/usr/bin:/usr/sbin:/bin:/sbin:/system/sbin:/system/bin:/system/xbin:/system/xbin/bb:/data/local/bin > /etc/profile
echo export PATH >> /etc/profile
OPTIONAL: If you want to use Open SSH with password instead of certs you can do the following step. I have done this, and haven't noticed any issues, but it may lessen the security of Root
Code:
/data/entware-ng/bin/busybox passwd root
Now let's create a script that will initialize Entware-ng after reboot
Code:
echo \#\!/system/bin/sh > /data/entware-ng/entware-init.sh
echo mount -o rw,remount rootfs / >> /data/entware-ng/entware-init.sh
echo ln -s /data/entware-ng /opt >> /data/entware-ng/entware-init.sh
echo ln -s /data/entware-ng/rootlinb /lib >> /data/entware-ng/entware-init.sh
echo ln -s /data/entware-ng/rootbin /bin >> /data/entware-ng/entware-init.sh
echo ln -s /data/entware-ng/tmp /tmp >> /data/entware-ng/entware-init.sh
echo ln -s /system/bin/sh /bin/sh >> /data/entware-ng/entware-init.sh
echo mount -o ro,remount rootfs >> /data/entware-ng/entware-init.sh
chmod 755 /data/entware-ng/entware-init.sh
Now lets create a start script that calls the initialize script we just made, but also returns a shell in the new environment
Code:
echo \#\!/system/bin/sh > /data/entware-ng/start.sh
echo ls '/opt >/dev/null 2>&1 ||' su -c /data/entware-ng/entware-init.sh >> /data/entware-ng/start.sh
echo export PATH=/opt/sbin:/opt/bin:/opt/rootbin:/opt/local/bin:/system/bin >> /data/entware-ng/start.sh
echo if busybox test $(busybox id -u) = 0; then HOME=/opt/home/root; else HOME=/opt/home/user; fi >> /data/entware-ng/start.sh
echo export HOME >> /data/entware-ng/start.sh
echo '/opt/etc/init.d/rc.unslung start' >> /data/entware-ng/start.sh
echo /bin/sh >> /data/entware-ng/start.sh
chmod 755 /data/entware-ng/start.sh
Now, lets install different services. These are optional, and there are tons more, but this will get transmission/sickbeard/ssh going
Code:
PATH=/data/entware-ng/bin:/bin /data/entware-ng/bin/opkg install vim
PATH=/data/entware-ng/bin:/bin /data/entware-ng/bin/opkg install samba36-server
PATH=/data/entware-ng/bin:/bin /data/entware-ng/bin/opkg install transmission-web transmission-daemon-openssl
PATH=/data/entware-ng/bin:/bin /data/entware-ng/bin/opkg install python
PATH=/data/entware-ng/bin:/bin /data/entware-ng/bin/opkg install python-setuptools
PATH=/data/entware-ng/bin:/bin /data/entware-ng/bin/opkg install python-pip
PATH=/data/entware-ng/bin:/bin /data/entware-ng/bin/opkg install python-cheetah
PATH=/data/entware-ng/bin:/bin /data/entware-ng/bin/opkg install openssh-server
Copy the start.sh and sysinit to the home environment
Code:
cp /data/entware-ng/start.sh /data/entware-ng/home/root/start.sh
cp /data/entware-ng/start.sh /data/entware-ng/home/root/sysinit
chown root.root /data/entware-ng/home/root/start.sh
chmod 755 /data/entware-ng/home/root/start.sh
chown root.root /data/entware-ng/home/root/sysinit
chmod 755 /data/entware-ng/home/root/sysinit
mount -o ro,remount /
mount -o ro,remount /system
Start the new environment
Code:
sh /data/entware-ng/home/root/sysinit
SICKBEARD CONIG
Install a few pre-reqs for sickbeard
Code:
pip install transmissionrpc
pip install cherrypy
Create a file in init.d to allow sickbeard to start on reboot. Please note, you will need to change the path to where your sickbeard directory is.
I'm not going to cover setting up sickbeard, there are other guides for that. I did find that it couldn't be bound to 0.0.0.0 , or local host, it needed to be hard coded for the shields IP, so I recommend setting it up as a static IP in your router.
Code:
echo PATH=/opt/bin:/opt/sbin:$PATH > /opt/etc/init.d/S96sickbeard
echo /opt/bin/python <YOUR PATH TO>/SickBeard.py -d --port 8081 >> /opt/etc/init.d/S96sickbeard
chmod 755 /opt/etc/init.d/S96sickbeard
chmod +x /opt/etc/init.d/S96sickbeard
OPENSSH CONFIG
OPTIONAL - If you want to use SSH we need to generate keys
Code:
ssh-keygen -f /opt/etc/ssh/ssh_host_rsa_key -N '' -t rsa
ssh-keygen -f /opt/etc/ssh/ssh_host_dsa_key -N '' -t dsa
ssh-keygen -f /opt/etc/ssh/ssh_host_ecdsa_key -N '' -t ecdsa -b 521
Now you'll have to get on the shield and use a terminal emulator to edit your sshd_config file. Here's a copy of mine, but I do not promise how secure it is.
Code:
# $OpenBSD: sshd_config,v 1.99 2016/07/11 03:19:44 tedu Exp $
# This is the sshd server system-wide configuration file. See
# sshd_config(5) for more information.
# This sshd was compiled with PATH=/usr/bin:/bin:/usr/sbin:/sbin:/opt/bin
# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented. Uncommented options override the
# default value.
Port 22
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::
# The default requires explicit activation of protocol 1
Protocol 2
# HostKey for protocol version 1
#HostKey /opt/etc/ssh/ssh_host_key
#HostKeys for protocol version 2
HostKey /opt/etc/ssh/ssh_host_rsa_key
HostKey /opt/etc/ssh/ssh_host_dsa_key
HostKey /opt/etc/ssh/ssh_host_ecdsa_key
#HostKey /opt/etc/ssh/ssh_host_ed25519_key
# Lifetime and size of ephemeral version 1 server key
#KeyRegenerationInterval 1h
#ServerKeyBits 1024
# Ciphers and keying
#RekeyLimit default none
# Logging
#SyslogFacility AUTH
#LogLevel INFO
# Authentication:
#LoginGraceTime 2m
PermitRootLogin yes
StrictModes no
#MaxAuthTries 6
#MaxSessions 10
#RSAAuthentication yes
#PubkeyAuthentication yes
# The default is to check both .ssh/authorized_keys and .ssh/authorized_keys2
# but this is overridden so installations will only check .ssh/authorized_keys
AuthorizedKeysFile .ssh/authorized_keys
#AuthorizedPrincipalsFile none
#AuthorizedKeysCommand none
#AuthorizedKeysCommandUser nobody
# For this to work you will also need host keys in /opt/etc/ssh/ssh_known_hosts
#RhostsRSAAuthentication no
# similar for protocol version 2
#HostbasedAuthentication no
# Change to yes if you don't trust ~/.ssh/known_hosts for
# RhostsRSAAuthentication and HostbasedAuthentication
#IgnoreUserKnownHosts no
# Don't read the user's ~/.rhosts and ~/.shosts files
#IgnoreRhosts yes
# To disable tunneled clear text passwords, change to no here!
PasswordAuthentication yes
PermitEmptyPasswords yes
# Change to no to disable s/key passwords
#ChallengeResponseAuthentication yes
# Kerberos options
#KerberosAuthentication no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
#KerberosGetAFSToken no
# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes
# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the ChallengeResponseAuthentication and
# PasswordAuthentication. Depending on your PAM configuration,
# PAM authentication via ChallengeResponseAuthentication may bypass
# the setting of "PermitRootLogin without-password".
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.
#UsePAM no
#AllowAgentForwarding yes
#AllowTcpForwarding yes
#GatewayPorts no
#X11Forwarding no
#X11DisplayOffset 10
#X11UseLocalhost yes
#PermitTTY yes
#PrintMotd yes
#PrintLastLog yes
#TCPKeepAlive yes
#UseLogin no
UsePrivilegeSeparation no
#PermitUserEnvironment no
#Compression delayed
#ClientAliveInterval 0
#ClientAliveCountMax 3
#UseDNS no
#PidFile /opt/var/run/sshd.pid
#MaxStartups 10:30:100
#PermitTunnel no
#ChrootDirectory none
#VersionAddendum none
# no default banner path
#Banner none
# enable DSCP QoS values (per RFC-4594)
#IPQoS AF21 AF11
# override default of no subsystems
Subsystem sftp /opt/lib/sftp-server
# Example of overriding settings on a per-user basis
#Match User anoncvs
# X11Forwarding no
# AllowTcpForwarding no
# PermitTTY no
# ForceCommand cvs server
To edit this, on the shield (Rom Toolbox Lite has a terminal emulator) run
Code:
su
cd /opt
sh ./start.sh
cd /opt/etc/ssh
vi ./sshd_config
TRANSMISSION
You'll have to configure your transmission settings, but they're located
/opt/etc/transmission/settings.json
Persist after reboot / Start Transmission/SSH/Sickbeard on boot
On the shield, open Rom Toolbox lite, and go down to "Scripter"
Import the sysinit script located /opt/home/root/sysinit and set the script to run at boot as root
Reboot and you should be able to connect via SSH, and have
Why do we need the passwd and group file ? Won't we use android's UID/GID ?
Can this method somehow be used to create custom group where we could put android's UID ?
I don't know why that step is needed, I got it from the guide I listed, and it worked without any apparent issues, so I left it in. My guess is openssh wants it to be there, but I'm not sure
So after you run all that is there a Interface for Sickbeard etc?
ahoslc said:
So after you run all that is there a Interface for Sickbeard etc?
Click to expand...
Click to collapse
It would be running on <shield IP>:8081 which you could access from the shield, or any other device on your network. Transmission would be :9091
Thanks for this. I'm trying to get python3-pip, acd_cli, and encfs installed on my Shield TV so I can mount my Amazon Cloud Drive and decrypt files for use with Plex. I have this set up on my NAS but it is too weak to do transcoding. I did set up the NAS as a middleman and mounted shares from it on the Shield TV, and while it does work, the extra step is really slow.
edit: I managed to get acd_cli working but I cannot mount my Amazon Cloud Drive share, I get I/O errors when I try to cd into it. Wonder if there's a kernel issue.
psycho_asylum said:
Thanks for this. I'm trying to get python3-pip, acd_cli, and encfs installed on my Shield TV so I can mount my Amazon Cloud Drive and decrypt files for use with Plex. I have this set up on my NAS but it is too weak to do transcoding. I did set up the NAS as a middleman and mounted shares from it on the Shield TV, and while it does work, the extra step is really slow.
edit: I managed to get acd_cli working but I cannot mount my Amazon Cloud Drive share, I get I/O errors when I try to cd into it. Wonder if there's a kernel issue.
Click to expand...
Click to collapse
So I was able to get this working https://github.com/dsoprea/GDriveFS and could cd into my google drive (But couldn't get Plex to see any files in the directory)
Soooo, even if you do get it working, its possible Plex won't be able to see it
Edit-- Did you install fuse-utils ?
chasx003 said:
Edit-- Did you install fuse-utils ?
Click to expand...
Click to collapse
Not specifically. I would think it would have been listed as a dependency and automatically installed, libfuse was though. I ended up factory restoring my Shield after I botched something, so now I'm just at 5.1 stock using the built-in Samba for now.
which version of busybox works? I am having trouble with wget and I tried v1.21.0
chasx003 said:
I've seen lots of people saying its not possible to make the shield an all in one solution for downloading, but after hours of tinkerering I've got a semi easy way of running the above services (and tons more) from the shield. This does requrie a bit of command line-fu , but I think I've got most of the hard work done. When its all said and done, we'll have a working entware-ng installation ( https://github.com/Entware-ng/Entware-ng)
[..]
FIRST
Now let's create a script that will initialize Entware-ng after reboot
Code:
echo \#\!/system/bin/sh > /data/entware-ng/entware-init.sh
echo mount -o rw,remount rootfs / >> /data/entware-ng/entware-init.sh
echo ln -s /data/entware-ng /opt >> /data/entware-ng/entware-init.sh
echo ln -s /data/entware-ng/rootlinb /lib >> /data/entware-ng/entware-init.sh
echo ln -s /data/entware-ng/rootbin /bin >> /data/entware-ng/entware-init.sh
echo ln -s /data/entware-ng/tmp /tmp >> /data/entware-ng/entware-init.sh
echo ln -s /system/bin/sh /bin/sh >> /data/entware-ng/entware-init.sh
echo mount -o ro,remount rootfs >> /data/entware-ng/entware-init.sh
chmod 755 /data/entware-ng/entware-init.sh
[..]
SECOND
Now lets create a start script that calls the initialize script we just made, but also returns a shell in the new environment
Code:
echo \#\!/system/bin/sh > /data/entware-ng/start.sh
echo ls '/opt >/dev/null 2>&1 ||' su -c /data/entware-ng/entware-init.sh >> /data/entware-ng/start.sh
echo export PATH=/opt/sbin:/opt/bin:/opt/rootbin:/opt/local/bin:/system/bin >> /data/entware-ng/start.sh
echo if busybox test $(busybox id -u) = 0; then HOME=/opt/home/root; else HOME=/opt/home/user; fi >> /data/entware-ng/start.sh
echo export HOME >> /data/entware-ng/start.sh
echo 'for file in /data/opt/etc/init.d/*' >> /data/entware-ng/start.sh
echo do >> /data/entware-ng/start.sh
echo ' $file start' >> /data/entware-ng/start.sh
echo done >> /data/entware-ng/start.sh
echo /bin/sh >> /data/entware-ng/start.sh
chmod 755 /data/entware-ng/start.sh
[..]
THIRD
Copy the start.sh and sysinit to the home environment
Code:
chown root.root /data/entware-ng/home/root/start.sh
chmod 755 /data/entware-ng/home/root/start.sh
chown root.root /data/entware-ng/home/root/sysinit
chmod 755 /data/entware-ng/home/root/sysinit
mount -o ro,remount /
mount -o ro,remount /system
[..]
FOURTH
Start the new environment
Code:
sh /data/opt/home/root/sysinit
Reboot and you should be able to connect via SSH, and have
Click to expand...
Click to collapse
In my quote there has to be something missing between the "first" and "second" steps and the "third" one.. are the two files we've just made the missing files in the home/root directory? Or where they supposed to come from somewhere else?
Also the "fourth" step, there are no /data/opt directory in my installation.
MartiniGM said:
In my quote there has to be something missing between the "first" and "second" steps and the "third" one.. are the two files we've just made the missing files in the home/root directory? Or where they supposed to come from somewhere else?
Also the "fourth" step, there are no /data/opt directory in my installation.
Click to expand...
Click to collapse
Ah! Sorry for not replying until now, life has been busy.
You are correct, there are some typos / things out of order! I'm going to go through this and fix it and will update the OP
I've taken this guide and installed rTorrent (due to superior web client and RSS capability). If anyone needs help on that, I can chime in.
Great tuto !
Working fine one Nvidia Shield TV 2017 with latest update (whithout reboot)
But after reboot I lost /opt and /bin on root :-O
mkdir /opt working fine after mount -o rw,remount /
but if i reboot it disappear
any idea ?
android.stackexchange.com said:
(root) directory is not a persistent filesystem on Android. It's a initramfs, which is packed into the boot image on your device. Although you can remount it with write permissions, changes will always be lost the next time you boot because the original ramdisk will be re-extracted from the boot image on the next boot.
Click to expand...
Click to collapse
So we need to :
$ mkboot boot.img /output-folder
$ cd /output-folder
$ gunzip -c ramdisk | cpio -i
... make some changes in the ramdisk and possibly /output-folder/img_info ...
$ find . | cpio -o -H newc | gzip > newramdisk.cpio.gz
$ cd ..
$ mkboot /output-folder newboot.img
If you're rooted, a better solution is to simply install in a chroot, either using debootstrap or other; you can obtain a nearly complete Linux system this way (init in a chroot is weird, stuff like openssh will still have to be started separately after boot, either manually or by an app/script).
If you're not rooted, you can use proot for simple path redirection; this is how termux installs arch on unrooted devices.
Using either option (chroot, proot) requires having binary files that aren't in a noexec partition; generally this means private app storage, not sdcard that's accessible to other apps. If you're building a chroot, you should be able to include the external/public storage folder in it, however a chroot also requires the partition not be mounted with nodev option.
***Note that I don't actually have a shield TV*** (I'm just interested in getting one) so I can't say if the shield's storage is mounted noexec, but the android data partition generally is. I can, however, verify that the process in general works on Android, however, as I've got two tablets running Lineage/Nougat with chroots, and a stock Moto G6 with archlinux arm in proot. To check for partitions mounted as nodev or noexec, run `mount|TERM=xterm grep --color -E 'nodev|noexec'`. You might check to see if you can use /data/local instead of app's private storage.
For installing BusyBox, *should* be a `busybox --install -s [DIR]` option that copies the binary to the destination, then symlinks applets. This should be simpler than symlinking a bunch of applets manually.
If you want a system-wide BusyBox I recommend stericson busybox: https://play.google.com/store/apps/details?id=stericson.busybox
For a terminal emulator on Android, I highly recommend termux, which is available on Google play and F-Droid. It has support for 256 color, styles, a package manager, Android integration (ie notifications from Linux scripts), boot scripts, widgets, etc: https://play.google.com/store/apps/details?id=com.termux
Another alternative: you can set up user-mode Linux for something closer to virtualization, but I have yet to see any UML binaries for use with Android; this would also make it difficult to run networking and to access files from outside the guest, but will provide a full working system with init support, and would not require root to set up and run--however, I think UML networking requires root and/or kernel support, though, and UML generally requires a disk image much like other virtualization tools. Qemu might be workable instead of UML with fewer issues.
Note that all of these solutions are still running under an Android app, and as such are subject to the android task killer. Not sure if there's any way around this without having something run directly by Android's own init system.
Efreak2004 said:
If you're rooted, a better solution is to simply install in a chroot, either using debootstrap or other; you can obtain a nearly complete Linux system this way (init in a chroot is weird, stuff like openssh will still have to be started separately after boot, either manually or by an app/script).
If you're not rooted, you can use proot for simple path redirection; this is how termux installs arch on unrooted devices.
Using either option (chroot, proot) requires having binary files that aren't in a noexec partition; generally this means private app storage, not sdcard that's accessible to other apps. If you're building a chroot, you should be able to include the external/public storage folder in it, however a chroot also requires the partition not be mounted with nodev option.
***Note that I don't actually have a shield TV*** (I'm just interested in getting one) so I can't say if the shield's storage is mounted noexec, but the android data partition generally is. I can, however, verify that the process in general works on Android, however, as I've got two tablets running Lineage/Nougat with chroots, and a stock Moto G6 with archlinux arm in proot. To check for partitions mounted as nodev or noexec, run `mount|TERM=xterm grep --color -E 'nodev|noexec'`. You might check to see if you can use /data/local instead of app's private storage.
For installing BusyBox, *should* be a `busybox --install -s [DIR]` option that copies the binary to the destination, then symlinks applets. This should be simpler than symlinking a bunch of applets manually.
If you want a system-wide BusyBox I recommend stericson busybox: https://play.google.com/store/apps/details?id=stericson.busybox
For a terminal emulator on Android, I highly recommend termux, which is available on Google play and F-Droid. It has support for 256 color, styles, a package manager, Android integration (ie notifications from Linux scripts), boot scripts, widgets, etc: https://play.google.com/store/apps/details?id=com.termux
Another alternative: you can set up user-mode Linux for something closer to virtualization, but I have yet to see any UML binaries for use with Android; this would also make it difficult to run networking and to access files from outside the guest, but will provide a full working system with init support, and would not require root to set up and run--however, I think UML networking requires root and/or kernel support, though, and UML generally requires a disk image much like other virtualization tools. Qemu might be workable instead of UML with fewer issues.
Note that all of these solutions are still running under an Android app, and as such are subject to the android task killer. Not sure if there's any way around this without having something run directly by Android's own init system.
Click to expand...
Click to collapse
Using chroot isn`t good solution. Emulators not effective too.
Stericon`s busybox is paid, meefik`s busybox is free and has more utils.
Termux is heavy, I use Teeminal Emulator: https://f-droid.org/app/jackpal.androidterm
You be able to install a lot of lightweight linux utils by installing entware-ng. For example, git pkg has 300 Mb size in termux and 15 Mb in entware.
Entware has a lot of conmon with optware and openwrt
this is a wonderful guide I'm surprised more people don't use it great job!