User Tools

Site Tools


android-debian

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.

  • Uses fixed-size loopback device.
  • Requires free loopback device - does not work on CyanogenMod 11 on Nexus 4.

Manual installation:

  • Install with –foreign on a non-ARM computer
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
  • Transfer armroot/ to the device /data/armhf
  • First-time usage after reboot:
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"
  • Unexporting LD_PRELOAD from the above example is needed on Android 5 and does not work on Android 6.
  • Next shell:
su -c "export LD_PRELOAD=; export HOME=/root; export TERM=xterm; chroot /data/armhf /bin/bash"
  • Useful .bashrc:
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
android-debian.txt · Last modified: 2016-05-02 05:30:17 by 127.0.0.1

Except where otherwise noted, content on this wiki is licensed under the following license: Public Domain
Public Domain Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki