Virtual Debian Environment¶
You can create a complete Debian environment that can be used within Android through the 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 an almost complete Linux runtime environment operating within an Android device.
Hint
This Debian environment only contains basic packages. You need to use apt to install commonly used commands like git, python3, etc.
Installing the Environment¶
You can find lamda-mod-debian-arm64-v8a.tar.gz
(please download the installation package corresponding to your machine architecture) on the project’s release page. After downloading, open the remote desktop and drag and upload the downloaded file to the device (we assume you haven’t modified the remote desktop’s file upload directory), then perform the following installation operation. This installation operation does not need to be repeated.
Hint
Files you upload on the remote desktop are by default in the /data/usr/uploads directory.
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 following describes how to enter the system.
Entering the Environment¶
After installing the file system for the related environment, we can execute commands 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 the Debian interactive terminal.
debian /bin/bash
If you only need to execute a command once, for example, executing the id
command, you can use it like this:
debian /bin/bash -c id
Attention
Only one instance can enter the virtual environment at a time. After you execute debian /bin/bash and keep using it, if you continue to execute this command in other terminals, it will return an error, unless you exit the first started debian /bin/bash.
Advanced Usage¶
We’ll introduce a simple advanced usage. After completion, you can run an SSH service in the environment, or run Python scripts in this environment, and there will no longer be any session limitations. First, execute the following command to enter the virtual environment.
debian /bin/bash
Now, you should be in the virtual environment. Follow us to continue executing the commands below. Note that you can’t miss any of them.
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 root password
root@localhost: echo root:lamda|chpasswd
root@localhost: # Exit debian environment
root@localhost: exit
Great, you have now successfully installed SSH and Python. Now it’s time to execute the command to start our SSH server.
debian /usr/sbin/sshd -D -e
The above command will freeze your current terminal. To avoid this problem, 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
, and write the following rule in it and restart FIRERPA or the device. You can also check the “Scheduled Tasks” chapter for documentation on using scheduled tasks.
@reboot debian /usr/sbin/sshd -D -e >/data/usr/sshd.log 2>&1
Now get the IP address of this device, and 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 develop all kinds of creative ideas to achieve unlimited possibilities. It is just like a small Linux server.