get-a-robot-vpnc help - Touch CDMA Android Development

I have been trying to get the get-a-robot-vpnc (http://code.google.com/p/get-a-robot-vpnc/) package to work on my HTC Vogue for some time. I am currently running the eclair 2.1 mssmision build.
I have gotten pretty far I think.. but need some help. Here are the steps that I have followed up until now.
1. Compile tun.ko module for Vogue
I followed these instructions to get the vogue kernel locally: http://www.androidonhtc.com/get_involved
After step 5 in that list, make sure to select the "Device Drivers->Network Device Support->Universal TUN/TAP device driver support" (select as M for kernel module)
After step 6, build the kernel modules: "make modules ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi-"
2. Put tun.ko onto the vogue permanently
Set the /system partition writable
Code:
adb -d shell
#su
#mount -o remount,rw /system
In a different terminal, push the tun.ko over to the /system/lib/modules dir
Code:
adb -d push ~/android-kernel/kernel/drivers/net/tun.ko /system/lib/modules
Back in the first terminal, set the system volume to read only again.
Code:
#mount -o remount,ro /system
3. Install the latest get-a-robot-vpnc package
Download from website and push to device:
Code:
adb -d install VPN_Connections_v097.apk
It is installed to /data/data/org.codeandroid.vpnc_frontend directory.
I put in the correct settings to connect to my companies vpn. (These same settings work perfectly on my ubuntu machine)
When I run the program I see on logcat:
Code:
D/VPN_Connections( 658): Password is numeric
D/VPN_Connections( 658): password **********
D/VPN_Connections( 658): done interacting with vpnc
D/VPN_Connections( 658): process stderr:
D/VPN_Connections( 658):
D/VPN_Connections( 658): Attempt to read vpnc process id did not return anything
D/VPN_Connections( 658): process had died, return as failed connection
But when i shell into the phone I see the process running:
Code:
/ # ps | grep vpnc
658 10049 107m S org.codeandroid.vpnc_frontend
710 0 1300 S /data/data/org.codeandroid.vpnc_frontend/files/vpnc -
At this point the network is hosed and in order to get it back I have to reboot.
Trying it manually
In order to see what is happening with vpnc, I shell into the phone and run the program manually.
First I need to ensure the tun.ko is loaded:
Code:
#su
#insmod /system/lib/modules/tun.ko
You can see the command string for vpnc in the /data/data/org.codeandroid.vpnc_frontend/files/lastConnection.txt file.
I run this command:
Code:
/data/data/org.codeandroid.vpnc_frontend/files/vpnc --script /data/data/org.codeandroid.vpnc_frontend/files/vpnc-script --no-detach --debug 1
Enter the correct vpn data and see this output: (i cut out my company specific info and ip addresses)
Code:
vpnc version ERSION
IKE SA selected psk+xauth-3des-md5
NAT status: NAT-T VID seen, no NAT device detected
IKE SA selected psk+xauth-3des-md5
NAT status: NAT-T VID seen, no NAT device detected
Enter Username and Password.
Banner: Welcome <cut> Remote Access User.
got address <xxx.xxx.xxx.xxx>
Connect Banner:
| Welcome <cut> Remote Access User.
backing up dns and resolve.conf
vpnc-script ran to completion
IPSEC SA selected aes128-sha1
VPNC started in foreground...
vpnc[582]: can't open pidfile /var/run/vpnc/pid for writing
At this point I seem to be connected.. but can't actually ping anything on my company network, or get to any websites.
I am not very strong with networking.. so I feel that maybe the routes are not being setup properly.. but I don't know:
Here is my routing table after the connection (took out company ip)
Code:
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
68.28.145.85 * 255.255.255.255 UH 0 0 0 ppp0
xxx.xxx.xxx.xx 68.28.145.85 255.255.255.255 UGH 0 0 0 ppp0
default * 0.0.0.0 U 0 0 0 tun0
Any help would be appreciated.

Hey - I posted a response in the vpnc thread:
http://forum.xda-developers.com/showpost.php?p=5625056&postcount=109
Also, to amend - if you try it manually again, try this:
/data/data/org.codeandroid.vpnc_frontend/files/vpnc --script /data/data/org.codeandroid.vpnc_frontend/files/vpnc-script --no-detach --natt-mode cisco-udp --debug 1

Related

[Q] Full linux on G1?

Hey everyone!!
Since if got new phone (Moto Milestone), i was wondering is it possible to install linux (gentoo, debian) on my old G1?
So, not in chroot, but as only OS on device! i dont need GUI, just shell. I was thinking that /, boot, etc, bin and maybe some more would be in device rom, and rest on sdcard!!
3g modem is not important to work, but wifi and gps are must!!
can this be done? i want to find some use of my old, but faithfull, G1!!
P.S. mods, if I posted this in wrong topic, I appologize!
thx for any hints. i have 6+ years on linux experience, mostly with gentoo, so recompiling and configuring isn't big problem!!
Sent from my Milestone
amossam said:
Hey everyone!!
thx for any hints. i have 6+ years on linux experience, mostly with gentoo, so recompiling and configuring isn't big problem!!
Click to expand...
Click to collapse
so do it then
not sure why you think its difficult
Firerat said:
so do it then
not sure why you think its difficult
Click to expand...
Click to collapse
well, i think it wouldn't be easy, and I'm asking is it possible!
with all due respect, i don't think that yours tone is in place.
so just for your info, i appreciate your work werry much!
i don't know too much about booting process of G1, but i know that SPL transfers boot process to kernel, so i assume that there is no boot flag! and i cannot find any detailed explanation of booting process that is detailed and easy to understand...
so, instead of using that tone, i would be gratefull if you have any link to share!!
Sent from my Milestone
amossam said:
well, i think it wouldn't be easy, and I'm asking is it possible!
with all due respect, i don't think that yours tone is in place.
so just for your info, i appreciate your work werry much!
i don't know too much about booting process of G1, but i know that SPL transfers boot process to kernel, so i assume that there is no boot flag! and i cannot find any detailed explanation of booting process that is detailed and easy to understand...
so, instead of using that tone, i would be gratefull if you have any link to share!!
Sent from my Milestone
Click to expand...
Click to collapse
i have 6+ years on linux experience, mostly with gentoo, so recompiling and configuring isn't big problem!!
Click to expand...
Click to collapse
here is a very usefull link
http://www.google.com
it is great for doing internet searches
don't clam to be some linux guru if you are not
http://www.unixweblog.com/2010/03/htc-dreamg1-dual-boot-native-debian/
and here is how I found it
I googled
native linux on g1
you will see links to xda
its been done, and done and done
there is absolutely nothing wrong with the firerat's tone. I actually thanked him for that post... it was classic firerat!
I think if you learned how to use the search function.. you will see it haz been done. google is your best friend!! hey, bing works as well. ask jeeves may not... but such is the element of being a man of linus -- most linux people dont go into a police station and ask for the number to dial 911 and where they can dial this number to get some police help.
jesus.......i just did a search... it goes all the way back to the days of jesus h freke. 1998.
just frigging search. how can you operate a phone and not be able to operate a basic google search..
hold one second... my 4 year old dog who has half his chromosomes just did it...wow.... here it is.. http://forum.xda-developers.com/showthread.php?t=444419&page=40
plz dont thank me either. if you must thank someone, thank firerat... but i dont know if he wants your thanx.
have fun chrootin! and its good to see people care enough about their dream to not toss it in the recycle bin at tmobile. those things are powerful.
Firerat said:
here is a very usefull link
http://www.google.com
it is great for doing internet searches
don't clam to be some linux guru if you are not
http://www.unixweblog.com/2010/03/htc-dreamg1-dual-boot-native-debian/
and here is how I found it
I googled
native linux on g1
you will see links to xda
its been done, and done and done
Click to expand...
Click to collapse
its like watching fire be invented all over again!
i humbly applogise that i asked one question. i did some research but i couldn't get the right keywords...
btw, i didn't said that i'm linux guru, only that i have experience...
nwm, i'll move on on my own...
can please mod lock this or delete, obviously this is another stupid duplicate post...
Sent from my Milestone
amossam said:
i humbly applogise that i asked one question. i did some research but i couldn't get the right keywords...
btw, i didn't said that i'm linux guru, only that i have experience...
nwm, i'll move on on my own...
can please mod lock this or delete, obviously this is another stupid duplicate post...
Sent from my Milestone
Click to expand...
Click to collapse
install linux on g1
http://www.htc-dream-g1.net/en/Linux/Debian/Native
currently the 4th hit
Firerat said:
install linux on g1
http://www.htc-dream-g1.net/en/Linux/Debian/Native
currently the 4th hit
Click to expand...
Click to collapse
how simple can you get? lol
{Mod edit}
Here's how to do this:
HTC Dream Native Debian Linux - bibanon/android-development-codex Wiki​This guide was mostly organized by Novaspirit, refined on the Debian Wiki, and based on notes from XDA-Developers.
Here, we've fixed some glaring errors and updated it for Debian squeeze.
This guide will create a dual-boot Linux and Android system. The phone will boot normally into Android; just hold home+power when turning on to enter Debian Linux.
Working / Not Working​Working
Phone can boot!
SDCard reader/writer
Keyboard
LEDs
Touchscreen
Vibrator
USB Ethernet
Xorg with OpenMoko Kernel
Phone Call : I am able to answer an incomming call from console!
Unlock SIM Card and register on Network
Working with bugs
Trackball - No event on click with ball - must click and move ball slightly
TouchScreen (MonoTouch) - I can use it in console FBDEV, but with Xorg, the calibration doesn’t work - calibration is very difficult but doable
ALSA - Sound is low, when phone works, sound is very low, and alsamixer, for select OutPut has device bugs.
Xorg with my Kernel - The phone crashes (freeze) when you leave Xorg found this only happens sometimes not all
Not working
WiFi card is detected, but crashes when doing “ifconfig wlan0 up”.
Not tested
GPS
Accelerometers/Compas
Other USB Gadgets, like Storage
Bluetooth
Internet throug GSM/3G APN
Power management
Accelerated GL
Camera
TouchScreen (MultiTouch)
HOWTO​You will need:
A laptop with Debian-based Linux (Ubuntu, Debian, Linux Mint, etc.)
Just run it off a live CD
An HTC Dream/G1 or MyTouch 3G
8GB or larger SDCard
4GB for Linux, 4GB for Android
An Android 1.6 or higher Custom ROM that supports EXT2/3
only a few older Android versions lack it.
USB Debugging Enabled
HardSPL and Engineering SPL
gives you fastboot support
ADB and Fastboot
The easiest way to install them is to use Minimal ADB.
Partitioning the SDCard​
It's possible to use Android itself to partition it, but that's another guide...
Click to expand...
Click to collapse
obtain gparted using:
sudo apt-get install gparted
select your sdcard and select it on the top right menu
You will need three partitions:
fat32 (android)
ext3 (android apps and stuff if you got app2sd)
ext3 (debian)
For example, an 8GB SDCard would be partitioned like this:
2 GB FAT32 for Android
2 GB EXT3 for app2sd
4 GB EXT3 for my real Debian
After creating the partitions, make sure to record the names, found in gparted's top-right corner (ex. /dev/sdb1, /dev/sdc6).
The G1 will see those partitions with names: /dev/mmcblk0p3 or whatnot. Just add the last number of the /dev/sdb1 name, replacing that 3.
Keep your SDCard plugged in.
Generate the Debian Root Filesystem with debootstrap​We will use debootstrap to install all the necessary system packages to an image, which you will flash onto the G1.
mkdir debdroid
sudo /usr/sbin/debootstrap --foreign --arch armel squeeze debdroid/ http://http.debian.net/debian
Copy debootstrap to the SDCard​We now need to copy the system image to the G1. Change /dev/sdb3 to the EXT3 partition for Debian on your SDCard (The names were previously obtained from GParted).
mount /dev/sdb3 /mnt/memory # change correct device
sudo cp -pfr debdroid/* /mnt/memory/
umount /mnt/memory
debootstrap Second Stage​Now reboot into your G1, and connect it to the computer to begin the second phase of installation. Make sure USB Debugging is enabled, and your phone is recognized by ADB.
Mount the debian EXT3 partition:
adb shell
mkdir /data/mnt
mount -t ext3 /dev/block/mmcblk0p3 /data/mnt
Now your debian partition should be mounted to file system at /data/mnt
Next, we will chroot into the debian partition to start the second stage of installation. This will take about 25 minutes, so be patient and keep your phone charged.
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$PATH
export TERM=linux
export HOME=/root
export USER=root
chroot /data/mnt /debootstrap/debootstrap --second-stage
umount /data/mnt
rmdir /data/mnt
Set the SSH service to start on boot​We will need an SSH service running on the G1 for internet tethering from the PC. We have to install Galoula's SSH modules, and edit configuration files to start SSH on boot.
Insert the sdcard back into your Linux PC and run these commands:
(replace /dev/sdb2 with the name of your debian EXT3 partition)
(the package links will have to be updated for squeeze)
mount /dev/sdb2 /mnt
cd /mnt/tmp
wget http://www.galoula.net/fr/Tutoriels...ALOULA-001/Modules-2.6.32_GALOULA-001.tar.bz2
tar -jxvf Modules-2.6.32_GALOULA-001.tar.bz2 -C ..
echo g_ether >> ../etc/modules
echo "auto lo" >> ../etc/network/interfaces
echo "iface lo inet loopback" >> ../etc/network/interfaces
echo "auto usb0" >> ../etc/network/interfaces
echo "iface usb0 inet static" >> ../etc/network/interfaces
echo " address 192.168.0.202" >> ../etc/network/interfaces
echo " netmask 255.255.255.192" >> ../etc/network/interfaces
echo " network 192.168.100.0" >> ../etc/network/interfaces
echo " gateway 192.168.0.200" >> ../etc/network/interfaces
echo "none /sys sysfs rw,nosuid,nodev,noexec 0 0" >> ../etc/fstab
echo "none /proc proc rw,nosuid,nodev,noexec 0 0" >> ../etc/fstab
echo "udev /dev tmpfs rw,size=10240k,mode=755 0 0" >> ../etc/fstab
echo "devpts /dev/pts devpts rw,nosuid,noexec,gid=5,mode=620 0 0" >> ../etc/fstab
echo "HTC-Dream" > ../etc/hostname
echo "127.0.0.1 localhost HTC-Dream" > ../etc/hosts
cat /etc/resolv.conf > ../etc/resolv.conf
mkdir ../dev/pts
sync
cd
umount /mnt
Later on, we will also install the SSH packages on the phone itself.
Now insert the sdcard back into the G1, and plug the G1 into the computer.
Chroot Setup​
Note: Don't worry; we are still installing Native Debian Linux. We are only temporarily using a chroot for greater convenience when pumping in commands.
Click to expand...
Click to collapse
Make sure your Android G1 has a WiFi internet connection and USB Debugging enabled.
Set your phone to Stay Awake, so the phone will not suddenly cut off your wifi connection. Settings->Application->Development->Stay Awake
Disable WiFi sleep, which will cause download issues. Settings->Wifi->Menu Button->Advanced->Wifi Sleep Policy->Never sleep when plugged in
Enter the chroot​First, mount the Debian partition on the G1 from your PC, using these commands:
adb shell
mkdir /data/mnt
mount -t ext3 /dev/block/mmcblk0p3 /data/mnt
Then, enter the chroot:
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$PATH
export TERM=linux
export HOME=/root
export USER=root
chroot /data/mnt /bin/bash
Set up Squeeze Package Repositories​This will install the necessary Debian repositories and some basic packages to the G1.
Type the commands below to add squeeze package repositories:
echo "deb http://ftp.debian.org/debian/ squeeze main non-free contrib" >> /etc/apt/sources.list
echo "deb-src http://ftp.debian.org/debian/ squeeze main non-free contrib" >> /etc/apt/sources.list
echo "deb http://security.debian.org/ squeeze/updates main contrib non-free" >> /etc/apt/sources.list
echo "deb-src http://security.debian.org/ squeeze/updates main contrib non-free" >> /etc/apt/sources.list
echo "deb http://ftp.debian.org/debian squeeze-updates main contrib non-free" >> /etc/apt/sources.list
echo "deb-src http://ftp.debian.org/debian squeeze-updates main contrib non-free" >> /etc/apt/sources.list
apt-get update
apt-get install bzip2 build-essential
Install SSH​Finally, we can install the openssh packages. An SSH server allows you to access a USB connected phone from your computer, so you can pump in terminal commands using copy and paste.
Type this command in the same chroot at your computer:
apt-get install openssh-server openssh-client libkrb53 openssh-blacklist libedit2 udev libvolume-id0 libkeyutils1
/etc/init.d/ssh stop
Note: During installation, the G1 might restart unexpectedly. Simply enter the chroot again (see previous section).
Click to expand...
Click to collapse
Create a Root user password and exit the Chroot​We will want to create a root user password.
passwd
Type in the password you want to use (make sure that you only use numbers and letters! special characters cannot be easily entered).
As a security measure, text will not appear onscreen, so just keep typing and press enter when you've put it in.
Exit the Chroot​We're all done, so you can exit the chroot.
sync
exit # exits the chroot
umount /mnt
rmdir /data/mnt
exit # exits `adb shell`
Boot Linux​Put the sdcard back into your G1, Plug in your G1 to the PC, and type this command to enter fastboot mode:
adb reboot bootloader
Type this command on your Linux PC to download and boot the kernel.
wget http://www.galoula.net/fr/Tutoriels/HTC-DREAM-G1/FTP/Native_Debian/2.6.32_GALOULA-001/zImage
fastboot -c "console=tty0 no_console_suspend=1 root=/dev/mmcblk0p3 rootdelay=2 fbcon=rotate:1" boot ./zImage
Your phone will now boot into Debian.
Type in the Username and Password​As a security feature, nothing will be displayed while you type your password.
username: root
password: <the password that you created>
Tether your G1's internet connection to the PC​We have to forward your PC's internet connection to your G1. Type these commands in the computer:
ifconfig usb0 192.168.0.200/26
iptables -A POSTROUTING -t nat -s 192.168.0.0/24 -j MASQUERADE
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -D POSTROUTING -t nat -s 192.168.0.0/24 -j MASQUERADE
(not tested) Alternatively, use these commands: (recommended by Jorge Peñalba)
ifconfig usb0 192.168.0.200/26\
iptables -A POSTROUTING -t nat -s 192.168.0.0/24 -j MASQUERADE\
echo 1 \> /proc/sys/net/ipv4/ip\_forward\
ssh 192.168.0.202 -l root\
iptables -D POSTROUTING -t nat -s 192.168.0.0/24 -j MASQUERADE\
echo 0 \> /proc/sys/net/ipv4/ip\_forward
SSH into the G1​Use this command to SSH into the G1's command line, so you can send commands to it from your computer. Log into your phone with the same username and password you set before.
ssh 192.168.0.202
Enable Dual Boot (optional)​We will create a custom kernel for the phone to dual-boot between Android and Linux. This way, you will be able to hold power+home to boot Linux.
Use your computer to SSH into the G1 and run these commands:
cd /usr/src
wget http://www.galoula.net/fr/Tutoriels/HTC-DREAM-G1/FTP/Outils/mkboot.tar.bz2
tar -jxvf mkboot.tar.bz2
cd mkboot
make && make install
cd /usr/src
wget http://www.galoula.net/fr/Tutoriels/HTC-DREAM-G1/FTP/Outils/android-imagetools.tar.bz2
tar -jxvf android-imagetools.tar.bz2
cd android-imagetools
make && make install
cd /tmp
wget http://www.galoula.net/fr/Tutoriels/HTC-DREAM-G1/FTP/Native_Debian/2.6.32_GALOULA-001/zImage
wget http://wiki.openmoko.org/images/f/f6/Newramdisk.cpio.gz
mkbootimg --cmdline "console=tty0 no_console_suspend=1 root=/dev/mmcblk0p3 rootdelay=2 fbcon=rotate:1" \
--kernel zImage --ramdisk ./Newramdisk.cpio.gz -o Recovery-boot.img
cat /dev/zero > /dev/mtd1
mkdir /dev/mtd
cd /dev/ && for i in `ls -w1 mtd?`;do ln -s /dev/$i /dev/mtd/$i; done && cd - || cd -
flash_image recovery Recovery-boot.img
Normal boot will get you into Android
Holding home and power will boot into debian
Galoula's Netinstall​How to Install Ubuntu with Ubuntu-Install.img ?
Download Ubuntu-Install.img on your Linux-PC.
Turn off your HTC G1.
Turn On HTC G1 in FastBosst mode : Power on with hold the camera button, if it's OK, you can see 3 Android on Skateboards.
In this screen press Back.
Connect USB cable betweek PC and G1.
On your Linux PC type this command : "fastboot boot Ubuntu-Install.img" without quotes.
If the G1 don't start, press the back button on G1.
The G1 start the Ubuntu Installer.
Warning ! My image is set for a French G1 keymap.
The special keys are :
Up : End
Down : Back
Left : Home
Right : Call
Escape : menu (on keyboard)
Tab : Right alt with Q.
Control : Search Button
For get networking works : This kernel use USB-NET.
To configure IT :​On the Linux PC :
sudo ifconfig usb0 192.168.0.200 netmask 255.255.255.0 up
iptables -A POSTROUTING -t nat -j MASQUERADE -s 192.168.0.0/24
sysctl -w net.ipv4.ip_forward=1
On the G1 :​When the installer tell you for Networking Configuration, chose usb0
You can cancel the DHCP discover.
Type this settings :
IP Address : 192.168.0.202
NetMask : 255.255.255.0
GateWay : 192.168.0.200
DNS : Your DNS
The setup tell you because it can't download "kernel modules", chose continue, my kernel can read the SDCARD for the installation, but it can't read internal partition for more secure.
The setup can tell you a warning because the kernel can't be installed, please continue (and ignore it) because, Ubuntu-Rescue.img contain the appropriate kernel.
Actualy, the file is : boot-recovery.img
Now, you can setup your Ubuntu !
Galoula's Netinstall images
Page Index for this GitHub Wiki
Source: Github
ppp- said:
Here's how to do this:
HTC Dream Native Debian Linux - bibanon/android-development-codex Wiki​This guide was mostly organized by Novaspirit, refined on the Debian Wiki, and based on notes from XDA-Developers.
Here, we've fixed some glaring errors and updated it for Debian squeeze.
This guide will create a dual-boot Linux and Android system. The phone will boot normally into Android; just hold home+power when turning on to enter Debian Linux.
Working / Not Working​Working
Phone can boot!
SDCard reader/writer
Keyboard
LEDs
Touchscreen
Vibrator
USB Ethernet
Xorg with OpenMoko Kernel
Phone Call : I am able to answer an incomming call from console!
Unlock SIM Card and register on Network
Working with bugs
Trackball - No event on click with ball - must click and move ball slightly
TouchScreen (MonoTouch) - I can use it in console FBDEV, but with Xorg, the calibration doesn’t work - calibration is very difficult but doable
ALSA - Sound is low, when phone works, sound is very low, and alsamixer, for select OutPut has device bugs.
Xorg with my Kernel - The phone crashes (freeze) when you leave Xorg found this only happens sometimes not all
Not working
WiFi card is detected, but crashes when doing “ifconfig wlan0 up”.
Not tested
GPS
Accelerometers/Compas
Other USB Gadgets, like Storage
Bluetooth
Internet throug GSM/3G APN
Power management
Accelerated GL
Camera
TouchScreen (MultiTouch)
HOWTO​You will need:
A laptop with Debian-based Linux (Ubuntu, Debian, Linux Mint, etc.)
Just run it off a live CD
An HTC Dream/G1 or MyTouch 3G
8GB or larger SDCard
4GB for Linux, 4GB for Android
An Android 1.6 or higher Custom ROM that supports EXT2/3
only a few older Android versions lack it.
USB Debugging Enabled
HardSPL and Engineering SPL
gives you fastboot support
ADB and Fastboot
The easiest way to install them is to use Minimal ADB.
Partitioning the SDCard​
obtain gparted using:
sudo apt-get install gparted
select your sdcard and select it on the top right menu
You will need three partitions:
fat32 (android)
ext3 (android apps and stuff if you got app2sd)
ext3 (debian)
For example, an 8GB SDCard would be partitioned like this:
2 GB FAT32 for Android
2 GB EXT3 for app2sd
4 GB EXT3 for my real Debian
After creating the partitions, make sure to record the names, found in gparted's top-right corner (ex. /dev/sdb1, /dev/sdc6).
The G1 will see those partitions with names: /dev/mmcblk0p3 or whatnot. Just add the last number of the /dev/sdb1 name, replacing that 3.
Keep your SDCard plugged in.
Generate the Debian Root Filesystem with debootstrap​We will use debootstrap to install all the necessary system packages to an image, which you will flash onto the G1.
mkdir debdroid
sudo /usr/sbin/debootstrap --foreign --arch armel squeeze debdroid/ http://http.debian.net/debian
Copy debootstrap to the SDCard​We now need to copy the system image to the G1. Change /dev/sdb3 to the EXT3 partition for Debian on your SDCard (The names were previously obtained from GParted).
mount /dev/sdb3 /mnt/memory # change correct device
sudo cp -pfr debdroid/* /mnt/memory/
umount /mnt/memory
debootstrap Second Stage​Now reboot into your G1, and connect it to the computer to begin the second phase of installation. Make sure USB Debugging is enabled, and your phone is recognized by ADB.
Mount the debian EXT3 partition:
adb shell
mkdir /data/mnt
mount -t ext3 /dev/block/mmcblk0p3 /data/mnt
Now your debian partition should be mounted to file system at /data/mnt
Next, we will chroot into the debian partition to start the second stage of installation. This will take about 25 minutes, so be patient and keep your phone charged.
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$PATH
export TERM=linux
export HOME=/root
export USER=root
chroot /data/mnt /debootstrap/debootstrap --second-stage
umount /data/mnt
rmdir /data/mnt
Set the SSH service to start on boot​We will need an SSH service running on the G1 for internet tethering from the PC. We have to install Galoula's SSH modules, and edit configuration files to start SSH on boot.
Insert the sdcard back into your Linux PC and run these commands:
(replace /dev/sdb2 with the name of your debian EXT3 partition)
(the package links will have to be updated for squeeze)
mount /dev/sdb2 /mnt
cd /mnt/tmp
wget http://www.galoula.net/fr/Tutoriels...ALOULA-001/Modules-2.6.32_GALOULA-001.tar.bz2
tar -jxvf Modules-2.6.32_GALOULA-001.tar.bz2 -C ..
echo g_ether >> ../etc/modules
echo "auto lo" >> ../etc/network/interfaces
echo "iface lo inet loopback" >> ../etc/network/interfaces
echo "auto usb0" >> ../etc/network/interfaces
echo "iface usb0 inet static" >> ../etc/network/interfaces
echo " address 192.168.0.202" >> ../etc/network/interfaces
echo " netmask 255.255.255.192" >> ../etc/network/interfaces
echo " network 192.168.100.0" >> ../etc/network/interfaces
echo " gateway 192.168.0.200" >> ../etc/network/interfaces
echo "none /sys sysfs rw,nosuid,nodev,noexec 0 0" >> ../etc/fstab
echo "none /proc proc rw,nosuid,nodev,noexec 0 0" >> ../etc/fstab
echo "udev /dev tmpfs rw,size=10240k,mode=755 0 0" >> ../etc/fstab
echo "devpts /dev/pts devpts rw,nosuid,noexec,gid=5,mode=620 0 0" >> ../etc/fstab
echo "HTC-Dream" > ../etc/hostname
echo "127.0.0.1 localhost HTC-Dream" > ../etc/hosts
cat /etc/resolv.conf > ../etc/resolv.conf
mkdir ../dev/pts
sync
cd
umount /mnt
Later on, we will also install the SSH packages on the phone itself.
Now insert the sdcard back into the G1, and plug the G1 into the computer.
Chroot Setup​
Make sure your Android G1 has a WiFi internet connection and USB Debugging enabled.
Set your phone to Stay Awake, so the phone will not suddenly cut off your wifi connection. Settings->Application->Development->Stay Awake
Disable WiFi sleep, which will cause download issues. Settings->Wifi->Menu Button->Advanced->Wifi Sleep Policy->Never sleep when plugged in
Enter the chroot​First, mount the Debian partition on the G1 from your PC, using these commands:
adb shell
mkdir /data/mnt
mount -t ext3 /dev/block/mmcblk0p3 /data/mnt
Then, enter the chroot:
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$PATH
export TERM=linux
export HOME=/root
export USER=root
chroot /data/mnt /bin/bash
Set up Squeeze Package Repositories​This will install the necessary Debian repositories and some basic packages to the G1.
Type the commands below to add squeeze package repositories:
echo "deb http://ftp.debian.org/debian/ squeeze main non-free contrib" >> /etc/apt/sources.list
echo "deb-src http://ftp.debian.org/debian/ squeeze main non-free contrib" >> /etc/apt/sources.list
echo "deb http://security.debian.org/ squeeze/updates main contrib non-free" >> /etc/apt/sources.list
echo "deb-src http://security.debian.org/ squeeze/updates main contrib non-free" >> /etc/apt/sources.list
echo "deb http://ftp.debian.org/debian squeeze-updates main contrib non-free" >> /etc/apt/sources.list
echo "deb-src http://ftp.debian.org/debian squeeze-updates main contrib non-free" >> /etc/apt/sources.list
apt-get update
apt-get install bzip2 build-essential
Install SSH​Finally, we can install the openssh packages. An SSH server allows you to access a USB connected phone from your computer, so you can pump in terminal commands using copy and paste.
Type this command in the same chroot at your computer:
apt-get install openssh-server openssh-client libkrb53 openssh-blacklist libedit2 udev libvolume-id0 libkeyutils1
/etc/init.d/ssh stop
Create a Root user password and exit the Chroot​We will want to create a root user password.
passwd
Type in the password you want to use (make sure that you only use numbers and letters! special characters cannot be easily entered).
As a security measure, text will not appear onscreen, so just keep typing and press enter when you've put it in.
Exit the Chroot​We're all done, so you can exit the chroot.
sync
exit # exits the chroot
umount /mnt
rmdir /data/mnt
exit # exits `adb shell`
Boot Linux​Put the sdcard back into your G1, Plug in your G1 to the PC, and type this command to enter fastboot mode:
adb reboot bootloader
Type this command on your Linux PC to download and boot the kernel.
wget http://www.galoula.net/fr/Tutoriels/HTC-DREAM-G1/FTP/Native_Debian/2.6.32_GALOULA-001/zImage
fastboot -c "console=tty0 no_console_suspend=1 root=/dev/mmcblk0p3 rootdelay=2 fbcon=rotate:1" boot ./zImage
Your phone will now boot into Debian.
Type in the Username and Password​As a security feature, nothing will be displayed while you type your password.
username: root
password: <the password that you created>
Tether your G1's internet connection to the PC​We have to forward your PC's internet connection to your G1. Type these commands in the computer:
ifconfig usb0 192.168.0.200/26
iptables -A POSTROUTING -t nat -s 192.168.0.0/24 -j MASQUERADE
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -D POSTROUTING -t nat -s 192.168.0.0/24 -j MASQUERADE
(not tested) Alternatively, use these commands: (recommended by Jorge Peñalba)
ifconfig usb0 192.168.0.200/26\
iptables -A POSTROUTING -t nat -s 192.168.0.0/24 -j MASQUERADE\
echo 1 \> /proc/sys/net/ipv4/ip\_forward\
ssh 192.168.0.202 -l root\
iptables -D POSTROUTING -t nat -s 192.168.0.0/24 -j MASQUERADE\
echo 0 \> /proc/sys/net/ipv4/ip\_forward
SSH into the G1​Use this command to SSH into the G1's command line, so you can send commands to it from your computer. Log into your phone with the same username and password you set before.
ssh 192.168.0.202
Enable Dual Boot (optional)​We will create a custom kernel for the phone to dual-boot between Android and Linux. This way, you will be able to hold power+home to boot Linux.
Use your computer to SSH into the G1 and run these commands:
cd /usr/src
wget http://www.galoula.net/fr/Tutoriels/HTC-DREAM-G1/FTP/Outils/mkboot.tar.bz2
tar -jxvf mkboot.tar.bz2
cd mkboot
make && make install
cd /usr/src
wget http://www.galoula.net/fr/Tutoriels/HTC-DREAM-G1/FTP/Outils/android-imagetools.tar.bz2
tar -jxvf android-imagetools.tar.bz2
cd android-imagetools
make && make install
cd /tmp
wget http://www.galoula.net/fr/Tutoriels/HTC-DREAM-G1/FTP/Native_Debian/2.6.32_GALOULA-001/zImage
wget http://wiki.openmoko.org/images/f/f6/Newramdisk.cpio.gz
mkbootimg --cmdline "console=tty0 no_console_suspend=1 root=/dev/mmcblk0p3 rootdelay=2 fbcon=rotate:1" \
--kernel zImage --ramdisk ./Newramdisk.cpio.gz -o Recovery-boot.img
cat /dev/zero > /dev/mtd1
mkdir /dev/mtd
cd /dev/ && for i in `ls -w1 mtd?`;do ln -s /dev/$i /dev/mtd/$i; done && cd - || cd -
flash_image recovery Recovery-boot.img
Normal boot will get you into Android
Holding home and power will boot into debian
Galoula's Netinstall​How to Install Ubuntu with Ubuntu-Install.img ?
Download Ubuntu-Install.img on your Linux-PC.
Turn off your HTC G1.
Turn On HTC G1 in FastBosst mode : Power on with hold the camera button, if it's OK, you can see 3 Android on Skateboards.
In this screen press Back.
Connect USB cable betweek PC and G1.
On your Linux PC type this command : "fastboot boot Ubuntu-Install.img" without quotes.
If the G1 don't start, press the back button on G1.
The G1 start the Ubuntu Installer.
Warning ! My image is set for a French G1 keymap.
The special keys are :
Up : End
Down : Back
Left : Home
Right : Call
Escape : menu (on keyboard)
Tab : Right alt with Q.
Control : Search Button
For get networking works : This kernel use USB-NET.
To configure IT :​On the Linux PC :
sudo ifconfig usb0 192.168.0.200 netmask 255.255.255.0 up
iptables -A POSTROUTING -t nat -j MASQUERADE -s 192.168.0.0/24
sysctl -w net.ipv4.ip_forward=1
On the G1 :​When the installer tell you for Networking Configuration, chose usb0
You can cancel the DHCP discover.
Type this settings :
IP Address : 192.168.0.202
NetMask : 255.255.255.0
GateWay : 192.168.0.200
DNS : Your DNS
The setup tell you because it can't download "kernel modules", chose continue, my kernel can read the SDCARD for the installation, but it can't read internal partition for more secure.
The setup can tell you a warning because the kernel can't be installed, please continue (and ignore it) because, Ubuntu-Rescue.img contain the appropriate kernel.
Actualy, the file is : boot-recovery.img
Now, you can setup your Ubuntu !
Galoula's Netinstall images
Page Index for this GitHub Wiki
Source: Github
Click to expand...
Click to collapse
Wow. That's a ton of info! I'll try.
ppp- said:
{Mod edit}
Here's how to do this:
Click to expand...
Click to collapse
@ppp- I've edited your post above and removed the part that was simply intended to offend another user. Be aware that XDA is not like the common social media, and we're enforcing the XDA Forum Rules that have been established, and to which you agreed to adhere when you registered on this private platform a few days ago. Please review the forum rules with special emphasis on rule no. 2 regarding member conduct. Thanks for your cooperation.
Regards
Oswald Boelcke
Senior Moderator
ppp- said:
{Mod edit}
Here's how to do this:
HTC Dream Native Debian Linux - bibanon/android-development-codex Wiki​This guide was mostly organized by Novaspirit, refined on the Debian Wiki, and based on notes from XDA-Developers.
Here, we've fixed some glaring errors and updated it for Debian squeeze.
This guide will create a dual-boot Linux and Android system. The phone will boot normally into Android; just hold home+power when turning on to enter Debian Linux.
Working / Not Working​Working
Phone can boot!
SDCard reader/writer
Keyboard
LEDs
Touchscreen
Vibrator
USB Ethernet
Xorg with OpenMoko Kernel
Phone Call : I am able to answer an incomming call from console!
Unlock SIM Card and register on Network
Working with bugs
Trackball - No event on click with ball - must click and move ball slightly
TouchScreen (MonoTouch) - I can use it in console FBDEV, but with Xorg, the calibration doesn’t work - calibration is very difficult but doable
ALSA - Sound is low, when phone works, sound is very low, and alsamixer, for select OutPut has device bugs.
Xorg with my Kernel - The phone crashes (freeze) when you leave Xorg found this only happens sometimes not all
Not working
WiFi card is detected, but crashes when doing “ifconfig wlan0 up”.
Not tested
GPS
Accelerometers/Compas
Other USB Gadgets, like Storage
Bluetooth
Internet throug GSM/3G APN
Power management
Accelerated GL
Camera
TouchScreen (MultiTouch)
HOWTO​You will need:
A laptop with Debian-based Linux (Ubuntu, Debian, Linux Mint, etc.)
Just run it off a live CD
An HTC Dream/G1 or MyTouch 3G
8GB or larger SDCard
4GB for Linux, 4GB for Android
An Android 1.6 or higher Custom ROM that supports EXT2/3
only a few older Android versions lack it.
USB Debugging Enabled
HardSPL and Engineering SPL
gives you fastboot support
ADB and Fastboot
The easiest way to install them is to use Minimal ADB.
Partitioning the SDCard​
obtain gparted using:
sudo apt-get install gparted
select your sdcard and select it on the top right menu
You will need three partitions:
fat32 (android)
ext3 (android apps and stuff if you got app2sd)
ext3 (debian)
For example, an 8GB SDCard would be partitioned like this:
2 GB FAT32 for Android
2 GB EXT3 for app2sd
4 GB EXT3 for my real Debian
After creating the partitions, make sure to record the names, found in gparted's top-right corner (ex. /dev/sdb1, /dev/sdc6).
The G1 will see those partitions with names: /dev/mmcblk0p3 or whatnot. Just add the last number of the /dev/sdb1 name, replacing that 3.
Keep your SDCard plugged in.
Generate the Debian Root Filesystem with debootstrap​We will use debootstrap to install all the necessary system packages to an image, which you will flash onto the G1.
mkdir debdroid
sudo /usr/sbin/debootstrap --foreign --arch armel squeeze debdroid/ http://http.debian.net/debian
Copy debootstrap to the SDCard​We now need to copy the system image to the G1. Change /dev/sdb3 to the EXT3 partition for Debian on your SDCard (The names were previously obtained from GParted).
mount /dev/sdb3 /mnt/memory # change correct device
sudo cp -pfr debdroid/* /mnt/memory/
umount /mnt/memory
debootstrap Second Stage​Now reboot into your G1, and connect it to the computer to begin the second phase of installation. Make sure USB Debugging is enabled, and your phone is recognized by ADB.
Mount the debian EXT3 partition:
adb shell
mkdir /data/mnt
mount -t ext3 /dev/block/mmcblk0p3 /data/mnt
Now your debian partition should be mounted to file system at /data/mnt
Next, we will chroot into the debian partition to start the second stage of installation. This will take about 25 minutes, so be patient and keep your phone charged.
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$PATH
export TERM=linux
export HOME=/root
export USER=root
chroot /data/mnt /debootstrap/debootstrap --second-stage
umount /data/mnt
rmdir /data/mnt
Set the SSH service to start on boot​We will need an SSH service running on the G1 for internet tethering from the PC. We have to install Galoula's SSH modules, and edit configuration files to start SSH on boot.
Insert the sdcard back into your Linux PC and run these commands:
(replace /dev/sdb2 with the name of your debian EXT3 partition)
(the package links will have to be updated for squeeze)
mount /dev/sdb2 /mnt
cd /mnt/tmp
wget http://www.galoula.net/fr/Tutoriels...ALOULA-001/Modules-2.6.32_GALOULA-001.tar.bz2
tar -jxvf Modules-2.6.32_GALOULA-001.tar.bz2 -C ..
echo g_ether >> ../etc/modules
echo "auto lo" >> ../etc/network/interfaces
echo "iface lo inet loopback" >> ../etc/network/interfaces
echo "auto usb0" >> ../etc/network/interfaces
echo "iface usb0 inet static" >> ../etc/network/interfaces
echo " address 192.168.0.202" >> ../etc/network/interfaces
echo " netmask 255.255.255.192" >> ../etc/network/interfaces
echo " network 192.168.100.0" >> ../etc/network/interfaces
echo " gateway 192.168.0.200" >> ../etc/network/interfaces
echo "none /sys sysfs rw,nosuid,nodev,noexec 0 0" >> ../etc/fstab
echo "none /proc proc rw,nosuid,nodev,noexec 0 0" >> ../etc/fstab
echo "udev /dev tmpfs rw,size=10240k,mode=755 0 0" >> ../etc/fstab
echo "devpts /dev/pts devpts rw,nosuid,noexec,gid=5,mode=620 0 0" >> ../etc/fstab
echo "HTC-Dream" > ../etc/hostname
echo "127.0.0.1 localhost HTC-Dream" > ../etc/hosts
cat /etc/resolv.conf > ../etc/resolv.conf
mkdir ../dev/pts
sync
cd
umount /mnt
Later on, we will also install the SSH packages on the phone itself.
Now insert the sdcard back into the G1, and plug the G1 into the computer.
Chroot Setup​
Make sure your Android G1 has a WiFi internet connection and USB Debugging enabled.
Set your phone to Stay Awake, so the phone will not suddenly cut off your wifi connection. Settings->Application->Development->Stay Awake
Disable WiFi sleep, which will cause download issues. Settings->Wifi->Menu Button->Advanced->Wifi Sleep Policy->Never sleep when plugged in
Enter the chroot​First, mount the Debian partition on the G1 from your PC, using these commands:
adb shell
mkdir /data/mnt
mount -t ext3 /dev/block/mmcblk0p3 /data/mnt
Then, enter the chroot:
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$PATH
export TERM=linux
export HOME=/root
export USER=root
chroot /data/mnt /bin/bash
Set up Squeeze Package Repositories​This will install the necessary Debian repositories and some basic packages to the G1.
Type the commands below to add squeeze package repositories:
echo "deb http://ftp.debian.org/debian/ squeeze main non-free contrib" >> /etc/apt/sources.list
echo "deb-src http://ftp.debian.org/debian/ squeeze main non-free contrib" >> /etc/apt/sources.list
echo "deb http://security.debian.org/ squeeze/updates main contrib non-free" >> /etc/apt/sources.list
echo "deb-src http://security.debian.org/ squeeze/updates main contrib non-free" >> /etc/apt/sources.list
echo "deb http://ftp.debian.org/debian squeeze-updates main contrib non-free" >> /etc/apt/sources.list
echo "deb-src http://ftp.debian.org/debian squeeze-updates main contrib non-free" >> /etc/apt/sources.list
apt-get update
apt-get install bzip2 build-essential
Install SSH​Finally, we can install the openssh packages. An SSH server allows you to access a USB connected phone from your computer, so you can pump in terminal commands using copy and paste.
Type this command in the same chroot at your computer:
apt-get install openssh-server openssh-client libkrb53 openssh-blacklist libedit2 udev libvolume-id0 libkeyutils1
/etc/init.d/ssh stop
Create a Root user password and exit the Chroot​We will want to create a root user password.
passwd
Type in the password you want to use (make sure that you only use numbers and letters! special characters cannot be easily entered).
As a security measure, text will not appear onscreen, so just keep typing and press enter when you've put it in.
Exit the Chroot​We're all done, so you can exit the chroot.
sync
exit # exits the chroot
umount /mnt
rmdir /data/mnt
exit # exits `adb shell`
Boot Linux​Put the sdcard back into your G1, Plug in your G1 to the PC, and type this command to enter fastboot mode:
adb reboot bootloader
Type this command on your Linux PC to download and boot the kernel.
wget http://www.galoula.net/fr/Tutoriels/HTC-DREAM-G1/FTP/Native_Debian/2.6.32_GALOULA-001/zImage
fastboot -c "console=tty0 no_console_suspend=1 root=/dev/mmcblk0p3 rootdelay=2 fbcon=rotate:1" boot ./zImage
Your phone will now boot into Debian.
Type in the Username and Password​As a security feature, nothing will be displayed while you type your password.
username: root
password: <the password that you created>
Tether your G1's internet connection to the PC​We have to forward your PC's internet connection to your G1. Type these commands in the computer:
ifconfig usb0 192.168.0.200/26
iptables -A POSTROUTING -t nat -s 192.168.0.0/24 -j MASQUERADE
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -D POSTROUTING -t nat -s 192.168.0.0/24 -j MASQUERADE
(not tested) Alternatively, use these commands: (recommended by Jorge Peñalba)
ifconfig usb0 192.168.0.200/26\
iptables -A POSTROUTING -t nat -s 192.168.0.0/24 -j MASQUERADE\
echo 1 \> /proc/sys/net/ipv4/ip\_forward\
ssh 192.168.0.202 -l root\
iptables -D POSTROUTING -t nat -s 192.168.0.0/24 -j MASQUERADE\
echo 0 \> /proc/sys/net/ipv4/ip\_forward
SSH into the G1​Use this command to SSH into the G1's command line, so you can send commands to it from your computer. Log into your phone with the same username and password you set before.
ssh 192.168.0.202
Enable Dual Boot (optional)​We will create a custom kernel for the phone to dual-boot between Android and Linux. This way, you will be able to hold power+home to boot Linux.
Use your computer to SSH into the G1 and run these commands:
cd /usr/src
wget http://www.galoula.net/fr/Tutoriels/HTC-DREAM-G1/FTP/Outils/mkboot.tar.bz2
tar -jxvf mkboot.tar.bz2
cd mkboot
make && make install
cd /usr/src
wget http://www.galoula.net/fr/Tutoriels/HTC-DREAM-G1/FTP/Outils/android-imagetools.tar.bz2
tar -jxvf android-imagetools.tar.bz2
cd android-imagetools
make && make install
cd /tmp
wget http://www.galoula.net/fr/Tutoriels/HTC-DREAM-G1/FTP/Native_Debian/2.6.32_GALOULA-001/zImage
wget http://wiki.openmoko.org/images/f/f6/Newramdisk.cpio.gz
mkbootimg --cmdline "console=tty0 no_console_suspend=1 root=/dev/mmcblk0p3 rootdelay=2 fbcon=rotate:1" \
--kernel zImage --ramdisk ./Newramdisk.cpio.gz -o Recovery-boot.img
cat /dev/zero > /dev/mtd1
mkdir /dev/mtd
cd /dev/ && for i in `ls -w1 mtd?`;do ln -s /dev/$i /dev/mtd/$i; done && cd - || cd -
flash_image recovery Recovery-boot.img
Normal boot will get you into Android
Holding home and power will boot into debian
Galoula's Netinstall​How to Install Ubuntu with Ubuntu-Install.img ?
Download Ubuntu-Install.img on your Linux-PC.
Turn off your HTC G1.
Turn On HTC G1 in FastBosst mode : Power on with hold the camera button, if it's OK, you can see 3 Android on Skateboards.
In this screen press Back.
Connect USB cable betweek PC and G1.
On your Linux PC type this command : "fastboot boot Ubuntu-Install.img" without quotes.
If the G1 don't start, press the back button on G1.
The G1 start the Ubuntu Installer.
Warning ! My image is set for a French G1 keymap.
The special keys are :
Up : End
Down : Back
Left : Home
Right : Call
Escape : menu (on keyboard)
Tab : Right alt with Q.
Control : Search Button
For get networking works : This kernel use USB-NET.
To configure IT :​On the Linux PC :
sudo ifconfig usb0 192.168.0.200 netmask 255.255.255.0 up
iptables -A POSTROUTING -t nat -j MASQUERADE -s 192.168.0.0/24
sysctl -w net.ipv4.ip_forward=1
On the G1 :​When the installer tell you for Networking Configuration, chose usb0
You can cancel the DHCP discover.
Type this settings :
IP Address : 192.168.0.202
NetMask : 255.255.255.0
GateWay : 192.168.0.200
DNS : Your DNS
The setup tell you because it can't download "kernel modules", chose continue, my kernel can read the SDCARD for the installation, but it can't read internal partition for more secure.
The setup can tell you a warning because the kernel can't be installed, please continue (and ignore it) because, Ubuntu-Rescue.img contain the appropriate kernel.
Actualy, the file is : boot-recovery.img
Now, you can setup your Ubuntu !
Galoula's Netinstall images
Page Index for this GitHub Wiki
Source: Github
Click to expand...
Click to collapse
Could you provide the ROM, HardSPL, and EngeneeringSPL?

[Q] OpenVPN on Droid3?

I want to setup OpenVPN on my device, but the installer is saying that it needs a TAP/TUN module. After doing some research it looks like it's tun.ko that I'm looking for, but I'm not that famaliar with the android devices (this is my first droid, had it for about a month now) and would like some help or recommendations
I'm actually running an Bell branded XT860.
tun/tap is built in D3 stock kernel, so you need no module tun.ko.
Which OpenVPN Installer did you try? The app from the market? It worked fine for me, only shortcoming is the openvpn binary seems to have a bug on D3, the built-in route and ifconfig commands do not work. But no big deal for me, since I use a start script anyway and add these commands to this script.
Can you elaborate how your using the startup scripts? I'm using OpenVPN on CM7 on another device and it works well. My D3 is getting shipped to me and I'd like to also get OpenVPN running on it.
Thanks
How detailled do you need it? I can show you what I did, but you need some Linux / OpenVPN skills to alter it for your needs. Unfortunately, I currently don't have the time to write a failsave HowTo. But if you have further questions, feel free to ask.
1. remount /system read-write
2. mkdir -p /system/scripts/openvpn and copy your OpenVPN configfiles there
3. Create script /system/scripts/ovpn.sh:
#! /system/bin/sh
openvpn --cd /system/scripts/openvpn --config openvpn.conf --daemon
sleep 1
ifconfig tun0 172.31.254.10 pointopoint 172.31.254.9
/system/sbin/route add -net 10.0.0.0/8 dev tun0
exit 0
4. Make a widget with app Script Manager
5. remount /system read-only
EDIT: What I missed to mention before: I had some MTU problemes. Configuring "mssfix 1200" solved it.
So let me get this right.
I have openvpn settings and the binary installed.
config files are in /sdcard/openvpn/
both the -> swissvpn.ovpn and ca.crt
openvpn binary is in /system/xbin/openvpn
I modified script in /system/scripts/openvpn to read
openvpn.conf to swissvpn.ovpn
--------------------------------------
#! /system/bin/sh
openvpn --cd /system/scripts/openvpn --config swissvpn.ovpn --daemon
sleep 1
ifconfig tun0 172.31.254.10 pointopoint 172.31.254.9
/system/sbin/route add -net 10.0.0.0/8 dev tun0
exit 0
-----------------------------------
saved to /system/scripts/ovpn.sh
Questions
1.) Do I need to point openvpn to the config files in /system/scripts/openvpn or /sdcard/openvpn for it to work?
2.)Will this finally fix the routing problem with the browser not tunneling properly?
3.)Do I need to issue "Load tun kernel module" in "openvpn settings" or is this already solved with the stock kernel?
Regarding your first question, yes you have to, and this isn't your only mistake. You cannot just adopt my ifconfig and route settings.
OK, how could we start? I fear you are using a server-pushed configuration and I further fear this will just not work with this "broken" openvpn binary.
Could you please post your swissvpn.ovpn?
And please do the following, on command line as root:
openvpn --cd /sdcard/openvpn --config swissvpn.ovpn
... and please post the output.
output
-----------------------------------------------
export PATH=/data/local/bin:$PATH
[email protected]_solana:/$ export PATH=/data/local/bin:$PATH
[email protected]_solana:/$ su
[email protected]_solana:/# openvpn --cd /sdcard/openvpn --config swissvpn.ovpn
Tue Oct 11 17:19:08 2011 OpenVPN 2.1.1 i686-pc-linux-gnu [SSL] [LZO2] [EPOLL] built on Feb 2 2010
Enter Auth Username:
------------------------------------------
also config file swissvpn.ovpn contents
------------------------------------------
dev tun
client
proto tcp-client
remote connect-openvpn.swissvpn.net 443
ca ca.crt
auth-user-pass
reneg-sec 86400
ns-cert-type server
-----------------------------------------
I messed up on my last post.
I meant the ovpn.sh script is in /system/scripts/
the 2 config files swissvpn.opvn and ca.crt are in /system/scripts/openvpn/
The openvpn binary is in /system/xbin/openvpn/ and was installed by 'OpenVPN Installer' from the Market. "OpenVPN Settings" is the app I'm using to configure all of this.
also if I execute your ovpn.sh in script manager as root it just outputs this
--------------------------------------------
http ://oi51.tinypic.com/2n21vdx. jpg
http ://oi52.tinypic.com/2vw8bbt. jpg
http ://oi54.tinypic.com/c7vck. jpg
http ://oi52.tinypic.com/15hh4au. jpg
--------------------------------------------
You are obviously prompted for a Username. What happens when you type your username (and then password, I guess).
RE:
Well what it says in a message
this is with your script in there
Take note that I had clicked SwissVPN.ovpn
The green checkbox had turn off and displayed this message.
http ://oi52.tinypic.com/2a7cwzl.jpg
OK, it seams my workaround doesn't work for you because your ifconfig and route parameters are pushed by the server. There is more investigation needed, either in a new build of the openvpn binary or another workaround. I'll have a closer look at it, but really cannot promise you a timeline.
I was having your same problem with "FATAL:Linux ifconfig failed:could not execute external program."
There is a fix in this thread http://forum.xda-developers.com/archive/index.php/t-1074492.html
cd /system/xbin
ln -s /system/xbin /system/xbin/bb
this will create a correct link for ifconfig and route commands
Click to expand...
Click to collapse
I've got OpenVPN to connect successfully, yet no traffic routes through VPN.
This thread discusses the issue
http://forum.xda-developers.com/archive/index.php/t-1235954.html
Someone said
I can configure tun0 and the routing table manually and successfully pass traffic through the tunnel.
Click to expand...
Click to collapse
I don't understand the configuration he posted
vpnc work well with cisco vpn
download vpnc from market. works well with cisco vpn.

[Q] novaterm executes novacom

whenever I type "novaterm" into terminal (on arch linux) It just executes novacom, and I can't get into my device.
here is that output:
usage: /opt/Palm/novacom/novacom [-a address] [-p port] [-t] [-l] [-d device] [-c cmd] [-r password] [-w] <command>
/opt/Palm/novacom/novacom [-V]
/opt/Palm/novacom/novacom [-a address] [-p port] -P[ [-f <localport:remoteport,...>] ]
options:
-a address: ip address of the novacomd server, default is 'localhost'
-p port: port of the novacomd server's device list port, default is 6968
-t: go into terminal mode, for interactive use
-s: pass signals to remote process
-l: list devices and then exit
-r: device password (must use with -c option)
-c: service command [login, add, remove, logout]
login: opens new session
add: adds device token to host
remove: remove device token from host
logout: closes active session
-d device: connect to specific device instead of first.
might be <nduid>, <connection type>, <device type>
-w: wait for device to show up before running command
-V: version information
-P: Port Forwarding Enabled
-f: ports to forward
bbm21 said:
whenever I type "novaterm" into terminal (on arch linux) It just executes novacom, and I can't get into my device.
here is that output:
usage: /opt/Palm/novacom/novacom [-a address] [-p port] [-t] [-l] [-d device] [-c cmd] [-r password] [-w] <command>
/opt/Palm/novacom/novacom [-V]
/opt/Palm/novacom/novacom [-a address] [-p port] -P[ [-f <localport:remoteport,...>] ]
options:
-a address: ip address of the novacomd server, default is 'localhost'
-p port: port of the novacomd server's device list port, default is 6968
-t: go into terminal mode, for interactive use
-s: pass signals to remote process
-l: list devices and then exit
-r: device password (must use with -c option)
-c: service command [login, add, remove, logout]
login: opens new session
add: adds device token to host
remove: remove device token from host
logout: closes active session
-d device: connect to specific device instead of first.
might be <nduid>, <connection type>, <device type>
-w: wait for device to show up before running command
-V: version information
-P: Port Forwarding Enabled
-f: ports to forward
Click to expand...
Click to collapse
Take a look at this thread : http://forum.xda-developers.com/showthread.php?t=1426244
On page 12 there's a good work around for novaterm problem. I've used it 3 times and it's been a life saver for me. It's a PITA, but it works.
As always, make a backup, just in case.
Edit : the commands are input using windows. This will repartition your tablet, so make sure that you have back up.

QuickSSHd server exits after authentication

Hello
I have been using QuickSSHd (dropbear) for some time on the GS4 and it worked well, with the exception that the author hasn't updated it for Jellybean and up. Moving to the S5 requires minor hacking to get it to work:
Code:
cd /data/data/com.teslacoilsw.quicksshd/dropbear/
cp -a dropbear dropbear.real
cat > dropbear << END_OF_LINE
#!/system/bin/sh
umask 000
/data/data/com.teslacoilsw.quicksshd/dropbear/dropbear.real "[email protected]"
END_OF_LINE
The server starts fine and allows me to connect (using KiTTY on Windows 7) but exits right after logging in:
Code:
login as: root
QuickSSHD for Android
[email protected]'s password:
[10948] Dec 17 21:06:37 exit after auth (root): child failed
I've chown'd dropbear and dropbear.real and done chmod 755 on both as well, same thing. Any idea what else could be the issue?
I'm having the very same problem. I'm able to log in as user 1023, but not as root. I'm using public key auth.

How To Guide How to backup the data from the phone using rsync and ssh (including some hints for using sshd on an Android phone)

How to backup the data from the phone using rsync and ssh (including some hints for using sshd on an Android phone)
Like for all computer it's important to have a backup of the data on the phone.
For those who like me don't like to store their private data in one of the suspicious clouds there is a solution with standard Linux tools:
Use rsync and ssh to backup the data from the phone to your local workstation (see the man page for rsync for details regarding rsync and why it is useful for this task)
The neccessary tools for Android for this method can be installed with the Magisk Module MagiskSSH.
Download the Magisk Module with MagiskSSH from here
https://gitlab.com/d4rcm4rc/MagiskSSH_releases
Copy the ZIP file with the Magisk Module to the phone :
Code:
adb push magisk_ssh_v0.14.zip /sdcard/Download/
and install it via the module installation from within the Magisk App or manuell using :
Code:
adb shell su - -c /data/adb/magisk/magisk64 --install-module /sdcard/Download/magisk_ssh_v0.14.zip
Sample output of the installation:
Code:
ASUS_I006D:/ # /data/adb/magisk/magisk64 --install-module /sdcard/Download/magisk_ssh_v0.14.zip
- Current boot slot: _a
- Device is system-as-root
*******************************
OpenSSH for Android
*******************************
[0/7] Preparing module directory
[1/7] Extracting architecture unspecific module files
[2/7] Extracting libraries and binaries for arm64
[3/7] Configuring library path wrapper
[4/7] Recreating symlinks
[5/7] Creating SSH user directories
[6/7] Found sshd_config, will not copy a default one
[7/7] Cleaning up
- Setting permissions
- Done
ASUS_I006D:/ #
A reboot is required now.
Code:
adb shell reboot
For the next tasks open an adb shell and become root user.
Next create the authorized_keys file for the user root :
Code:
touch /data/ssh/root/.ssh/authorized_keys
chmod 600 /data/ssh/root/.ssh/authorized_keys
and add your public ssh key to the file /data/ssh/root/.ssh/authorized_keys.
To make sure that the keys and other data files for the MagiskSSH module are not removed while deinstalling the module you should create the file /data/ssh/KEEP_ON_UNINSTALL:
Code:
touch /data/ssh/KEEP_ON_UNINSTALL
The MagiskSSH module also installs a service to start sshd after each reboot: to disable this start create the file /data/ssh/no-autostart:
Code:
touch /data/ssh/no-autostart
To manually start or stop the sshd use the script /data/adb/modules/ssh/opensshd.init :
Code:
# start the sshd (as user root)
#
/data/adb/modules/ssh/opensshd.init start
# to stop the sshd (as user root)
#
/data/adb/modules/ssh/opensshd.init stop
Now test the access via ssh from your Linux workstation:
Code:
ssh -l root <phone_ip_address> id
Use this command to retrieve the current IP address of the phone:
Code:
PHONE_IP_ADDRESS=$( adb shell ifconfig wlan0 | grep "inet addr:" | sed -e "s/.*inet addr://g" -e "s/[[:space:]]*Bcast.*//g" )
example :
Code:
[[email protected] ~]$ ssh -l root ${PHONE_IP_ADDRESS} id
uid=0(root) gid=0(root) groups=0(root) context=u:r:magisk:s0
[[email protected] ~]$
Now you can use rsync to backup the data from the phone, e.g. to backup the photos from the phone do :
Code:
# on your local Linux workstation do:
# start the sshd on the phone via adb if not already running
#
adb shell su - -c /data/adb/modules/ssh/opensshd.init start
# retrieve the current IP address from the phone
#
PHONE_IP_ADDRESS=$( adb shell ifconfig wlan0 | grep "inet addr:" | sed -e "s/.*inet addr://g" -e "s/[[:space:]]*Bcast.*//g" )
# backup the new photos from the phone to the Linux workstation (rsync only copies new files from the phone)
# to the local directory /data/backup/ASUS_ZENFONE8/DCIM
#
rsync -av --rsync-path /data/adb/modules/ssh/usr/bin/rsync [email protected]${PHONE_IP_ADDRESS}:/sdcard/DCIM/ /data/backup/ASUS_ZENFONE8/DCIM
# optional stop the sshd on the phone via adb
#
adb shell su - -c /data/adb/modules/ssh/opensshd.init stop
Note: The sshd configuration file used is /data/ssh/sshd_config
Sample Script to backup all data in the directory /sdcard
Code:
##!/bin/bash
#
# simple script to backup the data of an phone using adb, ssh, and rsync
#
# History
# 27.06.2022 /bs
# initial release
#
# for testing
#
#RSYNC_OPTIONS="${RSYNC_OPTIONS} --dry-run"
RSYNC_OPTIONS="${RSYNC_OPTIONS} --del "
# default is to backup the phone connected via adb over LAN
#
[ $# -ne 0 ] && ADB_OPTIONS="$*" || ADB_OPTIONS="-e"
# retrieve the serial number of the attached phone
#
SERIAL_NO="$( adb ${ADB_OPTIONS} shell getprop ro.serialno )"
if [ "${SERIAL_NO}"x = ""x ] ; then
echo "ERROR: Can not read the serial number of the connected phone"
exit 89
fi
VENDOR_MODEL="$( adb ${ADB_OPTIONS} shell getprop ro.product.vendor.model )"
# directory for the backup
#
BACKUP_DIR="/data/backup/ASUS_ZENFONE8/data_backup/${VENDOR_MODEL}_${SERIAL_NO}"
if [ ! -d "${BACKUP_DIR}" ] ; then
echo "ERROR: The directory \"${BACKUP_DIR}\" does not exist"
exit 99
fi
PHONE_IP_ADDRESS="$( adb ${ADB_OPTIONS} shell ifconfig wlan0 | grep "inet addr:" | sed -e "s/.*inet addr://g" -e "s/[[:space:]]*Bcast.*//g" )"
if [ "${PHONE_IP_ADDRESS}"x = ""x ] ; then
echo "ERROR: Can not detect the IP address of the phone"
exit 100
fi
echo "Updating a backup of the data on the phone with the serial number \"${SERIAL_NO}\" and the IP \"${PHONE_IP_ADDRESS}\" to the directory \"${BACKUP_DIR}\" ..."
set -x
# start the sshd if neccessary
#
adb ${ADB_OPTIONS} shell su - -c /data/adb/modules/ssh/opensshd.init start
# do the backup
#
time rsync ${RSYNC_OPTIONS} -av --rsync-path /data/adb/modules/ssh/usr/bin/rsync [email protected]${PHONE_IP_ADDRESS}:/sdcard/ "${BACKUP_DIR}/"
# stop the sshd
#
adb ${ADB_OPTIONS} shell su - -c /data/adb/modules/ssh/opensshd.init stop
set +x
How to enable access via ssh for non-root user
In the standard configuration installed by MagiskSSH ssh access is only allowed as user root because the ssh keys are in the directory /data and all non-root user can not read files in the directory /data. Therefor some efforts are neccessary to add ssh access for non-root user.
e.g. To enable the ssh access for the user shell do:
To configure ssh access for the user shell we must create a .ssh directory for the user shell in a directory tree owned by the user shell. The only directory on the phone owned by the user shell that can be used for this purpose is /storage :
Code:
ASUS_I006D:/ # ls -ld /storage
drwx--x--- 4 shell everybody 80 2022-06-26 18:37 /storage
ASUS_I006D:/ #
But unfortunately all files and directories in this directory are temporary and will be deleted after a reboot of the phone.
Therefor we configure a startup script in Magisk to create this directory tree after each reboot, e.g.
/data/adb/service.d/create_ssh_dir_for_shell.sh:
Code:
# /data/adb/service.d/create_ssh_dir_for_shell.sh
#
mkdir -p /storage/shell/.ssh
chmod -R 700 /storage/shell/
touch /storage/shell/.ssh/authorized_keys
echo "<ssh_public_key>" > /storage/shell/.ssh/authorized_keys
chmod 600 /storage/shell/.ssh/authorized_keys
chown -R shell:shell /storage/shell
Make the script executable:
Code:
su - -c chmod +x data/adb/service.d/create_ssh_dir_for_shell.sh
To test the script just execute it one time manually as user root.
Code:
su - -c sh data/adb/service.d/create_ssh_dir_for_shell.sh
Now create a backup of the sshd config file
Code:
su - -c cp /data/ssh/sshd_config /storage/ssh/sshd_config.org.$$
and add these lines at the end of the file /data/ssh/sshd_config
Code:
Match User shell
AuthorizedKeysFile /storage/shell/.ssh/authorized_keys
Restart the sshd if it's already running
Now test the access as user shell, example:
Code:
[[email protected] ~]$ ssh -l shell 192.168.1.148 id
uid=2000(shell) gid=2000(shell) groups=2000(shell) context=u:r:magisk:s0
[[email protected] ~]$
The reason for this config is the setting "StrictMode yes" in the sshd config file /data/ssh/sshd_config (see the man page for sshd_config for details). So another "solution" is to change this setting:
With the setting "StrictModes no" in the file sshd_config the directory with the authorized_keys file for the non-root users can be anywhere (for example in /sdcard/shell)
Execute as user root:
Code:
sed -i -e "s/.*StrictModes.*//g" -e "s/UsePrivilegeSeparation/StrictModes no\nUsePrivilegeSeparation/g" /data/ssh/sshd_config
and change the entry in the file /data/ssh/sshd_config for the authorized_keys file for the user shell, for example:
Code:
Match User shell
AuthorizedKeysFile /sdcard/shell/.ssh/authorized_keys
Afterwards restart the sshd:
Code:
/data/adb/modules/ssh/opensshd.init stop
/data/adb/modules/ssh/opensshd.init start
Now create the directories and files neccessary for the ssh access (see above) in the directory /sdcard/shell:
Code:
SUS_I006D:/ # find /sdcard/shell -exec ls -ld {} \;
drwxrws--- 3 u0_a118 media_rw 3452 2022-06-26 18:32 /sdcard/shell
drwxrws--- 2 u0_a118 media_rw 3452 2022-06-26 18:32 /sdcard/shell/.ssh
-rw-rw---- 1 u0_a118 media_rw 408 2022-06-26 18:32 /sdcard/shell/.ssh/authorized_keys
ASUS_I006D:/ #
and the access as user shell via ssh should work

Categories

Resources