Chroot based Virtualization
According to Wikipedia “A chroot on Unix operating systems is an operation that changes the apparent root directory for the current running process and its children. A program that is run in such a modified environment cannot name (and therefore normally cannot access) files outside the designated directory tree. The modified environment is called a chroot jail.”
Keep in mind that the OS environment virtualized in chroot jail will only use the kernel of the host operating system. Since every ‘self-contained’ kernel doesn’t depend on the standard C library or any other library, installing any software under chroot will only depend on the libraries that we instal inside the chroot environment. Technically, in a chroot environment, we can use an old Linux variant with a new kernel of the host(or even an elder kernel of the host).
So, using this amazing chroot facility, we can easily install any guest UNIX/Linux variant under a host operating system and install/compile any software without disturbing the packages and software that are installed on the host OS.
It is a classical and brilliant way of virtualization.
Installation of Debian 10 Buster (64 bit) chroot Jail Environment under Debian 11
The Installation Requirements of chroot jail environment in Host
- Any low or high version of Unix/Linux desktop Host OS installation ( we need not worry about the version of GCC and other libraries installed in the Host OS)
- binutils and debootstrap package
Note: I used Debian 11 as the host OS. But, technically/theoretically, it is possible to use any lower version of Debian Host or even any other lower version of Linux/Unix variant as HOST OS.
Installation of chroot Jail
Step 1: Install the dependencies
Step 2: Create a directory for holding the root file system (of the guest OS -Debian 10). Here I am creating a folder “Debian10Buster” under a partition that is mounted under /mnt/Virtual.
$ mkdir Debian10Buster
Step 3: Download the entire directory structure of 64 bit Debian 10 (Buster) Linux under the folder Debian10Buster using debootstrap command
The following image shows the downloaded root directory structure of Debian 10 under the mounted file system of Host OS Debian 11
Step 4: Starting the ‘chroot jail’ terminal
# export display environment of host OS for running GUI application of chroot (guest) using the host OS’s windowing system.
$ export DISPLAY=:0.0
$ xhost +
# Enter into chroot jail
$ cd /mnt/Virtual
$ sudo chroot ./Debian10Buster
The above command opens the terminal of chroot jail Environment.
The following terminal output shows the root (/) of the chroot jail.
So the above terminal is a root (/) file system of the Debian 10 Buster which is under chroot jail.
From this terminal, we can not access the root file system of the Debian 11 host. So we can safely do all our installations and experiments under this chroot jail.
The following is the view from the host OS’s desktop. Here the left side file explorer shows the absolute path of the chrooted folder. But the right-side terminal shows the same location under restricted chroot jail.
Now we can install any Linux software under this chroot jail without disturbing the host operating system.
The Main Advantage of Using Chroot:
Using this amazing, classical virtualization technology, one can install any number of software under chrooted environment.
For example, in the following screenshot, we see 11 different Deibian installations on separate chrooted directories. We can start any number of such chrooted Linux environments simultaneously on the same laptop.
Further, it is possible to install more than one compatible version of ns-3s or any software on a single chrooted environment. The following screenshot shows that there are different versions of ns-3s and other software that are installed on a chrooted 64bit version of Debian10 Buster Operating System.
Some Examples of “Chroot Jail” based Simulations
In the following articles, you may find some of the simulations that I did under chroot jail. Please note the excellent performance of these GUI based 3D simulations. In fact, these simulations are actually running under chroot jail but the GUI 3D outputs are rendered in the Host Disply’s windowing system. So that these simulations are getting the native 3D performance. One will never get such a level of performance under any other kind of virtualization like “VirtualBox”.
For installing ns-3.37, one may follow the procedure explained in the following article :
Simulations using chrooted Debian 10 Buster AMD64 (Under Debian 11 Host)
- Simulating And Visualizing 3D Mobile Underwater Sensor Network (UWSN) Under ns-3
- Simulating And Visualizing 3D Aerial Ad-hoc Network (AANET) and Flying Ad-hoc Network (FANET) Under ns-3
- Simulation of Multi-Tire UAV/AANET/FANET Topology Using Gauss-Markov 3D Mobility Model Under ns-3
- Using Gauss-Markov 3D Mobility Model Under ns-3 for Simulating Unmanned Aerial Vehicle (UAV), Aerial Ad-hoc Network (AANET) and Flying Ad-hoc Network (FANET)
Simulations using chrooted Debian 9 Stretch AMD64 (Under Debian 11 Host)
- Simulating And Visualizing 3D Flying Ad-hoc Network (FANET) Under Omnet++
- Simulating and Visualizing 3D Underwater Wireless Sensor Network (UWSN) Under Omnet++
- Installing NetSimulyzer 3D Visualization Tool under Debian/Ubuntu
- Installing NetSimulyzer 3D Visualization Support Add-on Module in ns-3 under Debian/Ubuntu