Skip to content

Bare Minimal TinyCore Linux for installing Latest ns-3-dev.

Introduction.

Nowadays, a typical minimal Linux installation with X/GUI , on a hard disk may consume 1.5 GB to 5 GB.  In addition to that, if you just try to install ns-3, the installation of dependencies, then it will consume a lot of additional disk space. If you configure and build ns-3, a lot of ns-3-related binary files (.o and .lib) that were created on the disk will consume a considerable amount of additional disk space. Finally, it may end up by consuming the disk space between 10 GB to 20 GB. Even on a chroot-based installation of ns-3, it will consume more than a GB.

For a very long time, I have been striving to create a bare minimal Linux environment specifically designed for ns-3 experiments.  This endeavor has led me to explore the possibility of creating a binary-only ns-3 Linux distro, aiming to minimize disk space consumption. The ultimate goal is to develop a compact Linux distro or VirtualBox image that incorporates ns-3, catering to beginners embarking on their ns-3 learning journey.

List of Lightweight Operating Systems with GUI

I explored different lightweight Linux distributions to create a readymade ns-3-Linux distro or VirtualBox image.

    1. Tiny Core Linux: Tiny Core Linux is a minimalist Linux distribution that is typically less than 10MB to 35MB in size. It can be run from a live USB drive or SD card, and it is a good choice for users who need a highly portable and resource-efficient operating system.
    2. SliTaz: SliTaz is another minimalist Linux distribution that is less than 50MB in size. It is based on the musl libc, which is a very lightweight and efficient C library. SliTaz is a good choice for users who need a very small and fast operating system.
    3. Damn Small Linux (DSL): DSL is a discontinued free and open-source Linux distribution that was designed to be lightweight and portable. It was typically less than 50MB in size and could be run from a live CD or USB drive. DSL was a popular choice for users who needed a lightweight operating system for basic tasks such as web browsing, email, and word processing.
    4. Porteus: Porteus is a lightweight and portable Linux distribution that is less than 300MB in size. It can be run from a USB drive or SD card, and it is a good choice for users who need a portable operating system that they can take with them wherever they go.
    5. Peppermint OS: Peppermint OS is a hybrid operating system that combines the best of Windows and Linux. It offers a familiar Windows-like interface and a wide range of Linux applications. Peppermint OS is less than 500MB in size and is a good choice for users who want a familiar and versatile operating system.
    6. BunsenLabs Linux Lithium: BunsenLabs Linux Lithium is a lightweight and minimalist Linux distribution based on Debian. It is less than 200MB in size and is a good choice for users who need a simple and easy-to-use operating system.
    7. Q4OS: Q4OS is a lightweight and user-friendly Linux distribution based on Trinity Desktop Environment. It is less than 300MB in size and is a good choice for users who want a modern and visually appealing operating system.
    8. LXLE: LXLE is a lightweight and easy-to-use Linux distribution based on Ubuntu. It is less than 500MB in size and is a good choice for users who are transitioning from Windows to Linux.
    9. SolydX: SolydX is a lightweight and customizable Linux distribution based on Arch Linux. It is less than 400MB in size and is a good choice for users who want a powerful and flexible operating system.
    10. Alpine Linux: Alpine Linux is a lightweight and security-focused Linux distribution based on musl libc. It is less than 300MB in size and is a good choice for servers and embedded devices.
    11. Debian DogLinux: Debian DogLinux is a lightweight and beginner-friendly Linux distribution based on Debian. It is less than 500MB in size and is a good choice for users who want a familiar and easy-to-use operating system.
These are just a few of the many tiny, low-footprint operating systems with a graphical user interface available. The best choice for you will depend on your individual needs and preferences.

Most of the lightweight distributions listed above will not be suitable to install ns-3-dev version because of the very old kernel or gcc and its dependencies that the os uses by default.

So, finally, I decided to use Tiny Core Linux version 14 because it it the smallest Linux distro in the world which comes with the very latest Linux Kernel and the latest gcc compiler and development tools that will be needed to compile the latest ns-3.40/ns-3-dev version.

Challenges of Creating a Tiny Linux Distro or VirtualBox Image for ns-3

Developing a minimal Linux distro or VirtualBox image specifically for ns-3 experiments presents several challenges:

  1. Balance between Minimalism and Functionality: Striking an optimal balance between a minimalist footprint and essential functionality is crucial. While reducing the distro’s size is important, it should not compromise the ability to run ns-3 simulations and provide a comfortable working environment.

  2. Dependency Management: Carefully managing dependencies is essential to ensure compatibility and avoid conflicts. The distro must include the necessary libraries and tools for ns-3 to function correctly without introducing unnecessary bloat.

  3. User Experience: The distro or image should provide a user-friendly experience for beginners, making it easy to launch ns-3 simulations and learn the fundamentals of network simulations.

  4. Maintenance and Updates: Maintaining the distro or image over time requires regular updates and ensuring compatibility with newer versions of ns-3 and related software.

