Saturday, September 22, 2012

Installing SSH, VNC and SFTP on the MK802, the Android PC on a stick


There are some deals you just cannot ignore: a full Android system for $50? The RikoMagic MK802 sounded too good. The processor is fairly good (1GHz), got plenty of RAM (1Gb), comes with 2 USB ports (for mouse and keyboard) and a HDMI output. Plays YouTube and HD videos fairly well and for mail/rss it's more than enough.

To remotely access it, I needed to have the basic tools installed, like SSH, VNC and SFTP. These tools exists for Android but most of them are buggy or slow or both.

I wanted to collect all the tools and settings I used as it took several hours to set up everything perfectly.

SSH

This should be an easy part, but in fact, it’s trickier than I thought. I tried different SSH servers from the Google Play store, and this is what I’ve found:


Name SSH SFTP Comments
DropBear OK (no coloring) If you obtain an SFTP binary and place it into /usr/libexec, it will work. Generally it’s an older version of DropBear so it was not working as expected.
SSHDriod OK OK Forces ads, will turn off AdFree Android (!). The SSH will use coloring, the TOP command works as expected (does not scroll the screen). SFTP performance is about 500kb/sec.
DroidSSHd OK (no coloring) If you copy the SFTP exec to /data/data/br.com.bott.droidsshd/
files/bin/ will work
Older version of DropBear, did not work as expected.


Even though I really dislike the aggressiveness of SSHDroid (disabling AdFree? Com’ on!), the new DropBear version (0.53) is much better than the other ones.

If you want to run the SSH server on startup but do not want to run the UI program with it, remount your system as read-write (see below), create an .sh file somewhere in the system (/data is a good place) and paste in the following:

/data/data/berserker.android.apps.sshdroid/dropbear/dropbear -H /data/data/berserker.android.apps.sshdroid/home -Y ffffffffffffffffffffffffffffffff -p 22 -r /data/data/berserker.android.apps.sshdroid/dropbear/dropbear.key.rsa -d /data/data/berserker.android.apps.sshdroid/dropbear/dropbear.key.dss -P /data/data/berserker.android.apps.sshdroid/dropbear/dropbear.pid -U -E -F -a -b /data/data/berserker.android.apps.sshdroid/dropbear/dropbear.banner -C password

If you run this, the SSH server will start but the aggressive UI won’t. Win-win. To autostart the script at startup, use SManager: clink on the script, mark as SU and BOOT and will start your script when MK802 boots next time.

VNC

Interestingly VNC is even fussier than SSH. Most of the VNC servers will give you the ‘Connection reset by peer (10054)’ error:

Name VNC Comment
Droid VNC server Not working Connection reset by peer (10054)
VNC Server Not working Connection reset by peer (10054)
Pixel VNC Server Beta OK
VNCS from XDA developers OK Command line required to start. Needs swapping red/blue colors: (./vncs -p 5900 –s)

Interestingly the little bare VNCS uploaded to XDA developers worked the best, without any configuration or errors (Although, it needed the –s switch the switch the red/blue channels).

Be prepared that the VNC connection is not fast: it is usable for basic admin stuff, but not really for everyday use.

Backup

There are two options to backup the MK802: use the standard “adb backup” after you connected the stick to your computer or install ClockworkMod to backup/restore your data and your firmware to/from the SD card.
The ClockworkMod tool will boot before your Android, so it’s a tiny system program that can access the whole device for you.
To install, download it from Androtab, unzip, remount your SD card as exec (see below), copy the content to /sdcard and as root run the install-recovery.sh command. To reboot to ClockworkMod and backup/restore your device, use the reboot-recovery.sh script (boot needs root). Upon rebooting you will see a pretty strange looking screen but the texts are readable. Use the mouse and/or the keyboard to select the backup menu.

General HOW-TOs

The external SD card mounted at /mnt/extsd/ . The internal is at /sdcard/ .

To remount the system partition as read-write (from read only), use
mount -o remount, rw /system

To remount the SDCARD as exec (so you can run scripts from it), use
mount -o remount, exec /sdcard/
OR
mount -t vfat -o umask=0000 /dev/block/vold/179:1 /mnt/extsd

No comments:

Post a Comment