Debian in chroot on Android

<note important>This works with Debian Jessie and does not work with Debian Stretch. APT HTTP method says that it cannot create socket, permission denied. Adding user to the inet/net_raw group does not help. It might be caused by the old 3.4 kernel.</note>

Automated tool: Lil' Debi.

Manual installation:

debootstrap --arch=armhf --foreign jessie armroot/ http://ftp.de.debian.org/debian
cp /usr/bin/qemu-arm-static armroot/usr/bin/
chroot armroot/
/debootstrap/debootstrap --second-stage
su -c "mount -t tmpfs -o context=u:object_r:fuse:s0 none /storage/emulated/legacy/DCIM/OpenCamera/foo"
su -c "mount -o bind /dev /data/armhf/dev; mkdir /data/armhf/system; mount -o bind /system /data/armhf/system; mkdir /data/armhf/aroot; mount -o bind / /data/armhf/aroot; export LD_PRELOAD=; export HOME=/root; export TERM=xterm; mount -o bind /mnt/shell/emulated/0/ /data/armhf/storage; chroot /data/armhf /bin/bash"
su -c "export LD_PRELOAD=; export HOME=/root; export TERM=xterm; chroot /data/armhf /bin/bash"
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/root/bin"

cd /root

/etc/init.d/ssh start >/dev/null  2>&1

mount | grep -q proc || mount -t proc none /proc
mount | grep -q devpts || (mount -t devpts none /dev/pts; mount -t sysfs none /sys)
export LANG=cs_cz.UTF-8
export LANGUAGE=cs_cz.UTF-8
[ -e /root/vault/pin ] || encfs /root/.vault /root/vault