Bootloop after adding init script


i am using the router described here and added a script in the /etc/init.d folder that should try a command and then retry this command if it failed.

I tried it on the cli first, and it worked as expected, but after a turning the router off it does not boot properly anymore.

This is the file i tried to use

#!/bin/sh /etc/rc.common


start() {

    while [ ! -f "$file" ]; do
        sleep 1

    input=$(cat "$file")

    while : ; do
        res=$(command $(input))

        case "$res" in
                sleep 1


The router is not accessible anymore via ssh or adb. How can it be unbricked and what is the mistake that i am making?

What is this script supposed to do?

Use failsafe mode to boot up and then delete the script.

1 Like

The script changes a Modem configuration that has to be set at startup as early as possible.

Pressing the button on the Stick seems to do nothing.
Is there maybe a different way to enter failsafe mode for this kind of device?

What is the device brand and model? What version of OpenWrt is installed?

Sorry, script does not do what you describe, where did you get it from?

Its the uz801_v3.2 LTE Modem build by huasifei with the ImmortalWrt snapshot r27121-ab66d7ebcc on it. Its based on OpenWrt from about September of last year i think.

Its currently not official supported

I took a script as a reference and then altered with the commands i wanted to execute. I removed the exact command to make it better readable.
The original command sends an at command with socat to the modem.

What does it do then and what do i have to change to do what i described?

You need to ask the people at ImmortalWrt how to engage failsafe mode or otherwise fix the isse. That project is "based on" OpenWrt, but they make significant modifications to the code, thus materially affecting the methods by which OpenWrt functions -- the projects are different and we cannot help you here.

Okay i understand that. But can you say how i would create the init script i intended to write for OpenWrt?
I know that this might not work, but it would help me a lot.

while loop seems LLM generated, you did not explain logic either.

I think you should ask that question of the ImmortalWrt people, too... the way their boot process works may be a bit different than OpenWrt.

Your script is probably hung in an infinite while loop when booting....


Where did you get that script from? It does not do what you say. Worth hmm running start script standalone before making it into boot loop. At least start them after ssh....

standalone worked just fine. Only took the basic frame:

#!/bin/sh /etc/rc.common


start() {


from a existing script
but i rushed it..
the at port to the modem is not loaded at that point or the file cant be read and that results in a lock i guess.

whats usually a safe START value?

or is it possible to just start this loop with the init script in the background so that the rest continues normally?

For empty script you can use any values.

1 Like

Follow Procd system init?

1 Like