Selection | Setup | Testing | Software | Homedir | Top |
If I had a working sshfs command, the way to use it is:
sshfs jimc@jacinth.jfcarter.net:/home/jimc /system/media/jimc -o allow_root -o allow_others
fusermount -u /system/media/jimc #To unmount
To avoid long delays in the editor and file manager, I should mount the specific subdirectory containing the files I want to work on, rather than the entire home directory. Or I should reorganize the home directory so it and any subdirectory have only a limited number of files that the file manager will have to stat, or which have to be shown on the editor's file selection listbox.
So where am I going to get a working sshfs command? I already decided that SSHFSDroid was too alpha level to be considered. On the web there are a lot of forum posts that tell you how to use sshfs to mount directories from your Android device onto a remote machine like a desktop PC -- the opposite of what I want to do. If your hammer isn't working, use a bigger hammer. Or if the cockroach won't die, nuke it.
There are a number of packages on the Android Market (Play Store) that will
install real
GNU/Linux on your Android device. They generally operate
as a chroot environment. However, one of them stands out:
Debian Kit by Sven-Ola Tuecke. Its special feature is that it imports
the Android host environment into the chroot, so each realm can affect the
other: specifically, a sshfs mount done by Debian can be used by Android.
See the instructions in the above link; but the basic idea is:
You create a big file on a SD card: minimum 512Mb, max 2047Mb
due to an addressing limit of the loop device. You can also use a raw
partition or a directory, but this is advanced usage
which
I will skip the first time around.
The provided script formats it, populates it with the Debian
installer, and starts downloading and installing packages. You can
choose from among Debian Squeeze
(6.0), Ubuntu Lucid
Lynx
(10.04), or Ubuntu Precise Pangolin
(12.04); the
Ubuntu choices are Long Term Support releases. I'm 99% sure that
once you get something installed you can upgrade to the latest
release. For other distros that have ARMv7, like OpenSuSE, you can
probably get them on one way or another, but it's not officially
supported.
You run the deb
command (script) which will start the OS
and give you a shell, which you can exit from if you only need
daemons. When done, stop the daemons (I think it's deb k
),
then deb u
to unmount everything.
It should take about 30 minutes to download and install Debian, with a reasonable Internet connection.
My experience installing Debian Kit:
I installed Debian Kit
from the Android Market (Play Store)
rather than downloading the shar archive from his repo. I already had
VX ConnectBot.
On CyanogenMod-10.1 based on Android-4.2.x Super
Jelly Bean
, /sdcard and /storage/sdcard0 are symlinks to
/storage/emulated/legacy upon which there is a FUSE mount, emulating
a FAT filesystem, whose underlying directory is /data/media/0. /data
itself is /dev/block/mmcblk0p8 (ext4). I'm going to try to direct
the loop file to this underlying directory rather than going through
FUSE.
I started the Kit app. On the initial page I have all the
prerequisites: compatible architecture, enough RAM, ext2/3/4 support,
loop device, loadable modules, /data/local avoids noexec, and su
works. The next step is to hit the download icon (arrow pointing
down in upper right corner). You get a directory of the repo, from
which you should download debian-kit-1.5.shar. To fake out some
browsers it allegedly has a mime-type of jpeg; it's probably safest
to use ES Image Browser to (fail to) open it. Back out and follow
the instructions in the web page; you're picking up with step 4.
The shar file ended up in /sdcard/Download/debian-kit-1.5.shar (note case, though FAT should be case insensitive). It executed and populated /data/local/deb. It continues and asks for the 2-byte code for the size of the image file and the OS version. Because I want a custom location for the image file, I just hit return, to make it exit. Next step: manual installation with mk-debian.
To get the options for mk-debian, read the script and locate the
usage() function. Or just exec mk-debian -h. My parameters:
(-h as the last parameter tells it to do a sanity check and print
usage.) We don't have to do export CUSTOM_ROM=true
during
installation, and not during execution either unless problems are noted
with uncoordinated /etc between Android and Debian. CyanogenMod
does not have a /lib symlink.
/data/local/deb/mk-debian -d squeeze -s 2047 -i /data/media/0/debian.img -h
On Android you can't do |& tee logfile; that's a bash-ism. Instead do 2>&1 | tee logfile.
If there are no complaints, remove the -h and let 'er rip. Just creating the image file took 3 mins, after which it was quickly formatted. Then it downloaded (but did not yet install) a lot of basic-looking packages. This took 9 mins. Now it extracts packages, taking only 1 minute. Total 13 minutes. I did get the symlink for /system/bin/deb.
Now you execute deb
. (Don't redirect to a log file because
fsck won't like it.) This is where it unpacks (installs) the packages.
It also has to configure most of the packages. Finished in about
8 mins. It finishes by execing bash.
Next step is to do online updates: apt-get update; apt-get upgrade; apt-get install andromize . Update means to get package lists (from 28 places, took 4 mins). Upgrade means to actually install new packages (3 packages, took 1 min). Andromize installs some android-specific configuration (plus 2 dependencies, took 1 min.)
Basic installation is finished. Exit from the shell, then do
deb u
to shut down Debian and unmount the loop device, bind
mounts, etc. If something cannot be unmounted, do deb k
to
kill Debian processes that might be sitting on a partition, then
re-do deb u
.
After you upgrade Android, un-shar debian-kit.$VERS.shar (if you
deleted the install dir), run /data/local/deb/mk-debian -u (re-creates
the symlink from /system/bin/deb), then deb c
to clean up
symlinks that point to files that no longer exist.
Slightly more than basic installation:
The point of this performance was to get sshfs. See this post on XDA-Developers by robert1968 (2013-02-09). The success story:
Having installed Debian, all you have to do (as root on Debian) is
apt-get install sshfs
, then use the command at the beginning of
this section to mount whatever you want.
With dependencies, total of 31 packages, 60Mb uncompressed. Including perl, which was apparently not considered to be basic. I'm also going to want to install ssh-askpass (and 5 dependencies).
Exact procedure to mount something, from a cold Debian (having already installed sshfs):
suapp doesn't remember you, tell it to let you on.
About the arguments to sshfs:
This is now working! Both ES File Manager and Jota+ have read-write access to files in the mounted directory.
A few little details:
I haven't set the timezone so dates are in UTC.
I created on Debian my loginID and primary group same as on the host with the files including the numerical values. All files that remotely are owned by me are reported by Debian to be owned by me by name and group, and a file created on Debian by root ends up owned by me:group (mode 644) on both Debian and the file server. If the mode is changed on Debian, e.g. 600, it stays changed; nonetheless the remote mode is not honored on Debian and various Android users have read-write access due to -o allow_other.
A very useful addition will be a SSH key agent.
Also useful will be a script to do the mounting.
According to robert1968's post, when you do deb u
it
will unmount sshfs, but I feel safer doing it explicitly with:
fusermount -u /system/media/jimc
The holy grail: this sucker can do Kerberos! How can I make that useful?
It is now 2014-05-26 and my goals have changed a bit: I want to use my tablet as a desktop replacement machine. The killer that keeps native Android from this service is that the window manager wants only one full screen window at a time. So I need a different window manager. The sub-goals in this phase are:
Particularly desired local and global apps are:
A log of the installation procedure:
See Sven-Ola's documentation for details.
To uninstall the previous version: /data/local/deb/uninstall
It removes /data/local/{deb,mnt} and that's all.
To find your partition, if not auto mounted by Android vold,
look in (ls) /dev/block. You will find mmcblk0* for the internal SD
card, and in my case, mmcblk1 and mmcblk1p1 for the external card.
Where is mmcblk1p2? Do:
busybox fdisk -l /dev/block/mmcblk1
This is on CyanogenMod-10.2. The documentation implies that some
distros (likely rooted carriers' ROMs) lack the fdisk subcommand; I
know that carriers rarely if ever include busybox itself.
Well, isn't that cute! It's all one ext4 partition. /dev/block/vold/179:49 is mounted on /mnt/fuse/sdcard1 (ext4) with nosuid nodev noexec etc. This is not going to fly. I'm going to need to repartition the card, which has to be done on another machine. I want to keep the existing content, currently only 175Mb, but I will allow 2Gb for things like photo downloads.
Now we have /dev/block/mmcblk1{,p1,p2}; however, vold did not mount either of them, hiss, boo!
Next try: make the first one fat32 with a partition type of 0c, and leave the second one type 83 (Linux data) but with no filesystem on it. Now /dev/block/vold/179:49 is mounted on /storage/sdcard1 . /dev/block/vold/179:50 exists but has no filesystem on it. This is what will be used.
In http://sven-ola.dyndns.org/repo/ as of 2014-05-27 you have a choice of debian-kit-1.5.shar dated 2013-02-26 or debian-kit-1.6-testing.shar dated 2014-05-13. Obviously I'm taking the latter. cd /data/local/tmp; wget http://sven-ola.dyndns.org/repo/debian-kit-1-5.shar
Executing as root on Mica, sh /data/local/tmp/debian-kit-1.5.shar
/data/local/deb/mk-debian -i /dev/block/vold/179:50 -L mica-32-2 -h
Default filesystem type is ext4. Default distro is Debian
Squeeze.
deb
did these steps:
Recommended next steps, which I did:
button.
Installing additional packages by apt-get install $pkg; you can do several in one execution:
Selection | Setup | Testing | Software | Homedir | Top |