Benefits of Creating a Tiny Linux Distro or VirtualBox Image for ns-3

Despite the challenges, creating a tiny Linux distro or VirtualBox image for ns-3 offers several advantages:

  1. Reduced Installation Effort: Pre-configuring the environment eliminates the need for manual installation and configuration, saving time and effort for beginners.

  2. Minimal Disk Space Consumption: A minimal distro or image significantly reduces disk space requirements compared to a full-fledged Linux installation.

  3. Enhanced Portability: A VirtualBox image can run on various operating systems, providing greater flexibility and portability.

  4. Consistent and Controlled Environment: A pre-configured environment ensures consistency and reduces the risk of compatibility issues.

  5. Beginner-Friendly Learning Platform: A ready-made distro or image provides a structured learning path for beginners, allowing them to focus on ns-3 without getting bogged down in technical complexities.

Target Audience and Use Cases

The primary target audience for a tiny ns-3 distro or image would be beginners and those seeking a convenient and streamlined learning experience. It would be particularly beneficial for:

  1. New ns-3 Users: Beginners who want to explore ns-3 without the hassle of setting up a complex development environment.

  2. Educators and Training Providers: Educators and training providers who want to provide a consistent and controlled environment for ns-3 workshops and courses.

  3. Users with Limited Disk Space: Users with limited disk space who need to optimize their resource usage.

  4. Users of Different Operating Systems: Users who want to run ns-3 on various operating systems without installing a full Linux distribution.

Potential Implementation Strategies

Several implementation strategies could be considered for creating a tiny ns-3 distro or image:

  1. Minimalist Linux Distro: Create a custom minimal Linux distribution tailored for ns-3, using lightweight desktop environments and carefully selecting packages.

  2. Read-Only Root File System: Utilize a read-only root file system to minimize the risk of system modifications and ensure a consistent environment.

  3. Layer-Based Approach: Employ a layer-based approach where the base system includes only essential components, and additional ns-3-specific layers are added as needed.

  4. Containerization: Leverage containerization technologies like Docker to create lightweight and isolated ns-3 environments.

  5. VirtualBox Image: Package the ns-3 environment along with necessary dependencies within a VirtualBox image for cross-platform compatibility.

Creating a tiny Linux distro or VirtualBox image specifically for ns-3 experiments can be a challenging but rewarding endeavor. By carefully balancing minimalism, functionality, and user experience, these tailored environments can significantly improve the learning experience for beginners and provide a convenient platform for ns-3 experiments.

Advantages of a Tiny Linux Distro or VirtualBox Image for ns-3 Experiments

A tiny Linux distro or VirtualBox image specifically tailored for ns-3 experiments offers several advantages, particularly for beginners and those seeking a convenient and streamlined learning experience.

1. Minimal Installation Hassle:

With a pre-configured ns-3 distro or image, the time-consuming and often frustrating process of setting up a bare minimal Linux environment and installing ns-3 along with its dependencies is eliminated. This streamlines the learning process and allows beginners to focus directly on exploring the capabilities of ns-3.

2. Reduced Disk Space Consumption:

A minimal ns-3 distro or image typically occupies significantly less disk space compared to a full-fledged Linux installation with X/GUI. This is particularly beneficial for users with limited storage space or those working with older computers.

3. Enhanced Portability:

A VirtualBox image can be readily used on various operating systems, including Windows, Linux, and macOS, providing greater flexibility and portability. This allows users to access the ns-3 environment regardless of their primary operating system.

4. Consistent and Controlled Environment:

A pre-configured ns-3 distro or image ensures a consistent and controlled environment, minimizing the risk of compatibility issues or unexpected conflicts that might arise from manual installations. This provides a stable platform for learning and experimentation.

5. Suitable for Beginners:

For beginners who are new to ns-3, a ready-made distro or image provides a convenient starting point, eliminating the initial hurdles of setting up the environment and installing the necessary software. This allows them to focus on learning the fundamentals of ns-3 without getting bogged down in technical complexities.

6. Potential for Lab Exercises:

A tiny ns-3 distro or image can be specifically designed to include relevant lab exercises and tutorials, providing a structured learning path for beginners. This can enhance their understanding of ns-3 concepts and practical applications.

7. Ease of Deployment and Sharing:

A pre-configured ns-3 distro or image can be easily deployed and shared with others, facilitating collaboration and knowledge exchange within the ns-3 community. This can accelerate the learning process for beginners and foster a supportive learning environment.

A tiny Linux distro or VirtualBox image tailored for ns-3 experiments offers several advantages, particularly for beginners, by simplifying installation, reducing disk space consumption, enhancing portability, providing a consistent environment, and facilitating a structured learning path. This approach can significantly improve the learning experience and encourage wider adoption of ns-3 for network research and education.

 

Getting a suitable version of TinyCore Linux.

One can download a stable, tiny linux iso image such as the following one

http://tinycorelinux.net/14.x/x86/release/TinyCore-14.0.iso

