[General Topics] S0AndS0:
Setting up base system (partially under construction)

Contents

1. Setting up base system:​

1:2 - Downloads for android device.

Debian kit

https://play.google.com/store/apps/details?id=org.dyndns.sven_ola.debian_kit

ConnectBot

https://play.google.com/store/apps/details?id=org.connectbot

Remote RDP free

https://play.google.com/store/apps/details?id=org.toremote.rdpdemo

Root browser

(or use your prefered file browser)

https://play.google.com/store/apps/details?id=com.jrummy.root.browserfree

Hacker's Keyboard

https://play.google.com/store/apps/details?id=org.pocketworkstation.pckeyboard

debian-kit-1-5.shar

http://sven-ola.dyndns.org/repo/

1:3 - Installing Linux system to Android Device

1:3:1 Verify no major errors are present

Open Debian Kit: check that there are no red X's; tap on anything in the list for more info and/or press menu and tap read me for the developers original doc.

Check that you've enough memory: from the home screen press menu and tap settings; Scroll down to application settings, tap it and view storage use; try to have as much available memory as possible by, moving/removing apps, ruffly 100MB+ worked for me. Note after the initial install you should be able to reinstall/restore the removed apps with little ill effect.

Remove data consuming tasks from the equation either by freezing them with an app like rom tool box or turning off their sync options or uninstalling them. Mainly this step helps insure that while you're downloading the necessary data that your connection doesn't flip out and cause an error that could have been avoided.

1:3:2 Start ConnectBot (rom toolbox terminal emulator also works well for this part with some modification)

Tap on the lower left corner where ssh button is and select local instead.

Tap in the text field next to the bottom now displaying local and type in a nickname like 'debInstall', hit enter and be presented with-

$

Type su, hit enter, and permit superuser permissions.

$ su

#

Unpack the installer with sh /sdcard/download/debian-kit-* note: if downloaded with dolphin browser or some other browser then you'll need to change the file path to reflect that.

# sh /sdcard/download/debian-kit-*

Or

# sh /sdcard/Dolphin_Browser_Mini/download/debian-kit-*

Or

# sh /mnt/sdcard/download/debian-kit-*

See 8:2:1 for example of what your screen should look like without errors.

Choose your path:

Input 2s will install a debian.img file 2gb in size to your sdcard. Note: this option is suggested as for the first try as this will allow for a stable and fairly sized environment to test and play with, furthermore I will be writing this guide first for the debian squeeze option and later add the others as I've the time. If choosing this option scroll down to step 6. when the installer starts asking questions.

If 2gb sounds to small and you're willing to brave the manual install, then you'll want to abort the auto installer at this point and scroll further to step 1:2 Manual Install

Once the install has finished you'll be given three options yes, ovpn, q choose one and only one. When yes or ovpn is used things will be removed, when q is used the debian image is unmounted just as it will be automatically unmounted at the end of either yes or ovpn option. Note: when I install to debian.img file I choose ovpn as this allows for the most amount of space to be freed.

Now providing everything is error free the debian.img can be remounted with either of the two commands

# deb

or

# /data/local/deb/deb

Note: to see what it will look like the first time you run deb and not encounter errors see section 8:2:4

Now to first

update the list of packages currently installed,

second upgrade everything,

third install andromize for compatibility,

forth install andromize-lxde for a gui,

fifth install ssh,

sixth auto remove unnecessary packages,

seventh clean up,

and all that in one step that will take more than a few minutes to complete. Note: andromize at some point is going to request input from you;

tap on your screen and tap on the control button that briefly shows up in the lower corner, the hit the 'i' button on either you hard keyboard or onscreen keyboard. This will put you in insert mode so that with a d-pad and the spacebar or enter key you can select a highlighted option, I suggest: ctrl+i then space (or enter) as that has worked everytime for me.

# apt-get update; apt-get upgrade; apt-get install andromize; apt-get install andromize-lxde; apt-get install openssh-server; apt-get autoremove; apt-get clean

So you're set to rock and roll as root and have a lot of options if ya know what you're doing.

At some point with all this you may feel uncomfortable with running under sudo root user. Scroll down to '4:3:2 Command line commands for linux' and run those commands to secure yourself some.

Start your new ssh server. Now that the basic requirements to run linux have been met and you've a clean OS we need a way to 'open and 'close' terminal windows that aren't going to remount the system a bunch or run us into out of memory or space errors.

Start ssh with one of the following commands

# deb s

Stop ssh with one of the following commands (when you're done)

# deb S

Once ssh is on you can connect to your device from any other ssh compatible device. For now we are going to use identical directions, almost, to section 4:3:3-3

Make or open a new or existing ssh connection with connectbot with your username that you want to log in as then the @ symbol followed by "localhost"

Make sure that in the lower corner that the option is set to ssh and hit the enter key

Connectbot or whatever local running ssh app you're using (I'll be testing or hearing about a few I'm sure) should now prompt you for a password. Put in the one you (I hope setup before in step 4:3:2... yeah I'm going to have to fix that...) set up and you should be greeted by a few lines of text and a # with your username before it. This is where many of the linux commands should be run.

