[GUIDE][SCRIPT] rsync backup over USB + adb with Lineage 14.x - Android Software/Hacking General [Developers Only]

Hello together,
as Lineage 13.0+ already includes the rsync binary, backing up the phone via rsync over USB + adb is fast and convenient. The only "downside" is that you need a phone with root access.
While everything worked fine for months with Lineage 13.0, rsync gave strange error messages on the client after updating to Lineage 14.1.
Output on the PC side looked like this:
Code:
+ adb shell 'umask 077 && rsync --daemon --no-detach --log-file=/storage/emulated/0/rsyncd/rsyncd.log --config=/mnt/secure/rsyncd.conf' &
@RSYNCD: 31.0
Notice the "@RSYNCD: 31.0" protocol tag in the output.
To make a long story short, "rsync --daemon" on the phone side thinks it's invoked via inetd.
rsync's "inetd mode" gets activated automatically if the stdin of the rsync process is a socket. There's no way to switch that off. Probably the internal semantics how adb shell works changed a bit in Android Nougat.
Luckily there's a workaround in the adb shell command: Allocate a pty with the "-t" option.
The original invocation line
Code:
adb shell 'umask 077 && rsync --daemon --no-detach --log-file=/storage/emulated/0/rsyncd/rsyncd.log --config=/mnt/secure/rsyncd.conf' &
becomes
Code:
adb shell -t -t 'umask 077 && rsync --daemon --no-detach --log-file=/storage/emulated/0/rsyncd/rsyncd.log --config=/mnt/secure/rsyncd.conf' &
Notice the double '-t' in there: This forces the allocation of a PTY, it won't work with a single '-t' if the adb shell command is forked into background with '&'.
Here's the complete backup script for a Galaxy S5, adapt the exclusion list to your needs:
Code:
#!/bin/bash
set -u
BASEDIR=/data/MY_BACKUP_DESTINATION
TARGET=$BASEDIR/android
# generate random secret
secret=$(dd if=/dev/urandom bs=1 count=32 2>/dev/null | base64 -w 0 | rev | cut -b 2- | rev)
#log to logger
exec 2>&1 | logger
if ! test -d "$TARGET"; then
echo "could not find directory: $TARGET"
exit 1
fi
set -x
LOCALPORT=5000
RSYNCPORT=873
echo "Waiting for device"
adb wait-for-device
adb root
adb wait-for-device
adb shell "umask 077 && test ! -d /storage/emulated/0/rsyncd && mkdir -p /storage/emulated/0/rsyncd"
adb shell "umask 077 && printf 'backup:$secret\n' > /mnt/secure/rsyncd.secrets"
adb shell "umask 077 && printf 'address = 127.0.0.1\npid file = /mnt/secure/rsyncd.pid\nuid = root\ngid = root\n[root_all]\n\tpath = /\n\thosts allow = 127.0.0.1\n\tauth users = backup\n\tsecrets file = /mnt/secure/rsyncd.secrets\n' > /mnt/secure/rsyncd.conf"
adb shell -t -t "umask 077 && rsync --daemon --no-detach --log-file=/storage/emulated/0/rsyncd/rsyncd.log --config=/mnt/secure/rsyncd.conf" &
# give rsync daemon time to start
sleep 2
adb forward tcp:$LOCALPORT tcp:$RSYNCPORT
RSYNC_PASSWORD=$secret rsync -av --delete \
--exclude /dev \
--exclude /acct \
--exclude /sys \
--exclude /mnt/sdcard \
--exclude /mnt/user/0 \
--exclude /mnt/runtime \
--exclude /mnt/media_rw \
--exclude /proc \
--exclude '/data/media/0/Android/data/net.osmand.plus/files/*.obf' \
--exclude /data/media/0/Android/data/net.osmand.plus/files/wiki \
--exclude /data/data/org.cyanogenmod.gello.browser/cache/Cache \
--exclude /data/media/0/Movies \
--exclude /data/media/0/Music \
--exclude /data/dalvik-cache \
--exclude /storage/emulated \
--exclude /storage/0000-000A \
rsync://[email protected]:$LOCALPORT/root_all/ $TARGET/
: rc $?
adb forward --remove tcp:$LOCALPORT
# kill rsyncd
adb shell 'test -f /mnt/secure/rsyncd.pid && kill $(cat /mnt/secure/rsyncd.pid)'
# remove temporary files
adb shell rm -f /mnt/secure/rsyncd.conf /mnt/secure/rsyncd.pid /mnt/secure/rsyncd.secrets
The script is based on this blog post originally:
https://blog.josefsson.org/2015/11/28/automatic-android-replicant-backup-over-usb-using-rsync/
Hope this saves others some time when migrating to Lineage 14.x
Cheers,
Thomas

A real genius post. I was stuck at passing -t flag.
Thanks!

@thomasjfox are you still using this method on LineageOS 18? Has anything changed in the intervening time?
I am able to get the daemon to start, and to use rsync from within the ADB shell, but from my PC I can't get rsync to connect. adb forwarding --list reveals that my port forwarding is set up correctly. I get the error:
rsync: safe_read failed to read 1 bytes [Receiver]: Connection reset by peer (104)
rsync error: error in rsync protocol data stream (code 12) at io.c(285) [Receiver=3.1.3]

Related

[Tutorial] Ubuntu on Evo? Not Again! no wait, this is different

