Running Void Linux in Chroot on Android

May 06, 2020


So I decided to mess around with my Fire 7 tablet and see if I could get a chroot environment of Linux. I used Void because it is quite lightweight and is perfect for testing! Amazon tablet


So first off this is what you will need:

  1. A rooted Android device
  2. Linux
  3. A reasonable amount of free space (at least 8GB)
  4. Void Linux Root FS

Now we can get started!

  • Download these apps and install them to the device using adb

    $ adb install XServer-XSDL-1.20.47.apk
    $ adb install ru.meefik.busybox_46.apk
    $ adb install com.termoneplus_334.apk
  • Create an image file to store Linux root fs on and push to device

    $ fallocate -l 5G linux.img
    $ adb push linux.img /sdcard # Will take a long time
    $ adb push void-armv7l-ROOTFS-20191109.tar.xz /sdcard
  • Start a shell on the device and gain root permissions

    $ adb shell
    $ su
  • Create filesystem and mount loopback device

    # mke2fs -t ext4 /sdcard/linux.img
    # losetup /dev/block/loop7 linux.img
    # mkdir /mnt/linux
    # mount -t ext4 /dev/block/loop7 /mnt/linux
  • Extract root FS

    # cp /storage/emulated/0/void-armv7l-ROOTFS-20191109.tar.xz /mnt/linux
    # xzcat void-armv7l-ROOTFS-20191109.tar.xz | tar xvpf -
  • Chroot into it

    # mount -t proc /proc /mnt/linux/proc 
    # mount --rbind /sys /mnt/linux/sys
    # mount --rbind /dev /mnt/linux/dev
    # chroot /mnt/linux /bin/bash
    # source /etc/profile
  • Create a resolv.conf and some networking groups

    # cat <<EOF > /etc/resolv.conf
    # groupadd -g 3001 aid_net_bt_admin
    # groupadd -g 3002 aid_net_bt
    # groupadd -g 3003 aid_inet
    # groupadd -g 3004 aid_net_raw
    # groupadd -g 3005 aid_net_admin
    # groupadd -g 3006 aid_net_bw_stats
    # groupadd -g 3007 aid_net_bw_acct
    # groupadd -g 3008 aid_net_bt_stack
  • Create your user and configure the sudoers file

    # useradd -m -G wheel,3001,3002,3003,3004,3005,3006,3007,3008 noritech
    # visudo # Uncomment the %wheel line
    # passwd noritech
  • Switch to user, install desktop environment and xorg packages

    # su - noritech
    # sudo xbps-install -Syu xorg xorg-server xauth xinit lxde xterm pulseaudio pavucontrol onboard
    ## If fails at:
    [*] Updating repository `' ...
    armv7l-repodata: 235KB [avg rate: -155KB/s]
    libcrypto45-3.0.2_2 in transaction breaks installed pkg `libressl-2.9.2_1'
    libcrypto45-3.0.2_2 in transaction breaks installed pkg `libtls19-2.9.2_1'
    libssl47-3.0.2_2 in transaction breaks installed pkg `libressl-2.9.2_1'
    libssl47-3.0.2_2 in transaction breaks installed pkg `libtls19-2.9.2_1'
    Transaction aborted due to unresolved dependencies.
    ## Install these:
    # sudo xbps-install libressl libtls19
  • Test the X server by starting it

    # export DISPLAY=:0 PULSE_SERVER=tcp:
    # exec startlxde
  • If that works you can create an init script to run in chroot that looks like this:

    source /etc/profile
    # Switch over to user
    su - ${USER} << EOF
    # Start X server
    export DISPLAY=:0 PULSE_SERVER=tcp:
    exec startlxde &
  • Then start it with

    chroot /mnt/linux /bin/bash -l /
  • You can start your chroot with a script like this:

    test -d "/mnt/linux" || {
      mkdir /mnt/linux
    if ! mountpoint -q /mnt/linux; then
      losetup /dev/block/loop7 /sdcard/linux.img
      mount /dev/block/loop7 /mnt/linux
    if ! mountpoint -q /mnt/linux/dev; then
      mount -t proc /proc /mnt/linux/proc 
      mount --rbind /sys /mnt/linux/sys
      mount --rbind /dev /mnt/linux/dev
    chroot /mnt/linux /bin/bash -l /
  • Put chroot script in an executable place like /data/local

  • Start chroot with the script after launching XServer XSDL

    $ su
    # /data/local/


I may have missed something but I hope I didn’t. I was bored and wanted to try creating a Void chroot on my Amazon Fire 7 tablet. Hopefully someone finds this helpful, let me know if there’s anything I can improve. LXDE running in Void


Magical girl from another dimension.

Taking a look at ReactOS, a real open source Windows XP replacement?

AARCH64 Arch Linux ARM on Raspberry Pi 4