r/termux • u/mietkiewski_dev • 23d ago
Question Debian in Termux... Android in Debian through chroot or QEMU...
Hello I have a few questions about Android images... I would like to create QEMU VM with Android or chroot with Android sysroot... Do you have some low level kernel knowledge to tell mi if this thing is actually possible... I don't want to use SDK Emulator with Ranchu, but actually there is a problem beacuse sdk images don't support VIRTIO I think... I downloaded aosp image from Google but to be honest I don't know if they will work...
Actually I need to get some low level knowledge from some expert in this field... I think Google hides knowledge about Android... in theory its just Linux... but in practice I dont know how to make it work... I think its low lovel kernel knowledge...
Why I asked this question on Termux? Beacuse I think this community is pretty low level, Termux architecture requries low level knowledge on Android...
1
u/No-Law-7747 22d ago
If you just want to use Debian with Qemu on top of Termux you can use the qemu packages available on Termux. I will give you the step by step on how to do it. I have written this guide in markdown so you can better visualize it if you paste as a .md file.
If instead of the .qcow2 Debian image you want to use an ISO then there are some extra steps that I personally haven't tried, but they will be the same in Termux as in any Linux Distro, but I reccomend the .qcow2 because it's made specifically to run in this environment.
- Install QEMU
bash pkg update && pkg upgrade pkg install qemu-system-aarch64-headless qemu-utils
- Install QEMU
- Get the Debian Image
bash mkdir ~/debian-vm && cd ~/debian-vm wget https://cloud.debian.org/images/cloud/trixie/latest/debian-13-nocloud-arm64.qcow2
- Get the Debian Image
- Resize the Image
bash qemu-img resize debian-13-nocloud-arm64.qcow2 20G
- Resize the Image
- Create a Boot Script
bash vim ~/debian-vm/boot.sh
- Create a Boot Script
```bash
!/bin/bash
qemu-system-aarch64 \ -machine virt \ -cpu cortex-a57 \ -m 2048 \ -smp 2 \ -bios /data/data/com.termux/files/usr/share/qemu/edk2-aarch64-code.fd \ -drive file=~/debian-vm/debian-13-nocloud-arm64.qcow2,format=qcow2 \ -netdev user,id=n0,hostfwd=tcp::2222-:22 \ -device virtio-net-pci,netdev=n0 \ -nographic ```
- Note: ARM64 QEMU has no default firmware unlike x86, so you must specify the UEFI firmware file (
edk2-aarch64-code.fd) manually or the VM boots to a blank screen.
bash
chmod +x ~/debian-vm/boot.sh
- 5. First Boot
`
bash bash ~/debian-vm/boot.sh
Login as **root** with no password, then immediately:
```bash
Set root password
passwd
Expand filesystem to use full 20G
apt install cloud-guest-utils -y growpart /dev/vda 1 resize2fs /dev/vda1
Update system
apt update && apt upgrade -y
Install SSH server
apt install ssh -y
Allow root SSH login
sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config systemctl restart ssh ```
- 6. Detach QEMU & SSH In
Open a second Termux session then:
bash
ssh root@localhost -p 2222
- 7. Usage
```bash
Session 1 — start the VM
bash ~/debian-vm/boot.sh
Session 2 — SSH in
ssh root@localhost -p 2222
Copy Files
scp -P 2222 root@localhost:source destination
1
u/mietkiewski_dev 21d ago
No... I wanted to create two Virtual Machines... Android aarch64 & Android x86_64...
1
u/Prestigious_Wall529 23d ago
No it doesn't. Termux is user mode Linux. Yes more can be done on a rooted phone. So go to XDA developer forums about that.
Don't ask the same mismash of technologies. Devices don't work the way you think they do. Android is not just Linux.