Virtual Debian Environment¶
You can create a complete Debian environment that runs within Android using a FIRERPA add-on module, similar to the functionality provided by Termux or androdeb. In this environment, you can use apt to install software and compile code. Similarly, you can compile and use bpf-related programs in this environment. It is a nearly complete Linux runtime environment operating on an Android device.
Hint
Installing the Environment¶
You can find lamda-mod-debian-arm64-v8a.tar.gz on the project's release page (please download the installation package corresponding to your machine's architecture). After the download is complete, open the remote desktop and drag and drop the downloaded file to upload it to the device (we assume you have not modified the remote desktop's file upload directory). Then, perform the following installation steps. This installation procedure only needs to be done once.
Hint
tar -C /data/usr/modules -xzf /data/usr/uploads/lamda-mod-debian-arm64-v8a.tar.gz
After executing the command, the installation is complete. The next section describes how to enter the environment.
Entering the Environment¶
After installing the file system for the environment, we can execute a command to enter the virtual Debian environment. We know that the Debian environment package has just been installed to /data/usr/modules/debian. You can execute the following command to enter an interactive Debian terminal.
debian /bin/bash
If you only need to execute a single command, for example, the id command, you can use it like this:
debian /bin/bash -c id
Attention
Advanced Usage¶
We will introduce a simple advanced usage example. After completing it, you will be able to run an SSH service or Python scripts within the environment, and there will no longer be a session limit. First, execute the following command to enter the virtual environment.
debian /bin/bash
Now, you should be inside the virtual environment. Follow us to execute the commands below, making sure not to miss any.
root@localhost: apt update
root@localhost: apt install -y openssh-server procps python3 python3-pip python3-dev
root@localhost: echo 'PermitRootLogin yes' >>/etc/ssh/sshd_config
root@localhost: echo 'StrictModes no' >>/etc/ssh/sshd_config
root@localhost: mkdir -p /run/sshd
root@localhost: # Change the root password
root@localhost: echo root:lamda|chpasswd
root@localhost: # Exit the debian environment
root@localhost: exit
Okay, you have now successfully installed SSH and Python. It's time to execute the command to start our SSH server.
debian /usr/sbin/sshd -D -e
The command above will block your current terminal. To avoid this, we can also use the built-in scheduled tasks to make this example SSH service start automatically with the FIRERPA service. Next, please execute crontab -e, add the following rule, and then restart FIRERPA or the device. For documentation on using scheduled tasks, you can also refer to the Scheduled Tasks chapter.
@reboot debian /usr/sbin/sshd -D -e >/data/usr/sshd.log 2>&1
Now, get the IP address of this device, then execute the following command on your computer and enter the password lamda to log in.
ssh root@192.168.x.x
You can continue to explore various creative ideas for endless possibilities. It is essentially a small Linux server.