How to fixed longer loading when opening GCASH apps in Adopisoft version 5.1.7?

Note: For Business version only 1, Run this bootoptimizer.sh in the terminal Download: sudo wget -O /tmp/bootoptimizer.sh  https://github.co...

Monday, March 2, 2026

Adopisoft fixed for RTNETLINK error and almost Full ZRAM1 storage allocation problem

I have updated the C code to be 100% universal. I added an auto-detection feature inside the C code itself. When the binary runs, it will automatically check whether it is on a Pi (/sbin/) or Ubuntu (/usr/sbin/) and route the traffic to the correct folder instantly. This means your never have to manually edit the C code!

Cross-Platform Performance Optimization: The Native C Wrapper

The Symptom: Network Lag and Packet Loss

While deploying an OS-level Bash script successfully prevents the RTNETLINK answers: File exists 10,000-session crash, it can introduce a new bottleneck in high-throughput environments.

Because an interpreted Bash script forces the CPU to open a heavy environment multiple times per second, the physical network interface can momentarily choke under the processing overhead, resulting in ping spikes and "Request timed out" errors during user authentication.

The Solution: A Universal Native C Binary

To eliminate the lag while retaining the protective mathematical armor, the interception logic must be compiled directly into native machine code. A C binary executes in a fraction of a millisecond with virtually zero overhead, passing the hexadecimal translations to the Linux kernel without interrupting packet flow.

The following deployment guide is designed to be fully cross-platform. It automatically adapts to both ARM architectures (Raspberry Pi) and x86 architectures (Ubuntu PC/Server).

Step-by-Step Deployment Guide

Step 1: Ensure Core Packages are Installed Certain minimal server distributions (like Ubuntu Server) may be missing the core traffic control package or the C compiler out of the box. Force the system to install and verify them:

Bash
sudo apt update
sudo apt install --reinstall iproute2 gcc -y

Step 2: Identify and Backup the Native Program Depending on your operating system, the native tc program lives in a different folder. We will use a terminal variable to find it dynamically and safely rename it. Run these two commands exactly as written:

Bash
TC_PATH=$(which tc)
sudo mv $TC_PATH $TC_PATH.original

Step 3: Write the Universal C Source Code Create a new C file in the home directory:

Bash
nano ~/tc_wrapper.c

Insert the following highly optimized C code. This script includes an auto-detection block that automatically finds the tc.original file whether your system is a Raspberry Pi or an Ubuntu machine.

C
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

int main(int argc, char *argv[]) {
    // Auto-detect the original program path (Raspberry Pi vs Ubuntu)
    char *original_path = "/sbin/tc.original";
    if (access("/usr/sbin/tc.original", F_OK) == 0) {
        original_path = "/usr/sbin/tc.original";
    }

    // Allocate memory for the arguments list
    char **new_argv = malloc((argc + 1) * sizeof(char *));
    new_argv[0] = original_path;

    for (int i = 1; i < argc; i++) {
        new_argv[i] = strdup(argv[i]);

        char *colon = strchr(argv[i], ':');
        if (colon != NULL) {
            // Ignore MAC and IPv6 addresses
            if (strchr(colon + 1, ':') == NULL) {
                
                // Catch format "classid 1:10000"
                if (strlen(colon) > 1) { 
                    int minor = atoi(colon + 1);
                    if (minor >= 10000) {
                        int major_len = colon - argv[i];
                        int safe_val = 40960 + (minor % 24575);
                        char new_arg[64];
                        snprintf(new_arg, sizeof(new_arg), "%.*s:%x", major_len, argv[i], safe_val);
                        free(new_argv[i]);
                        new_argv[i] = strdup(new_arg);
                    }
                } 
                // Catch format "handle 10000:"
                else if (strlen(colon) == 1 && colon != argv[i]) { 
                    int major = atoi(argv[i]);
                    if (major >= 10000) {
                        int safe_val = 40960 + (major % 24575);
                        char new_arg[64];
                        snprintf(new_arg, sizeof(new_arg), "%x:", safe_val);
                        free(new_argv[i]);
                        new_argv[i] = strdup(new_arg);
                    }
                }
            }
        }
    }
    
    new_argv[argc] = NULL;

    // Execute the real Linux traffic control program instantly
    execv(original_path, new_argv);

    // This only prints if execv fails
    perror("Wrapper failed to execute tc.original");
    return 1;
}

(Save and exit by pressing Ctrl+O, Enter, then Ctrl+X).

Step 4: Compile and Deploy Use the GNU C Compiler to build the executable binary. The uppercase -O2 flag strictly optimizes the program for maximum execution speed. Using our terminal variable again, we drop the newly compiled armor directly into the correct system folder.

Bash
gcc -O2 ~/tc_wrapper.c -o ~/tc
sudo mv ~/tc $TC_PATH
sudo chmod +x $TC_PATH
rm ~/tc_wrapper.c

Post-Update Verification Check

Whenever your operating system undergoes a major apt upgrade, it is possible for Linux to overwrite this custom wrapper with a fresh, vulnerable copy of the native program.

Network administrators can perform a rapid file-size check to verify the armor is still in place. Run this command:

Bash
ls -lh $(which tc)*

  • If the wrapper is active: The main tc file will be extremely small (approx. 17K), while the tc.original file will be massive (approx. 500K - 800K).

  • If the wrapper was overwritten: The main tc file will jump back up to 500K+. If this happens, simply repeat Steps 2 through 4 to re-apply the patch.



Additinal cronjob that will free space in your zram1



Login to your vendo machine via ssh and add this to cronjob

sudo crontab -e
  then PRESS ENTER and type your password on password prompt


Scroll down to the bottom using <arrow down>
Copy and paste this at the bottom of the line:

#This command will clear logs in zram1 storage every 6 hours
0 0,6 * * * truncate -s 0 /var/log/syslog; truncate -s 0 /var/log/dmesg; truncate -s 0 /var/log/pppoe-server-log; truncate -s 0 /var/log/auth.log; truncate -s 0 /var/log/kern.log; truncate -s 0 /var/log/lastlog; truncate -s 0 /var/log/lastlog; truncate -s 0 /var/log/wtmp; truncate -s 0 /var/log/apt/eipp.log.xz; truncate -s 0 /var/log/apt/dataplicity.log; truncate -s 0 /var/log/apt/alternative.log; truncate -s 0 /var/log/nginx/access.log; truncate -s 0 /var/log/armbian-hardware-monitor.log; truncate -s 0 /var/log/supervisor/supervisor.log; truncate -s 0 /var/log/postgresql-16-main.log; truncate -s 0 /var/log/dataplicity.log; truncate -s 0 /var/log/supervisor/supervisord.log; truncate -s 0 /var/log/alternatives.log

To save your changes press CTRL+O combination then PRESS ENTER
To exit press CTRL+X combination

----------------------------------------------------------------------------------------------------------------------

If in case you decided to remove the wrapper for any reason. You can do it with this:

To make sure you can safely remove the wrapper on any machine without having to guess the folder, here is the Universal Revert Method. It works exactly from previoous guide, but automatically detects where your system keeps its files.

The Universal Revert Commands

Run these three commands in order. The first command locks in the correct folder path, no matter which device you are using:

1. Find the path and delete the wrapper:

Bash
TC_PATH=$(which tc)
sudo rm $TC_PATH

2. Restore the original native program:

Bash
sudo mv $TC_PATH.original $TC_PATH

3. Reboot to flush the kernel:

Bash
sudo reboot

Once the system reboots, it will be 100% back to vanilla Adopisoft running the native Linux networking tools.

No comments:

Post a Comment