UPDATE GO HERE: http://forum.xda-developers.com/showthread.php?t=932754
Revised Ubuntu Installation Created By Homefix and RooferDave
I just put this together today, gotta get back to work, the snowstorms over (im from western NY) might be errors will edit and update as time permits
all scripts contain original authors and credits where aplicable.​This tutorial will show you how to create a Debian Image, Emulate that image using The Qemu Emulator in Ubuntu.And finally setup that image on your EVO
I cannot be held responsible if your foolish enough to do, what is outlined below!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
I will take the time to post the credits soon.
However the scripts speak for themselves and the creators have left there info in them.
Thanks really goes out to them.
Most of this came from here: https://wiki.edubuntu.org/ARM/BuildArmPackages
Things you need:
# I hope you have the EVO (last i heard radio shack may have 1 left. DRIVE CAREFULLY, theres snow everywere).
# Computer BestBuy ? I prefer to build my own (Brite Computers Fishers NY).​and a small note, you need ubuntu ruuning do do any of the image creation-manipulation.
​I wasnt able to get VBOX to emulate the Image so... UPDATE yes i was able to get it working i was having a router issue.So give VBOX a try http://www.virtualbox.org/wiki/Downloads
you can either try to get it to work with VBOX,(goodluck), or dust off one of your old computers and get Ubuntu up.
But you may have to do what i did, i yanked out the family computer from the living room and fit in my literally 4' x 7' office to get this done.
i dont worry to much, i know they love me for spending the last 2 weeks with my face attached to the monitor.
# Rom: CyanogenMod-6. You could try others. (i tell my daughter who always copies her sister "you are your own nucklehead").​(good luck finding these links) http://wiki.cyanogenmod.com/index.php?title=Latest_Version#HTC_Evo_4G
Nightlies here: (i prefer this addiction over others). http://mirror.teamdouche.net/?type=nightly ​# PLENTY OF PATIENCE
Get your phone ready: http://forum.xda-developers.com/wiki/index.php?title=HTC_Supersonic/Guides_%26_Tutorials#Guides_For_Root
Root: http://forum.xda-developers.com/wik...Supersonic/Guides_&_Tutorials#Guides_For_Root
Setup ADB: http://forum.xda-developers.com/showthread.php?t=694250
Setup Ubuntu http://www.ubuntu.com/desktop/get-ubuntu/download
My 3G Karmic Rootstock Image http://www.megaupload.com/?d=SJY6ZB58
login dad
passwd f
root passwd not set
then go to line 1000
let me know if i have the right one posted.
Setup Rootstock ​IN THE BEGINING
In your Ubuntu terminal type: "mkdir /<your home directory>/qemuArm"
(dont includ the < >'s or the ""'s) your home directory usually is /home/<your user name>/
then: cd /<your home directory>/qemuArm
then: sudo apt-get install qemu qemu-kvm-extras
then: sudo apt-get install debootstrap (if you dont have it already)
then: sudo apt-get install fakeroot (if you dont have it already)
then: sudo apt-get install bzr (if you dont have it already)
then: (download rootstock bzr branch)
sudo bzr branch lp:roject-rootstock
then: (download kernel to /<your home directory>/qemuArm) just
make sure you dont leave the, /<your home directory>/qemuArm directory​CREATION
then: (create your image)
​sudo project-rootstock/rootstock --fqdn ubuntu --login ubuntu --password ubuntu --notarball --imagesize 3G --seed nano
or: custimize your image with the info in the readme file, in the /<your home directory>/qemuArm/project-rootstockfolder​(when your image is complete)
then: (make a copy)
cp qemu-armel-<replace with your #>.img <whatever you name it>.img (remove the <>'s)​EMULATION
Download the http://ports.ubuntu.com/ubuntu-ports/dists/lucid/main/installer-armel/current/images/versatile/netboot/ to ~/qemuArm
USE THIS WEBPAGE AND FIND THE LINK FOR YOUR KERNEL VERSATILE
https://wiki.edubuntu.org/ARM/BuildArmPackages
Then: (start your emulation) -----> dont forget to remove the <>'s <------
sudo qemu-system-arm -M versatilepb -cpu cortex-a8 -kernel ./vmlinuz -hda <whatever you name it>.img -m 256 -append "root=/dev/sda mem=256M devtmpfs.mount=0 rw"
then: (hopefully you will see a blank screen)
press alt-F1 if you do not see a login prompt go back to the begining​SO LET THER BE LIGHT
then: log in
then: (to change password)
sudo tmppwd ubuntu and to change login name never do "usermod -l newname -m -d /home/newname oldname" pic the right name at creation.
then: sudo tmppwd root (if you want to set root password) ​THEN THERE WERE TWO
In the Emulated terminal:
(configure network connections)​sudo nano /etc/network/interfaces
add: (under existing entries of the file):
auto eth0
iface eth0 inet dhcp ​then cntrl-X, confirm save, and exit.
then sudo ifconfig eth0 up
then sudo dhclient eth0
then sudo apt-get update (if it aint broke dont fix it) otherwise go back to the beginning​BORN AGAIN
On the Host System make sure Qemu is not running.
then: (install some more stuff)
sudo apt-get install bridge-utils
This assumes if you have a basic networking system with eht0 as interface
then: (configure network bridge)​
sudo nano /etc/network/interfaces
add: (under existing entries of the file)
auto br0
iface br0 inet dhcp
bridge_ports eth0
bridge_maxwait 0 ​then: cntrl-X, confirm save, and exit.
then: sudo ifconfig eth0 0.0.0.0
then: sudo ifup br0
then: (Load the tun module (you can add tun to /etc/modules if you want it to load on boot)
sudo modprobe tun
then: set permissions
sudo chmod 0666 /dev/net/tun
then: (change Qemu Script)
sudo nano /etc/qemu-ifup
add: a "#" symbol to all existing entries except the first line (got it?)
add: (under existing entries of the file):
echo "Executing /etc/qemu-ifup"
echo "Bringing up $1 for bridged mode..."
sudo /sbin/ifconfig $1 0.0.0.0 promisc up
echo "Adding $1 to br0..."
sudo /usr/sbin/brctl addif br0 $1
sleep 2
​then: set permissions
sudo chmod +x /etc/qemu-ifup
then: start emulation
sudo qemu-system-arm -M versatilepb -cpu cortex-a8 -kernel ./vmlinuz -hda <whatever you name it>.img -m 256 -append "root=/dev/sda mem=256M devtmpfs.mount=0 rw" -net nic -net tap​then: login
then: sudo apt-get install openssh-server
if: that goes well, your home free (we'll discuss errors later)​LEARN TO TALK
Now: you can ssh into or scp to your ARM VM from the host.
get ip address to ssh into or scp to, by simply running ifconfig in the ARM terminal.
install your applications
Or just get right to it and see what this is all about​LEARN TO WALK
Now: we will setup the chroot
Change your imagename to ubuntu.img
Using file manager, Create a folder (on your phone) /sdcard/ubuntu,
and transfer ubuntu.img to your sdcard folder, ubuntu.​Copy the following text including the (#) and paste into notepad++ ​(get it http://notepad-plus-plus.org/download) or in linux gedit or Eqvlnt. ​Save as sdcard/ubuntu/bootubuntu (no extension)nothing more.​#modprobe ext2
mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system
export kit=/sdcard/ubuntu
export bin=/system/bin
if [ ! -d /data/local/ubuntu ]
then
mkdir /data/local/ubuntu
fi
export mnt=/data/local/ubuntu
export PATH=$bin:/usr/bin:/usr/sbin:/bin:$PATH
export TERM=linux
export HOME=/root
mknod /dev/loop1 b 7 0
losetup /dev/block/loop1 /sdcard/ubuntu/ubuntu.img
mount -t ext2 /dev/block/loop1 /data/local/ubuntu
#mount -o loop,noatime -t ext2 $kit/ubuntu.img $mnt
mount -t devpts devpts $mnt/dev/pts
mount -t proc proc $mnt/proc
mount -t sysfs sysfs $mnt/sys
sysctl -w net.ipv4.ip_forward=1
echo "Setting /etc/resolv.conf to Google Open DNS 8.8.8.8 and 8.8.4.4"
echo "nameserver 8.8.8.8" > $mnt/etc/resolv.conf
echo "nameserver 8.8.4.4" >> $mnt/etc/resolv.conf
echo "Setting localhost on /etc/hosts "
echo "127.0.0.1 localhost" > $mnt/etc/hosts
echo "READY TO ROCK AND ROLL BABY! "
echo "Brought to you by NexusOneHacks.net and the open source community! "
echo " "
chroot $mnt /bin/bash
#After exit command is executed clear it all up
echo " "
echo "Shutting down Ubuntu"
umount $mnt/dev/pts
umount $mnt/proc
umount $mnt/sys
umount $mnt
losetup -d /dev/loop1
AND DO THE SAME FOR THE NEXT 4 FILES AND NAME THEM CORRECTLY AND USE THE RIGHT TEXT EDITOR
This next file is called sdcard/ubuntu/unionfs (remember no file ext.)
busybox insmod unionfs
mount -t unionfs -o dirs=$mnt/etc=rw:/etc=ro unionfs /etc
mount -o remount,rw /
ln -s $mnt/lib /
for x in \
bin boot home media mnt \
opt selinux srv usr var
do
ln -s $mnt/$x /
done
rmdir /root
ln -s $mnt/root /
mount -o remount,ro /
mount -t unionfs -o dirs=$mnt/sbin=rw:/sbin=ro unionfs /sbin
mount -t unionfs -o dirs=$mnt/dev=rw:/dev=rw unionfs /dev
mount -t devpts devpts /dev/pts
This next file is called sdcard/ubuntu/fsrw (remember no file ext.)
mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system
echo "Filesytem remounted as read/write"
This next file is called sdcard/ubuntu/mountonly (remember no file ext.)
# Based on Saurik's remount.sh - modified by Mark Walker of http://www.androidfanatic.com
# Email [email protected]
modprobe ext2
clear
mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system
export kit=/sdcard/debian
export bin=/data/local/bin
export mnt=/data/local/mnt
export PATH=$bin:/usr/bin:/usr/sbin:/bin:$PATH
export TERM=linux
export HOME=/root
busybox insmod ext2
clear
echo " "
mount -o loop,noatime $kit/debian.img $mnt
mount -t devpts devpts $mnt/dev/pts
mount -t proc proc $mnt/proc
mount -t sysfs sysfs $mnt/sys
echo "Custom Linux IMG Mounter V1.0 - by Mark Walker"
echo "WEB: http://www.androidfanatic.com"
echo "EML: [email protected]"
sleep 1
echo "AutoMounter started"
sleep 1
echo "REBOOT PHONE TO PROPERLY DISMOUNT"
echo " "
# chroot $mnt /bin/bash
This next file is called sdcard/ubuntu/ubuntu.sh (this one has .sh for file ext)
mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
modprobe ext2
clear
rm -f /data/local/bin/fsrw
rm -f /data/local/bin/bootubuntu
rm -f /data/local/bin/unionfs
rm -f /data/local/bin/installer.sh
rm -f /data/local/bin/mountonly
mkdir /data/local/mnt
clear
rm /system/bin/fsrw
rm /system/bin/bootubuntu
rm /system/bin/unionfs
rm -/system/bin/mountonly
cp -f fsrw /system/bin
cp -f bootubuntu /system/bin
cp -f unionfs /system/bin
cp -f mountonly /system/bin
cd /sdcard/ubuntu
chmod 4777 *
cd /system/bin/
chmod 4777 *
cd /
clear
echo " "
echo "Ubuntu Chroot Bootloader v0.1"
echo "Ubuntu Bootloader is now installed!"
echo "This process does NOT damage Android OS!"
echo " "
echo "Original Installer by Charan Singh"
echo "Modified for Ubuntu Chroot by Max Lee at NexusOneHacks.net"
echo " "
echo "To enter the Debian Linux console just type 'bootubuntu'"
bootubuntu
After you have,
bootubuntu
fsrw
mountonly
unionfs
ubuntu.sh
ubuntu.img
in your /sdcard/ubuntu folder
Open adb shell
Enter: su
then: cd /sdcard/ubuntu
then: sh ./ubuntu.sh
then: apt-get update
then: apt-get install tightvncserver
then: apt-get install lxde
this is LINE 1000
then: export USER=root
then: vncserver :0 -geometry 1024x800
then: cat > front
then: export USER=root
then: cd /
then: rm -r -f /tmp
then: mkdir /tmp
then: cd /
then: vncserver :0 -geometry 1024x800
then: press "cntrl D", "cntrl D" again, then Enter)
then: cat front /root/.bashrc > temp
then: cp temp /root/.bashrc
then:
Get Android VNC for you phone (market)
open app
enter 5900 for port
enter password you setup for vncserver
enter (for nick) username you picked during creation
enter (for address) localhost
set graphics for 24 bit
Connect
let the fun begin
Next update: How to network with Hamachi
It does work
nice work
Lol im usually all for this stuff but this looks much too frigthening
thetony said:
Lol im usually all for this stuff but this looks much too frigthening
Click to expand...
Click to collapse
Its really easy, download the zip,
put the ubuntu folder on your sdcard go to line 1000 in the tutorial.
Can u make or received call
alphaeagle777 said:
Can u make or received call
Click to expand...
Click to collapse
yes you have full function of your phone
Alright, I'm going to give this a try while I'm at work (shhhh). I'm curious though, why did you use Karmic? Is it possible with Maverick?
ioos said:
Alright, I'm going to give this a try while I'm at work (shhhh). I'm curious though, why did you use Karmic? Is it possible with Maverick?
Click to expand...
Click to collapse
Well? How did it go?
Hemidroids said:
Well? How did it go?
Click to expand...
Click to collapse
yes it works with maverick theres really no differance that i noticed

[Tutorial] Ubuntu on Epic ? Not Again! no wait, this is different

UPDATE GO HERE:
http://forum.xda-developers.com/showthread.php?p=10972597#post10972597
Revised Ubuntu Installation Created By Homefix and RooferDave
This tutorial will show you how to create a Debian Image, Emulate that image using The Qemu Emulator in Ubuntu.And finally setup that image on your EPIC​
I just put this together yesterday, its from my EVO post: http://forum.xda-developers.com/showthread.php?t=881401 .gotta get back to work, the snowstorms over (im from western NY) might be errors will edit and update as time permits
This is made for the epic, but i will try to catch all the changes, i think i got most of em.
Listen up you knuckles, on the evo i can ssh, setup and use samba shares(using hamachi network for connectability), nautilus-shares works, programs dont close, cpu meter works, it truly is like a mini computer in your pocket.
I hope with CyanogenMod i can have the same results because obviosly the epic exceeds the evo because of the keyboard (for this kind of stuff). It sucks to loose half your screen to the input method (with the evo), But i wish the screensize was larger.
For now until there are some kernel changes(hamachi does not work) I have to spend my time playing with that.(Hamachi works in the Evo
However ubuntu seems to run better on the evo
UPDATE cant get Hamachi installed gotta wait for kernel changes -
I guess you can never have the best of both worlds
all scripts contain original authors and credits where aplicable.
I cannot be held responsible if your foolish enough to do, what is outlined below!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!
I will take the time to post the credits soon.
However the scripts speak for themselves and the creators have left there info in them.
Thanks really goes out to them.
Most of this came from here: https://wiki.edubuntu.org/ARM/BuildArmPackages
Things you need:
# I hope you have the Epic (last i heard radio shack may have 1 left. DRIVE CAREFULLY, theres snow everywere).
# Computer maybe , BestBuy ? I prefer to build my own (Brite Computers Fishers NY).
and a small note, you need ubuntu ruuning do do any of the image creation-manipulation.
I wasnt able to get VBOX to emulate the Image so...
you can either try to get it to work with VBOX,(goodluck), or dust off one of your old computers and get Ubuntu up.
UPDATE: got VBOX working was router issue. so give it a try.
But you may have to do what i did, i yanked out the family computer from the living room and fit in my literally 4' x 7' office to get this done.
i dont worry to much, i know they love me for spending the last 2 weeks with my face attached to the monitor.
# Rom: CyanogenMod-6. You could try others. (i tell my daughter who always copies her sister "you are your own nucklehead").
http://android.stolenrobot.com/Epic4G/epic.htm
Nightlies here: (i prefer this addiction over others). http://mirror.teamdouche.net/?type=nightly
# PLENTY OF PATIENCE
Get your phone ready: http://forum.xda-developers.com/showthread.php?t=770388
Setup ADB: http://forum.xda-developers.com/showthread.php?t=694250
Setup Ubuntu http://www.ubuntu.com/desktop/get-ubuntu/download
My 3G Prebuilt Image is http://www.megaupload.com/?d=SJY6ZB58
login dad
passwd f
root passwd not set
DO NOT USE THOSE SCRIPTS USE THESE: http://www.megaupload.com/?d=1NLU3XDU
sorry im late, having trouble upload (free account). this is for the evo. let me know if you can create new files on your desktop, if not you will have to wait until i foward the epic image.
Setup Rootstock
IN THE BEGINING
In your Ubuntu terminal type: "mkdir /<your home directory>/qemuArm"
(dont includ the < >'s or the ""'s) your home directory usually is /home/<your user name>/
then: cd /<your home directory>/qemuArm
then: sudo apt-get install qemu qemu-kvm-extras
then: sudo apt-get install debootstrap (if you dont have it already)
then: sudo apt-get install fakeroot (if you dont have it already)
then: sudo apt-get install bzr (if you dont have it already)
then: (download rootstock bzr branch)
sudo bzr branch lproject-rootstock
then: (download kernel to /<your home directory>/qemuArm) just
make sure you dont leave the, /<your home directory>/qemuArm directory
CREATION
then: (create your image)
sudo project-rootstock/rootstock --fqdn ubuntu --login ubuntu --password ubuntu --notarball --imagesize 3G --seed nano
or: custimize your image with the info in the readme file, in the /<your home directory>/qemuArm/project-rootstockfolder
(when your image is complete)
then: (make a copy)
cp qemu-armel-<replace with your #>.img <whatever you name it>.img (remove the <>'s)
EMULATION
1.Download the http://ports.ubuntu.com/ubuntu-port...aller-armel/current/images/versatile/netboot/ to ~/qemuArm
USE THIS WEBPAGE AND FIND THE LINK FOR YOUR KERNEL VERSATILE
https://wiki.edubuntu.org/ARM/BuildArmPackages
Then: (start your emulation) -----> dont forget to remove the <>'s <------
sudo qemu-system-arm -M versatilepb -cpu cortex-a8 -kernel ./vmlinuz -hda <whatever you name it>.img -m 256 -append "root=/dev/sda mem=256M devtmpfs.mount=0 rw"
then: (hopefully you will see a blank screen)
press alt-F1 if you do not see a login prompt go back to the begining
SO LET THER BE LIGHT
then: log in
then: (to change password)
sudo tmppwd ubuntu and to change login name never do "usermod -l newname -m -d /home/newname oldname" pic the right name at creation.
then: sudo tmppwd root (if you want to set root password)
THEN THERE WERE TWO
In the Emulated terminal:
(configure network connections)
sudo nano /etc/network/interfaces
add: (under existing entries of the file):
auto eth0
iface eth0 inet dhcp
then cntrl-X, confirm save, and exit.
then sudo ifconfig eth0 up
then sudo dhclient eth0
then sudo apt-get update (if it aint broke dont fix it) otherwise go back to the beginning
BORN AGAIN
On the Host System make sure Qemu is not running.
then: (install some more stuff)
sudo apt-get install bridge-utils
This assumes if you have a basic networking system with eht0 as interface
then: (configure network bridge)
•sudo nano /etc/network/interfaces
add: (under existing entries of the file)
auto br0
iface br0 inet dhcp
bridge_ports eth0
bridge_maxwait 0
then: cntrl-X, confirm save, and exit.
then: sudo ifconfig eth0 0.0.0.0
then: sudo ifup br0
then: (Load the tun module (you can add tun to /etc/modules if you want it to load on boot)
sudo modprobe tun
then: set permissions
sudo chmod 0666 /dev/net/tun
then: (change Qemu Script)
sudo nano /etc/qemu-ifup
add: a "#" symbol to all existing entries except the first line (got it?)
add: (under existing entries of the file):
echo "Executing /etc/qemu-ifup"
echo "Bringing up $1 for bridged mode..."
sudo /sbin/ifconfig $1 0.0.0.0 promisc up
echo "Adding $1 to br0..."
sudo /usr/sbin/brctl addif br0 $1
sleep 2
then: set permissions
sudo chmod +x /etc/qemu-ifup
then: start emulation
sudo qemu-system-arm -M versatilepb -cpu cortex-a8 -kernel ./vmlinuz -hda <whatever you name it>.img -m 256 -append "root=/dev/sda mem=256M devtmpfs.mount=0 rw" -net nic -net tap
then: login
then: sudo apt-get install openssh-server
if: that goes well, your home free (we'll discuss errors later)
LEARN TO TALK
Now: you can ssh into or scp to your ARM VM from the host.
get ip address to ssh into or scp to, by simply running ifconfig in the ARM terminal.
install your applications
Or just get right to it and see what this is all about
LEARN TO WALK
Now: we will setup the chroot
Change your imagename to ubuntu.img
Using file manager, Create a folder (on your phone) /sdcard/ubuntu,
and transfer ubuntu.img to your sdcard folder, ubuntu.
Copy the following text including the (#) and paste into notepad++
(get it http://notepad-plus-plus.org/download) or in linux gedit or Eqvlnt.
Save as sdcard/ubuntu/bootubuntu (no extension)nothing more.
Hold on HERE: these scripts are for the EVO modify the loop1 entries to loop2 or loop5 and modify mtdblock3 to mtdblock2 if things dont work
(i cant do everything)
#modprobe ext2
mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system
export kit=/sdcard/ubuntu
export bin=/system/bin
if [ ! -d /data/local/ubuntu ]
then
mkdir /data/local/ubuntu
fi
export mnt=/data/local/ubuntu
export PATH=$bin:/usr/bin:/usr/sbin:/bin:$PATH
export TERM=linux
export HOME=/root
mknod /dev/loop1 b 7 0
losetup /dev/block/loop1 /sdcard/ubuntu/ubuntu.img
mount -t ext2 /dev/block/loop1 /data/local/ubuntu
#mount -o loop,noatime -t ext2 $kit/ubuntu.img $mnt
mount -t devpts devpts $mnt/dev/pts
mount -t proc proc $mnt/proc
mount -t sysfs sysfs $mnt/sys
sysctl -w net.ipv4.ip_forward=1
echo "Setting /etc/resolv.conf to Google Open DNS 8.8.8.8 and 8.8.4.4"
echo "nameserver 8.8.8.8" > $mnt/etc/resolv.conf
echo "nameserver 8.8.4.4" >> $mnt/etc/resolv.conf
echo "Setting localhost on /etc/hosts "
echo "127.0.0.1 localhost" > $mnt/etc/hosts
echo "READY TO ROCK AND ROLL BABY! "
echo "Brought to you by NexusOneHacks.net and the open source community! "
echo " "
chroot $mnt /bin/bash
#After exit command is executed clear it all up
echo " "
echo "Shutting down Ubuntu"
umount $mnt/dev/pts
umount $mnt/proc
umount $mnt/sys
umount $mnt
losetup -d /dev/loop1
AND DO THE SAME FOR THE NEXT 4 FILES AND NAME THEM CORRECTLY AND USE THE RIGHT TEXT EDITOR
This next file is called sdcard/ubuntu/unionfs (remember no file ext.)
busybox insmod unionfs
mount -t unionfs -o dirs=$mnt/etc=rw:/etc=ro unionfs /etc
mount -o remount,rw /
ln -s $mnt/lib /
for x in \
bin boot home media mnt \
opt selinux srv usr var
do
ln -s $mnt/$x /
done
rmdir /root
ln -s $mnt/root /
mount -o remount,ro /
mount -t unionfs -o dirs=$mnt/sbin=rw:/sbin=ro unionfs /sbin
mount -t unionfs -o dirs=$mnt/dev=rw:/dev=rw unionfs /dev
mount -t devpts devpts /dev/pts
This next file is called sdcard/ubuntu/fsrw (remember no file ext.)
mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system
echo "Filesytem remounted as read/write"
This next file is called sdcard/ubuntu/mountonly (remember no file ext.)
# Based on Saurik's remount.sh - modified by Mark Walker of http://www.androidfanatic.com
# Email [email protected]
modprobe ext2
clear
mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system
export kit=/sdcard/debian
export bin=/data/local/bin
export mnt=/data/local/mnt
export PATH=$bin:/usr/bin:/usr/sbin:/bin:$PATH
export TERM=linux
export HOME=/root
busybox insmod ext2
clear
echo " "
mount -o loop,noatime $kit/debian.img $mnt
mount -t devpts devpts $mnt/dev/pts
mount -t proc proc $mnt/proc
mount -t sysfs sysfs $mnt/sys
echo "Custom Linux IMG Mounter V1.0 - by Mark Walker"
echo "WEB: http://www.androidfanatic.com"
echo "EML: [email protected]"
sleep 1
echo "AutoMounter started"
sleep 1
echo "REBOOT PHONE TO PROPERLY DISMOUNT"
echo " "
# chroot $mnt /bin/bash
This next file is called sdcard/ubuntu/ubuntu.sh (this one has .sh for file ext)
mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
modprobe ext2
clear
rm -f /data/local/bin/fsrw
rm -f /data/local/bin/bootubuntu
rm -f /data/local/bin/unionfs
rm -f /data/local/bin/installer.sh
rm -f /data/local/bin/mountonly
mkdir /data/local/mnt
clear
rm /system/bin/fsrw
rm /system/bin/bootubuntu
rm /system/bin/unionfs
rm -/system/bin/mountonly
cp -f fsrw /system/bin
cp -f bootubuntu /system/bin
cp -f unionfs /system/bin
cp -f mountonly /system/bin
cd /sdcard/ubuntu
chmod 4777 *
cd /system/bin/
chmod 4777 *
cd /
clear
echo " "
echo "Ubuntu Chroot Bootloader v0.1"
echo "Ubuntu Bootloader is now installed!"
echo "This process does NOT damage Android OS!"
echo " "
echo "Original Installer by Charan Singh"
echo "Modified for Ubuntu Chroot by Max Lee at NexusOneHacks.net"
echo " "
echo "To enter the Debian Linux console just type 'bootubuntu'"
bootubuntu
After you have,
bootubuntu
fsrw
mountonly
unionfs
ubuntu.sh
ubuntu.img
in your /sdcard/ubuntu folder
Open adb shell
Enter: su
then: cd /sdcard/ubuntu
then: sh ./ubuntu.sh
then: apt-get update
then: apt-get install tightvncserver
then: apt-get install lxde
then: export USER=root
then: vncserver :0 -geometry 1024x800
then: cat > front
then: export USER=root
then: cd /
then: rm -r -f /tmp
then: mkdir /tmp
then: cd /
then: vncserver :0 -geometry 1024x800
then: press "cntrl D", "cntrl D" again, then Enter)
then: cat front /root/.bashrc > temp
then: cp temp /root/.bashrc
then:
Get Android VNC for you phone (market)
open app
enter 5900 for port
enter password you setup for vncserver
enter (for nick) username you picked during creation
enter (for address) localhost
set graphics for 24 bit
Connect
let the fun begin
Next update: How to network with Hamachi
It does work <-----Havent gotten that far with the epic
Let me buy you a beer or whatever you sip. I just wanted to save someone the headace of setting this up and creating there own image instead of using someone else's.
SEE ya
NICE
A very nice tutorial, TY for the attention to details.

Unroot for linux

Heres a modded linux script based on the defyroot script to unroot your defy
Code:
#!/bin/bash
# execute as bash root_Defy.v2
# Following Bin4ry instructions
# Using http://c-skills.blogspot.com/2010/07/android-trickery.html exploit
# See http://intrepidusgroup.com/insight/2010/09/android-root-source-code-looking-at-the-c-skills/ for an explanation of the exploit
ADB="./adblinux"
if [ ! -e $ADB ] ; then
echo "adb not found! Cannot continue." ;
exit 1 ;
fi
chmod +x $ADB
if [ $(grep -ic 22b8 /etc/udev/rules.d/51-android.rules) -eq 0 ] ; then
echo "SUBSYSTEM=="usb", ATTRS{idVendor}==\"22b8\", MODE=\"0666\"" >> /etc/udev/rules.d/51-android.rules ;
fi
if [ $($ADB devices | grep -c device$) -ne 1 ] ; then
echo "Too many devices attached: exiting!" ;
exit 1;
fi
SERIALNO=`$ADB devices | grep device$ | cut -f1`
if [ $? -eq 0 ] ; then
echo "Found device $SERIALNO" ;
else
echo "Error searching device number!" ;
exit 1;
fi
for file in rageagainstthecage su Superuser.apk ; do
echo -n "Pushing $file: " ;
$ADB -s $SERIALNO push $file /data/local/tmp/$file ;
echo "done" ;
done
#$ADB -s $SERIALNO push rageagainstthecage /data/local/tmp/rageagainstthecage
#$ADB -s $SERIALNO push su /data/local/tmp/su
#$ADB -s $SERIALNO push Superuser.apk /data/local/tmp/Superuser.apk
echo -n "Making rageagainstthecage executable and executing it: "
$ADB -s $SERIALNO shell chmod 755 /data/local/tmp/rageagainstthecage
$ADB -s $SERIALNO shell /data/local/tmp/rageagainstthecage
echo "done"
echo "Waiting 15 sec for phone adbd to restart before continuing"
sleep 15
echo -n "Remounting filesystem in read-write mode: "
$ADB -s $SERIALNO shell mount -o remount,rw -t ext3 /dev/block/mmcblk1p21 /system
echo "done"
echo -n "Removing su command: "
$ADB -s $SERIALNO shell rm /system/bin/su
echo "done"
echo -n "Removing Superuser apk: "
$ADB -s $SERIALNO shell rm /system/app/Superuser.apk
echo "done"
exit 0
added to linux tools, thanks!
By editing the original I could ensure that only what was created in the original, was altered, although in theory you should be able to strip or add anyfiles you want in the same way.
Works for sure on fedora 15 and opensuse11.4 and any the original script works on.

[Q] Latest Linux version of Flashtool does not see libusb

As I still don't made sufficient posts to put it directly to dev forum, it's here. Admins, please move it to correct sections as you desire.
I installed the latest version of Flashtool for Linux. I followed the instructions at flashtool. net/install. php and tried to run './Flashtool'. here is the output:
[[email protected] FlashTool]# ./FlashTool
Running as root.
JAVA_HOME not set. Using default value : ./x10flasher_lib/linjre64
libusb.LibUsbException: Libusb not found. Minimum libusb version is 1.0.15. It can be downloaded on libusbx. org
at libusb.UsbSystem.initSystem(UsbSystem.java:28)
at libusb.UsbSystem.<init>(UsbSystem.java:15)
at linuxlib.JUsb.init(JUsb.java:21)
at gui.Main.initLinuxUsb(Main.java:47)
at gui.Main.main(Main.java:34)
I have libusbx 1.0.16 and libusb 0.1.5 installed, so how can I debug this? if someone can forward this to Androxyde I will be very grateful.
I am running Fedora 19 x64 with both 32 and 64 bit libs installed, as per Flashtool site instructions. Current Java (Oracle) is Java(TM) SE Runtime Environment (build 1.7.0_45-b18), 64-bit version.
Thank you
***EDIT*** This post is no longer relevant, check the next post down.
luzemario said:
As I still don't made sufficient posts to put it directly to dev forum, it's here. Admins, please move it to correct sections as you desire.
I installed the latest version of Flashtool for Linux. I followed the instructions at flashtool. net/install. php and tried to run './Flashtool'. here is the output:
[[email protected] FlashTool]# ./FlashTool
Running as root.
JAVA_HOME not set. Using default value : ./x10flasher_lib/linjre64
libusb.LibUsbException: Libusb not found. Minimum libusb version is 1.0.15. It can be downloaded on libusbx. org
at libusb.UsbSystem.initSystem(UsbSystem.java:28)
at libusb.UsbSystem.<init>(UsbSystem.java:15)
at linuxlib.JUsb.init(JUsb.java:21)
at gui.Main.initLinuxUsb(Main.java:47)
at gui.Main.main(Main.java:34)
I have libusbx 1.0.16 and libusb 0.1.5 installed, so how can I debug this? if someone can forward this to Androxyde I will be very grateful.
I am running Fedora 19 x64 with both 32 and 64 bit libs installed, as per Flashtool site instructions. Current Java (Oracle) is Java(TM) SE Runtime Environment (build 1.7.0_45-b18), 64-bit version.
Thank you
Click to expand...
Click to collapse
I found on my system (arch linux) the libusbx libs were named differently from what flashtool is looking for.
FlashTool was looking for "/usr/lib/libusbx-1.0.so" and "/usr/lib/libusbx-1.0.so.0.1.0"
but what i had was "/usr/lib/libusb-1.0.so" and "/usr/lib/libusb-1.0.so.0.1.0" respectively.
I created Symbolic links so that flashtool would find what it was looking for...
"ln -s /usr/lib/libusb-1.0.so.0.1.0 /usr/lib/libusbx-1.0.so.0.1.0"
&
"ln -s /usr/lib/libusb-1.0.so /usr/lib/libusbx-1.0.so"
(Ran in root terminal without qoutes) That fixed it for me.
Perhaps those libs are also named differently on fedora too? i used "find / -name libusb*" (in root terminal without qoutes) to check for them on my system.
It's also possible to change the searched for filenames in "FlashTool" (the launching script) itself by editing it but that would need to be redone with every new version unless fixed/changed by the developers. the lines that would need changed are..
"ln -sf libusbx-1.0.so.0.1.0 ./x10flasher_lib/linux/lib32/libusbx-1.0.so"
"ln -sf libusbx-1.0.so.0.1.0 ./x10flasher_lib/linux/lib64/libusbx-1.0.so"
(I've bolded the part to be changed for flashtool-0.9.13.0, it might be different in the future)
Hope this helps :good:
I decided to change flashtool's script/launcher so it looks for libusbx in a more robust (i hope) way. i've attached the changed file. If this works for you then we can submit the changes to the devs for their consideration.
#!/bin/sh
export BASEDIR=$(dirname $0)
export system64=$(uname -m)
export OS=$(uname -s)
cd $BASEDIR
if test "$OS" = "Linux"
then
chmod 755 ./x10flasher_lib/adb.linux
chmod 755 ./x10flasher_lib/fastboot.linux
chmod 755 ./x10flasher_lib/unyaffs.linux
chmod 755 ./x10flasher_lib/bin2elf
chmod 755 ./x10flasher_lib/bin2sin
if [ "$(whoami)" != "root" ]
then
export HASRULES="false"
if test -d /etc/udev/rules.d
then
if grep -rl "0fce" /etc/udev/rules.d >/dev/null
then
export HASRULES="true"
fi
fi
if test "$HASRULES" = "true"
then
echo "Not running as root but Sony/SonyEriccson Vendor ID found on your udev rules"
echo "if Flashing didn't work well, run flashtool as root"
else
echo "Not running as root and there is no Sony/SonyEriccson Vendor ID on your udev rules"
echo "The user must be granted access to adb/flashmode/fastboot"
echo "If you are unsure what to do, run flashtool as root"
exit 1
fi
else
echo "Running as root."
fi
if test -z "${JAVA_HOME}"
then
if test "${system64}" = "x86_64"
then
export JAVA_HOME=./x10flasher_lib/linjre64
else
export JAVA_HOME=./x10flasher_lib/linjre32
fi
echo "JAVA_HOME not set. Using default value : ${JAVA_HOME}"
fi
if test -e ${JAVA_HOME}/bin/java
then
export LD_LIBRARY_PATH=./x10flasher_lib/linux/lib32
export LD_LIBRARY_PATH=./x10flasher_lib/linux/lib64:$LD_LIBRARY_PATH
#Begin changes by deagon 02/11/13
#ln -sf libusbx-1.0.so.0.1.0 ./x10flasher_lib/linux/lib32/libusbx-1.0.so
#ln -sf libusbx-1.0.so.0.1.0 ./x10flasher_lib/linux/lib64/libusbx-1.0.so
find /*/lib -name 'libusb*.0.1.0' -exec ln -sf {\} ./x10flasher_lib/linux/lib32/libusbx-1.0.so \;
find /*/lib -name 'libusb*.0.1.0' -exec ln -sf {\} ./x10flasher_lib/linux/lib64/libusbx-1.0.so \;
#End changes by deagon 02/11/13
ISJAVA6=$($JAVA_HOME/bin/java -version 2>&1|grep version|grep 1.6|wc -l)
ISJAVA7=$($JAVA_HOME/bin/java -version 2>&1|grep version|grep 1.7|wc -l)
ISJAVA64=$($JAVA_HOME/bin/java -version 2>&1|grep 64-Bit|wc -l)
if test $ISJAVA6 -gt 0 -o $ISJAVA7 -gt 0
then
if test $ISJAVA64 -gt 0
then
ln -sf swt64.jar ./x10flasher_lib/swtlin/swt.jar
else
ln -sf swt32.jar ./x10flasher_lib/swtlin/swt.jar
fi
$JAVA_HOME/bin/java -Xms128m -Xmx512m -Duser.country=US -Duser.language=en -jar x10flasher.jar
else
echo "Java version must be 1.6 or 1.7"
fi
else
echo "No Java in specified path in JAVA_HOME=${JAVA_HOME}"
echo "Set the variable to a valid Java installation"
fi
else
chmod 755 ./x10flasher_lib/adb.mac
chmod 755 ./x10flasher_lib/fastboot.mac
chmod 755 ./x10flasher_lib/unyaffs.mac
export DYLD_LIBRARY_PATH=./x10flasher_lib/mac/lib64:$DYLD_LIBRARY_PATH
export DYLD_LIBRARY_PATH=./x10flasher_lib/mac/lib32:$DYLD_LIBRARY_PATH
ln -sf libusbx-1.0.0.dylib ./x10flasher_lib/mac/lib64/libusbx-1.0.dylib
ln -sf libusbx-1.0.0.dylib ./x10flasher_lib/mac/lib32/libusbx-1.0.dylib
ISJAVA6=$(java -version 2>&1|grep version|grep 1.6|wc -l)
ISJAVA7=$(java -version 2>&1|grep version|grep 1.7|wc -l)
ISJAVA64=$(java -version 2>&1|grep 64-Bit|wc -l)
if test $ISJAVA64 -gt 0
then
ln -sf swt64.jar ./x10flasher_lib/swtmac/swt.jar
else
ln -sf swt32.jar ./x10flasher_lib/swtmac/swt.jar
fi
if test $ISJAVA6 -gt 0 -o $ISJAVA7 -gt 0
then
java -XstartOnFirstThread -Xms128m -Xmx512m -Duser.country=US -Duser.language=en -jar x10flasher.jar
else
echo "Java version must be 1.6 or 1.7"
fi
fi
let me know how you get on :good:
-- deagon
***EDIT*** I found a downside. The the new script/launcher is going to find and use either the old libusb or libusbx so it may create more problems than it solves for some users if they dont install libusbx before using flashtool.
Another problem will arise if the distro's libusbx package maintainers havent over written the old libusb libs to use libusbx as a drop in replacement like on arch and fedora 19 (i checked inside the fedora libusbx package before) because the changed script/launcher will likely link to libusb before libusbx if they are sitting next to each other.
Deagon said:
I decided to change flashtool's script/launcher so it looks for libusbx in a more robust (i hope) way. i've attached the changed file. If this works for you then we can submit the changes to the devs for their consideration.
#!/bin/sh
export BASEDIR=$(dirname $0)
export system64=$(uname -m)
export OS=$(uname -s)
cd $BASEDIR
if test "$OS" = "Linux"
then
chmod 755 ./x10flasher_lib/adb.linux
chmod 755 ./x10flasher_lib/fastboot.linux
chmod 755 ./x10flasher_lib/unyaffs.linux
chmod 755 ./x10flasher_lib/bin2elf
chmod 755 ./x10flasher_lib/bin2sin
if [ "$(whoami)" != "root" ]
then
export HASRULES="false"
if test -d /etc/udev/rules.d
then
if grep -rl "0fce" /etc/udev/rules.d >/dev/null
then
export HASRULES="true"
fi
fi
if test "$HASRULES" = "true"
then
echo "Not running as root but Sony/SonyEriccson Vendor ID found on your udev rules"
echo "if Flashing didn't work well, run flashtool as root"
else
echo "Not running as root and there is no Sony/SonyEriccson Vendor ID on your udev rules"
echo "The user must be granted access to adb/flashmode/fastboot"
echo "If you are unsure what to do, run flashtool as root"
exit 1
fi
else
echo "Running as root."
fi
if test -z "${JAVA_HOME}"
then
if test "${system64}" = "x86_64"
then
export JAVA_HOME=./x10flasher_lib/linjre64
else
export JAVA_HOME=./x10flasher_lib/linjre32
fi
echo "JAVA_HOME not set. Using default value : ${JAVA_HOME}"
fi
if test -e ${JAVA_HOME}/bin/java
then
export LD_LIBRARY_PATH=./x10flasher_lib/linux/lib32
export LD_LIBRARY_PATH=./x10flasher_lib/linux/lib64:$LD_LIBRARY_PATH
#Begin changes by deagon 02/11/13
#ln -sf libusbx-1.0.so.0.1.0 ./x10flasher_lib/linux/lib32/libusbx-1.0.so
#ln -sf libusbx-1.0.so.0.1.0 ./x10flasher_lib/linux/lib64/libusbx-1.0.so
find /*/lib -name 'libusb*.0.1.0' -exec ln -sf {\} ./x10flasher_lib/linux/lib32/libusbx-1.0.so \;
find /*/lib -name 'libusb*.0.1.0' -exec ln -sf {\} ./x10flasher_lib/linux/lib64/libusbx-1.0.so \;
#End changes by deagon 02/11/13
ISJAVA6=$($JAVA_HOME/bin/java -version 2>&1|grep version|grep 1.6|wc -l)
ISJAVA7=$($JAVA_HOME/bin/java -version 2>&1|grep version|grep 1.7|wc -l)
ISJAVA64=$($JAVA_HOME/bin/java -version 2>&1|grep 64-Bit|wc -l)
if test $ISJAVA6 -gt 0 -o $ISJAVA7 -gt 0
then
if test $ISJAVA64 -gt 0
then
ln -sf swt64.jar ./x10flasher_lib/swtlin/swt.jar
else
ln -sf swt32.jar ./x10flasher_lib/swtlin/swt.jar
fi
$JAVA_HOME/bin/java -Xms128m -Xmx512m -Duser.country=US -Duser.language=en -jar x10flasher.jar
else
echo "Java version must be 1.6 or 1.7"
fi
else
echo "No Java in specified path in JAVA_HOME=${JAVA_HOME}"
echo "Set the variable to a valid Java installation"
fi
else
chmod 755 ./x10flasher_lib/adb.mac
chmod 755 ./x10flasher_lib/fastboot.mac
chmod 755 ./x10flasher_lib/unyaffs.mac
export DYLD_LIBRARY_PATH=./x10flasher_lib/mac/lib64:$DYLD_LIBRARY_PATH
export DYLD_LIBRARY_PATH=./x10flasher_lib/mac/lib32:$DYLD_LIBRARY_PATH
ln -sf libusbx-1.0.0.dylib ./x10flasher_lib/mac/lib64/libusbx-1.0.dylib
ln -sf libusbx-1.0.0.dylib ./x10flasher_lib/mac/lib32/libusbx-1.0.dylib
ISJAVA6=$(java -version 2>&1|grep version|grep 1.6|wc -l)
ISJAVA7=$(java -version 2>&1|grep version|grep 1.7|wc -l)
ISJAVA64=$(java -version 2>&1|grep 64-Bit|wc -l)
if test $ISJAVA64 -gt 0
then
ln -sf swt64.jar ./x10flasher_lib/swtmac/swt.jar
else
ln -sf swt32.jar ./x10flasher_lib/swtmac/swt.jar
fi
if test $ISJAVA6 -gt 0 -o $ISJAVA7 -gt 0
then
java -XstartOnFirstThread -Xms128m -Xmx512m -Duser.country=US -Duser.language=en -jar x10flasher.jar
else
echo "Java version must be 1.6 or 1.7"
fi
fi
let me know how you get on :good:
-- deagon
***EDIT*** I found a downside. The the new script/launcher is going to find and use either the old libusb or libusbx so it may create more problems than it solves for some users if they dont install libusbx before using flashtool.
Another problem will arise if the distro's libusbx package maintainers havent over written the old libusb libs to use libusbx as a drop in replacement like on arch and fedora 19 (i checked inside the fedora libusbx package before) because the changed script/launcher will likely link to libusb before libusbx if they are sitting next to each other.
Click to expand...
Click to collapse
not working for me. same error.
Same error
QkiZMR said:
not working for me. same error.
Click to expand...
Click to collapse
Same error here, need help please!!
nefsation said:
Same error here, need help please!!
Click to expand...
Click to collapse
first go to this http://www.libusbx.org
and download latest source (tarball)
extract that .tar.gz and go to that dir
now run the following commands
Code:
./config
make
sudo make install
assuming your Flashtool folder is in home
run the following commands
Code:
cd
cp /usr/local/lib/libusb-1.0.so.0.1.0 FlashTool/x10flasher_lib/linux/lib64
cp /usr/local/lib/libusb-1.0.so.0.1.0 FlashTool/x10flasher_lib/linux/lib32
replace the FlashTool script in FlashTool folder by this one FlashTool
FlashTool developer decided to bundle full JRE (both 32 and 64 bit) plus all these binaries and libraries with a relatively simple Java application for some strange reason. Lame. I've spent more than an hour downloading the 113 MB 7z archive from some sh*tty file-share service, instead spending just 1/4 of that time, and do something useful for the rest!
An average Linux user should be able to install these deps by herself, all she needs is a decent README specifiying the deps...
At least with the Ubuntu 13.10 (Saucy), libusb, which is at version 1.0.1.16, should work, so one does not need no freakin libusbx... This is for Saucy x86_64;
Code:
# One also needs basic 32-bit support, for running stuff like bin2sin, check libc6:i386 or similar:
sudo apt-get install android-tools-adb android-tools-fastboot libusb-1.0-0 default-jre
sudo ln -s libusb-1.0.so.0.1.0 /lib/x86_64-linux-gnu/libusbx-1.0.so
# Remove 260MB of rubbish:
cd <wherever you unpacked FlashTool>
rm -rf x10flasher_lib/{adb,fastboot}.linux x10flasher_lib/lin*
ln -s /usr/bin/adb x10flasher_lib/adb.linux
ln -s /usr/bin/fastboot x10flasher_lib/fastboot.linux
ln -s swt64.jar x10flasher_lib/swtlin/swt.jar
# Now, start the application
java -Xms128m -Xmx512m -Duser.language=en -jar x10flasher.jar
Zgembo said:
Code:
ln -s swt64.jar x10flasher_lib/swtlin/swt.jar
Click to expand...
Click to collapse
when i execute above command..it gives this error..
Code:
ln: failed to create symbolic link ‘x10flasher_lib/swtlin/swt.jar’: File exists
Edit: aha..finally flashtool successfully started with this method..i just replaced -s with -sf which forcefully does the operation

Rooting the webOS TV

pivotce.com informs that instructions have been published on gaining root access to a webOS TV. This is much harder than on the old phones and tablets. When this was done on legacy webOS, there was a wave of enhancements and tweaks made available to phone users from webOS Internals and other developers.
The instructions can be found on the Russian webOS forums here: webos-forums.ru/topic4650.html (English Translation via Google).
As the thread itself notes, this creates the possibility of fiddling with your TV in a way that may turn it into a large, thin brick and will almost certainly invalidate your warranty. The general user should stay well clear of this.
pivotCE published this for information only and recommend leaving investigations to those who know what they are doing or who can afford to wreck expensive television sets. We will watch to see if anything interesting emerges from this development.
+
Detailed analysis of the root access method described above:
forums.webosnation.com/lg-webos-tv/331754-pivotce-seems-webos-tv-has-been-rooted.html#post3450911
Hello!
I'm from webos-forums.ru. I've root on TV for a while and can help you with translation or testing on LG webOS 1.4.
rooting
I could use your help rooting my lg 65uf6450-ua if you would. Thank you
Root webOS
Hodizzal said:
I could use your help rooting my lg 65uf6450-ua if you would. Thank you
Click to expand...
Click to collapse
1. You need to install Developer Mode App and export private ssh-key with CLI (webostv.developer.lge.com/develop/app-test)
2. Convert private ssh-key with puttygen [import key <your private ssh-key>, then save private key]
3. Download exploit (zalil.su/6937580), then connect with TV User: prisoner, [<ip-tv>:9922] + private-key with WinSCP (or other SCP-client), upload to /media/developer on TV and rename it to root.
on linux
Code:
ssh -i <your private ssh-key> [email protected]<ip-tv> -p 9922 "/bin/sh -i"
4.
Code:
chmod +x root
Code:
./root
5. After try install any app from market go to LG App Store and try to install any app.
6. if third stage ok. the insert password 1111 as said.
7.
Code:
busybox chroot /proc/1/root
Code:
[email protected]tTV:/# id
Code:
uid=0(root) gid=0(root)........
I personally use Linux Subsystem on Windows 10 for all of this.
To install .ipk app:
Code:
ApplicationInstallerUtility -c install -p /tmp/<any-name>.ipk -u 0 -l /media/developer -d
Info about your linux kernel and TV firmware:
Code:
luna-send -n 1 -f luna://com.palm.systemservice/osInfo/query '{ "subscribe": false }'
Launch app:
Code:
luna-send -n 1 -f luna://com.webos.applicationManager/launch '{"id": "netflix"}'
All apps ID you can find with
Code:
luna-send -n 1 "palm://com.palm.applicationManager/listLaunchPoints" "{}"
or at a folder /media/cryptofs/apps/usr/palm/applications/<App ID>/appinfo.json
For permanent root access through telnet:
1)
Code:
[email protected]:/# mkdir -p /media/cryptofs/root/etc
2)
Code:
[email protected]:/# cp -r /etc/* /media/cryptofs/root/etc
3)
Code:
[email protected]:/# mount -o bind /media/cryptofs/root/etc /etc
4)
Code:
[email protected]:/# passwd root
Enter any new root password
5)
Code:
cp /media/cryptofs/apps/usr/palm/services/com.palmdts.devmode.service/start-devmode.sh /tmp/start-devmode.sh
6) Download with WinSCP start-devmode.sh and edit it locally.
You need to add at the beginning
Code:
mount -o bind /media/cryptofs/root/etc /etc
telnetd -l /sbin/sulogin &
Plus you can add the line to launch any App at start, e.g:
Code:
luna-send -n 1 -f luna://com.webos.applicationManager/launch '{"id": "netflix", "params":{}}'
And comment Dev Mode online check.
Here it's mine start-devmode.sh. It's for webOS 1.4. It can be different for other webOS versions:
Code:
#!/bin/sh
mount -o bind /media/cryptofs/root/etc /etc
telnetd -l /sbin/sulogin &
#luna-send -n 1 -f luna://com.webos.applicationManager/launch '{"id": "netflix", "params":{}}'
# FIXME: disable this to turn off script echo
set -x
# FIXME: disable this to stop script from bailing on error
# set -e
# TODO: Check upstart daemon/process tracking (do we need to change /etc/init/devmode.conf? start sshd as daemon?)
# set devmode ssh port here
SSH_PORT="9922"
# set arch:
ARCH="armv71"
grep -qs "qemux86" /etc/hostname && ARCH="i686"
# set directories
OPT_DEVMODE="/opt/devmode"
OPT_SSH="/opt/openssh"
DEVELOPER_HOME="/media/developer"
DEVMODE_SERVICE_DIR="/media/cryptofs/apps/usr/palm/services/com.palmdts.devmode.service"
CRYPTO_SSH="$DEVMODE_SERVICE_DIR/binaries-${ARCH}/opt/openssh"
CRYPTO_OPT="$DEVMODE_SERVICE_DIR/binaries-${ARCH}/opt"
if [ -s ${DEVMODE_SERVICE_DIR}/jail_app.conf ] ; then
mv ${DEVMODE_SERVICE_DIR}/jail_app.conf ${DEVELOPER_HOME}
mv ${DEVMODE_SERVICE_DIR}/jail_app.conf.sig ${DEVELOPER_HOME}
fi
if [ -r ${DEVMODE_SERVICE_DIR}/sessionToken ] ; then
mv -f ${DEVMODE_SERVICE_DIR}/sessionToken /var/luna/preferences/devmode_enabled
fi
# Make sure the ssh binaries are executable (in service directory)
if [ ! -x "${CRYPTO_SSH}/sbin/sshd" ] ; then
chmod ugo+x ${CRYPTO_SSH}/sbin/sshd ${CRYPTO_SSH}/bin/ssh* ${CRYPTO_SSH}/bin/scp* || true
chmod ugo+x ${CRYPTO_SSH}/bin/sftp ${CRYPTO_SSH}/lib/openssh/* || true
chmod ugo+x ${CRYPTO_OPT}/devmode/usr/bin/* || true
fi
# TODO: (later) Look for "re-init" flag to re-generate ssh key if requested by app (via devkey service)
# com.palm.service.devmode could have "resetKey" method to erase /var/lib/devmode/ssh/webos_rsa
# Kind of dangerous though, since new key will need to be fetched on the desktop (after reboot)...
# We could just require a hard-reset of the TV which should blow away /var/lib/devmode/ssh/...
# Initialize the developer (client) SSH key pair, if it doesn't already exist
if [ ! -e /var/lib/devmode/ssh/webos_rsa ] ; then
mkdir -p /var/lib/devmode/ssh
chmod 0700 /var/lib/devmode/ssh
# get FIRST six (UPPER-CASE, hex) characters of 40-char nduid from nyx-cmd
# NOTE: This MUST match passphrase as displayed in devmode app (main.js)!
# PASSPHRASE="`/usr/bin/nyx-cmd DeviceInfo query nduid | head -c 6 | tr 'a-z' 'A-Z'`"
# PASSPHRASE="`/usr/bin/nyx-cmd DeviceInfo query nduid | tail -n1 | head -c 6 | tr 'a-z' 'A-Z'`"
PASSPHRASE="`tail /var/lib/secretagent/nduid -c 40 | head -c 6 | tr 'a-z' 'A-Z'`"
${CRYPTO_SSH}/bin/ssh-keygen -t rsa -C "[email protected]" -N "${PASSPHRASE}" -f /var/lib/devmode/ssh/webos_rsa
# copy ssh key to /var/luna/preferences so the devmode service's KeyServer can read it and serve to ares-webos-cli tools
cp -f /var/lib/devmode/ssh/webos_rsa /var/luna/preferences/webos_rsa
chmod 0644 /var/luna/preferences/webos_rsa
# if we generated a new ssh key, make sure we re-create the authorized_keys file
rm -f ${DEVELOPER_HOME}/.ssh/authorized_keys
fi
# Make sure the /media/developer (and log) directories exists (as sam.conf erases it when devmode is off):
mkdir -p ${DEVELOPER_HOME}/log
chmod 777 ${DEVELOPER_HOME} ${DEVELOPER_HOME}/log
# Install the SSH key into the authorized_keys file (if it doesn't already exist)
if [ ! -e ${DEVELOPER_HOME}/.ssh/authorized_keys ] ; then
mkdir -p ${DEVELOPER_HOME}/.ssh
cp -f /var/lib/devmode/ssh/webos_rsa.pub ${DEVELOPER_HOME}/.ssh/authorized_keys || true
# NOTE: authorized_keys MUST be world-readable else sshd can't read it inside the devmode jail
# To keep sshd from complaining about that, we launch sshd with -o "StrictModes no" (below).
chmod 755 ${DEVELOPER_HOME}/.ssh
chmod 644 ${DEVELOPER_HOME}/.ssh/authorized_keys
chown -R developer:developer ${DEVELOPER_HOME}/.ssh
fi
# FIXME: Can we move this to /var/run/devmode/sshd ?
# Create PrivSep dir
mkdir -p /var/run/sshd
chmod 0755 /var/run/sshd
# Create directory for host keys (rather than /opt/openssh/etc/ssh/)
HOST_KEY_DIR="/var/lib/devmode/sshd"
if [ ! -d "${HOST_KEY_DIR}" ] ; then
mkdir -p ${HOST_KEY_DIR}
chmod 0700 ${HOST_KEY_DIR}
fi
# Create initial keys if necessary
if [ ! -f ${HOST_KEY_DIR}/ssh_host_rsa_key ]; then
echo " generating ssh RSA key..."
${CRYPTO_SSH}/bin/ssh-keygen -q -f ${HOST_KEY_DIR}/ssh_host_rsa_key -N '' -t rsa
fi
if [ ! -f ${HOST_KEY_DIR}/ssh_host_ecdsa_key ]; then
echo " generating ssh ECDSA key..."
${CRYPTO_SSH}/bin/ssh-keygen -q -f ${HOST_KEY_DIR}/ssh_host_ecdsa_key -N '' -t ecdsa
fi
if [ ! -f ${HOST_KEY_DIR}/ssh_host_dsa_key ]; then
echo " generating ssh DSA key..."
${CRYPTO_SSH}/bin/ssh-keygen -q -f ${HOST_KEY_DIR}/ssh_host_dsa_key -N '' -t dsa
fi
# Check config
# NOTE: This should only be enabled for testing
#${CRYPTO_SSH}/sbin/sshd -f ${CRYPTO_SSH}/etc/ssh/sshd_config -h ${HOST_KEY_DIR}/ssh_host_rsa_key -t
# Set jailer command
DEVMODE_JAIL="/usr/bin/jailer -t native_devmode -i com.palm.devmode.openssh -p ${DEVELOPER_HOME}/ -s /bin/sh"
#DEVMODE_JAIL="echo"
# Add for debugging, but this will cause sshd to exit after the first ssh login:
# -ddd -e
# Make environment file for openssh
DEVMODE_JAIL_CONF="/etc/jail_native_devmode.conf"
DEVMODE_OPENSSH_ENV="${DEVELOPER_HOME}/.ssh/environment"
if [ -f ${DEVMODE_JAIL_CONF} ]; then
echo " generating environment file from jail_native_devmode.conf..."
find ${DEVMODE_JAIL_CONF} | xargs awk '/setenv/{printf "%s=%sn", $2,$3}' > ${DEVMODE_OPENSSH_ENV}
${DEVMODE_JAIL} /usr/bin/env >> ${DEVMODE_OPENSSH_ENV}
fi
# Set path for devmode
if [ -f ${DEVMODE_OPENSSH_ENV} ]; then
echo "PATH=${PATH}:${OPT_DEVMODE}/usr/bin" >> ${DEVMODE_OPENSSH_ENV}
fi
sleep 5;
for interface in $(ls /sys/class/net/ | grep -v -e lo -e sit);
do
if [ -r /sys/class/net/$interface/carrier ] ; then
if [[ $(cat /sys/class/net/$interface/carrier) == 1 ]]; then OnLine=1; fi
fi
done
#if [ $OnLine ]; then
# sessionToken=$(cat /var/luna/preferences/devmode_enabled);
# checkSession=$(curl --max-time 3 -s https://developer.lge.com/secure/CheckDevModeSession.dev?sessionToken=$sessionToken);
# if [ "$checkSession" != "" ] ; then
# result=$(node -pe 'JSON.parse(process.argv[1]).result' "$checkSession");
# if [ "$result" == "success" ] ; then
rm -rf /var/luna/preferences/dc*;
# # create devSessionTime file to remain session time in devmode app
# remainTime=$(node -pe 'JSON.parse(process.argv[1]).errorMsg' "$checkSession");
# resultValidTimeCheck=$(echo "${remainTime}" | egrep "^([0-9]{1,4}(:[0-5][0-9]){2})$");
# if [ "$resultValidTimeCheck" != "" ] ; then
echo '900:00:00' > ${DEVMODE_SERVICE_DIR}/devSessionTime;
chgrp 5000 ${DEVMODE_SERVICE_DIR}/devSessionTime;
chmod 664 ${DEVMODE_SERVICE_DIR}/devSessionTime;
# fi
# elif [ "$result" == "fail" ] ; then
# rm -rf /var/luna/preferences/devmode_enabled;
# rm -rf /var/luna/preferences/dc*;
# if [ -e ${DEVMODE_SERVICE_DIR}/devSessionTime ] ; then
# rm ${DEVMODE_SERVICE_DIR}/devSessionTime;
# fi
# fi
# fi
#fi
# Cache clear function added (except Local storage)
if [ -e ${DEVMODE_SERVICE_DIR}/devCacheClear ] ; then
rm -rf `ls | find /var/lib/webappmanager*/* -name "Local Storage" -o -name "localstorage" -prune -o -print`;
rm ${DEVMODE_SERVICE_DIR}/devCacheClear;
fi
# Launch sshd
${DEVMODE_JAIL} ${OPT_SSH}/sbin/sshd
-o StrictModes=no
-f ${OPT_SSH}/etc/ssh/sshd_config
-h ${HOST_KEY_DIR}/ssh_host_rsa_key
-o PasswordAuthentication=no -o PermitRootLogin=no -o PermitUserEnvironment=yes
-D -p ${SSH_PORT}
7) Upload new start-devmode.sh and rewrite the old one
Code:
cp /tmp/start-devmode.sh /media/cryptofs/apps/usr/palm/services/com.palmdts.devmode.service/start-devmode.sh
8) Restart TV.
Connect with telnet and type previously entered password.
Code:
telnet <ip-tv>
Trying <ip-tv>...
Connected to <ip-tv>].
Escape character is '^]'.
webOS TV 1.4.0 LGSmartTV
Give root password for system maintenance
(or type Control-D for normal startup):
Entering System Maintenance Mode
[email protected]:/#
Does it work on WebOS 3.5 devices?
medi01 said:
Does it work on WebOS 3.5 devices?
Click to expand...
Click to collapse
Positive.
is it possible to install webOS 3.0 on an 65EF9500 that currently has WebOS 2.0 via the USB upgrade method?
enkrypt3d said:
is it possible to install webOS 3.0 on an 65EF9500 that currently has WebOS 2.0 via the USB upgrade method?
Click to expand...
Click to collapse
No
Is there any method to get 3.0 installed over 1.4 I have a 49ub8500-ua
syconu said:
Is there any method to get 3.0 installed over 1.4 I have a 49ub8500-ua
Click to expand...
Click to collapse
No
Is there anything hack related that I can do with this to and can is support a new air mouse with a dongle
Ok, so I get run the root app and first ,second , and third stage all are good. then it says try get root password is 1111. But the terminal keeps freezing after that happens. A couple times my tv rebooted too. I cant figure out what i could have messed up. ANyone with any experience using this method have any legit information?
steven817817 said:
Ok, so I get run the root app and first ,second , and third stage all are good. then it says try get root password is 1111. But the terminal keeps freezing after that happens. A couple times my tv rebooted too. I cant figure out what i could have messed up. ANyone with any experience using this method have any legit information?
Click to expand...
Click to collapse
Try to delete all 'cache' files from exploit at /media/developer. It doesn't wotk twice as far as I concerned
Is there anyway I can root my 1.4.0 and if so what r the benefits of the root? Can I install Android or kodi? What's the point
teffd said:
Try to delete all 'cache' files from exploit at /media/developer. It doesn't wotk twice as far as I concerned
Click to expand...
Click to collapse
I tried it stil seems to finish step 3 then says enter 1111. But this is where it freezes up and does not get any further.
Is this still working on 3.6? I'm stuck at try to install any app from market.
Mazda77 said:
Positive.
Click to expand...
Click to collapse
Which TV and firmware version?
Is this possible with UJ63 serie?
Hi, would the root access allow somehow to connect other bluetooth devices different than LG? Thanks!
You can do pretty much anything to the system with root, even include support for unsupported devices in form of additional kernel modules.
For example, I've added Samba support so I can mount use my NAS (see my blog at ddscentral dot org for details).
Hey guys is it possible to install android apps into WebOS? I just bought an Lg oled LG 55EG9A7V i want to use Perfect Player IPTV but i cant install it right now...Other then that i dont need anything else..
Can anyone help me?

Categories

Resources