Note: this method is prefered because you can connect and disconnect without sending multiple "deb" commands in the local connection that we only should use for installation and starting the system (first boot and after reboots). Sending multiple "deb" commands can cause all sorts of issues without sending "deb u; deb k" commands between. The other issue that arises with sending multiple "deb" commands followed by a "deb u; deb k" is that you can fill folder structures on the linux OS and your SD card that are designed to rescue unintentionally deleted files, cache, and junk files, which in other circumstances is really good to know like when a picture disappears from your gallery, but in this case is a real pain. You'll get all sorts of errors so remember one "deb" command per boot and connect through ssh or remote RDP once your system has mounted linux and you'll have a happier experience. Okay moving on.

1:4 Manual install

Unmount and eject the sd card from your device

Plug the sd card into enough adapters to plug it into your computer. I've used micro to sd adapters and then plugged that into yet another adapter sd to usb with success.

Backup all data. You're about to delete it all.

Using gParted on ubuntu 12.04

Ensure that gParted has selected the sdcard and not your hard drive... don't select your hard drive that would be bad.

Check out the current partition layout, perhaps even make note of it somewhere incase something goes wrong. My sandisk started out with a 4mb empty zone and a fat32 partition for the rest.

Reformat original partition to fat32 by either write clicking the main partition or selecting the partition drop down menu at the top of the window.

Resize first first partition (pay close attention to not accidently remove, overwrite, or move over the little bit reserved at the start of your sdcard) to the desired amount of space for the android side of your device such as space for; downloads, app cache, apps to sd, photos, and music. This space is all that my android recognizes by default so think about it.

Second make a second partition filling up the trailing bit left over, you can try something fancy but I chose a fat 32 bootable.

Apply the three operations with the green checkbox in the upper left quadrant of the window and let it run.

When gParted finishes unmount and eject the sd card, wait a second or two and plug it all back into your computer.

If you left gParted open then your sdcard and it's partitions should now show up as selectable in the drop down for devices. Close gParted.

Open a file browser or two; one for your sd card's first partition and another for where you saved the backup of your sd card's contents.

Copy your backups back over to the first partition of your sdcard. I'd advise copying the important things first, app backups folders and system and/or nandroid backups. The things you can live without for a day or two you can come back for because you're here to get to the next step.

Unmount and eject from computer. Plug back into phone and remount.

Run through the first part of the guide and about when given the option to make a debian.img file.

Run the following commands in connectbot under superuser to figure out what the installer uses to identify the second partition on your external sdcard, format it and install linux to it.

This may show the uuid, drive letter, date modified. Make note of todays date and check for three dates in the list that match from when you were repartitioning. Take note of everything.

/data/local/deb/armel/busybox fdisk -l /dev/block/vold/*

Results may vary try navigation to /dev/ with a root browser on the android side of things, take a look around and adjust the bit after 'fdisk -l' to reflect your device's folder scheme and rerun till you get something that looks like this: (or see section 8:2:2 for full example)

Device Boot Start End Blocks Id System

/dev/block/vold/179:0p1 1 1279 10264576 c Win95 FAT32 (LBA)

/dev/block/vold/179:0p2 1279 1925 5189632 b Win95 FAT32

Now to run the mk-debian -h script and change settings until satisfied. Note: I had one issue when I didn't tell the installer what 'drive' letter to install to;the letter preceding 'Win95 FAT32' in above example or in the below example command you can see the drive letter delineation specified at the end with '-L b' because on my device setup that's the letter in which I need to install to. (see section 8:2:3)

# /data/local/deb/mk-debian -i /dev/block/vold/179:2 -s 5310 -L b -h

Which if configured correctly will look like the dump took and pasted below.

Script to format a loop disk file or disk partition with ext2/3/4 and install a Debian Linux there.

Usage:

mk-debian [Options]

Options:

-d <distro> specify squeeze/lucid/precise

-m <path> specify mount point for disk/device

-s <megabyte> specify size for new loop disk file

-i <file|dev> specify loop disk file name or device

-t <ext2/3/4> specify file system to be created

-L <label> specify disk label for formatting

-D <ip> specify DNS server to be used

-M <url> specify Mirror URL for downloading

-u update /system/bin/deb script and exit

-U uninstall Debian kit (not debian.img!)

-C clean files not required to run Debian

-h display usage text and settings

Settings:

-d squeeze

-m /data/local/mnt

-s 5310 Mb

-i /dev/block/vold/179:2

-t ext4

-L b

-D 8.8.8.8

-M(squeeze) http://ftp.de.debian.org/debian

-M(lucid/precise) http://ports.ubuntu.com/ubuntu-ports

Action: install

Notes:

For creating a loop disk file, you may want to change the default size (in Mb, 512-2047). For formatting a device (-i /dev/xxx) or if overwriting an existing loop disk file, the size is ignored. The loop disk file name or the device name will be written to the bootdeb script's IMG= line if this script succeeds.

If you specify a device, the UUID of the formatted device is instead saved into bootdeb (IMG=uuid:<hexid>). With this, the correct device can be found even after some mixed USB drive/SD card eject-insert sequences.

Check your settings by adding '-h' as the last switch.

Remove the '-h' from the tail end of the command to run when you believe all is good and if all is good then scroll back up to step 7 of the main install guide where it talks about remounting debian.