TinyCore Linux v14.0

Amazingly, the new TinyCore Linux with X/GUI will console only around 25 to 35 GB disk space.

  • Core v14.0 updates the linux kernel version to 6.1.2,
  • glibc updated to 2.36,
  • gcc updated to 12.2.0

Even with the latest kernel and gcc, and even after doing a HDD install, it will consume less than 50MB disk space.

 

Setting up a Virtual Guest under VirtualBox

Set the name of the virtual machine and os

(Note: I have used the image CorePlus-current.iso in my installation)

 

Set Hardware

Set Virtual Hard Disk

 

The Summary About the machine that will be created

 

Select the iso image from storage option

 

Boot the Virtual Machine with the iso Image and select the image X.GUI (TinyCore) + Installation Extensions. (Since we need to do a HDD install of TinyCore)

 

The TinyCore Desktop GUI

Within a few seconds, the TinyCore Desktop will be ready.

 

Installing TinyCore on HDD

Run the installer

Select the hdd and other options.

Select the File System Type

 

Set the Persistence Installation Options (if needed)

 

Select Other installation optoins

Do not forget to check “core and X/GUI Desktop, and “Installer Applicaiton”

Review the Selected Options

Install…

The installation will be completed in seconds.

 

Reboot

(Do not forget to eject the TinyCore iso )

After a successful reboot you will see the desktop of our persistently installed TinyCore Linux.

It will consume only 30 to 40MB of disk space. In other words, your VDI disk image file will be 30 to 40MB only.

Installing Dependencies for ns-3

git
gcc/g++ Compiler >= 9 or clang++ >= 10
python3 >= 3.5
cmake >= 3.10 and ninja

After installing all the dependencies, VDI disk image file will be around 145 MB only.

Downloading ns-3

Now download ns-3-dev version from

$ git clone https://gitlab.com/nsnam/ns-3-dev.git

Select the exact ns-3 version that you need

$ cd ns-3-dev
$ git checkout -b ns-3.40-release ns-3.40

 

 

 

Configuring ns-3

$ ./ns3 configure --enable-examples

Configure may fail with some errors.

 

How to fix linker error “cannot find crt1.o”?

Install glibc_base-dev

 

 

Disabling fd-net-device

In the CMakeLists.txt

Change the lines :

# fd-net-device options
option(NS3_EMU “Build with emulation support” ON)
option(NS3_TAP “Build with Tap support” ON)

 

as

 

# fd-net-device options
option(NS3_EMU “Build with emulation support” OFF)
option(NS3_TAP “Build with Tap support” OFF)

 

 

 

$  ./ns3
$ ./ns3 configure --enable-examples

 

Now configure was successful

 

Building ns-3

$ ./ns3 build

Now the build may fail with some errors:

 

Install Linux-6.6_api_headers.tcz to resolve the above error

After installing all the dependencies and configuring ns-3, VDI disk image file will be around 378 MB.

 

Sucess….

Finally, the Installation was successful. But increase the storage considerably because of the lot of binary files ( .o files and .lib files) that were created during the build.

 

 

After the successful build/compile of ns-3, the VDI disk image file will be around 976 MB. (But the actual /dev/sda1 size was around 800MB – it may be possible to shrink the VDI image size to this actual size)

 

Compiling and Running an Example Simulation

 

$ ./ns3 run first

 

 

Limitations

NetAnim

It may be possible to install NetAnim. But, it will need QT5 and all its dependent libraries. If we try to install them, it may increase the VDI image size to more than 1GB, which is beyond the original limit of image size that I wanted. So, I didn’t completed that installation.

In the future, we may try to include a binary-only version of NetAnim in that VDI Image.

Fd-net-device

To resolve an unresolvable error, I simply removed the fd-net-device from the build process. So the example simulations referring to this functionality may fail to compile successfully. In the future, we may find a solution to compile it successfully without removing the fd-net-device completely.

 

Problem with Mouse

The mouse integration (under the guest OS) is not working well;  so, sometimes, can not able to work accurately. Installing VirtualBox Guest Additions may resolve this issue. However, it was out of the scope of this experiment (since it will again increase the size of the VDI image). A quick solution for this mouse problem is:  Under “Full-Screen Mode”, the mouse works without any issue.

Conclusion

This blog article shows the possibility of creating a very tiny ns-3-Linux image that can be readily used for doing some preliminary experiments. A fully functional ns-3-Linux (without fd-net-device support) can be accommodated inside an 800MB to 900MB VDI image.  If we make this VDI image available for download, then a beginner can easily start their ns-3 experiment without installing anything at all. They only need to import that VDI image inside their VirtualBox installation and start their experiments on ns-3.

(Sorry – the VDI image is not ready for publication – because I am trying to reduce the VDI image size below 500MB by removing all other things except the ns-3 binaries)

References

  1. http://tinycorelinux.net/
  2. https://www.nsnam.org/docs/installation/html/quick-start.html
WhatsApp Discuss Through WhatsApp