Topic: How to disable FailSafe Mode

Hello people from Openwrt Forum.

I know that the failsafe is important on openwrt firmwares and it helps a lot when we make something wrong that crash our routers. But in my case, I have a shared network and due the phisycal limitations, my router unfortunately stays on a central of my building. Of course, this is a place that anyone can access and the security is none ...
Well, I created already a personalized firmware for my router that blocks all lan ports that are not used and strong passwords to try become more reliable my network. But, anyone with an Linux and Openwrt knowledge can screw and erase all my data on the router by the failsafe option. Is there any way to "eliminate" the failsafe or block it?

I will do this on two models, both tp-link. The 1043ND and an 703N.

Best Regards

Re: How to disable FailSafe Mode

This file contains the timeout for waiting for failsafe trigger:
https://dev.openwrt.org/browser/trunk/p … tc/preinit

Here is the actual wait for key routine: https://dev.openwrt.org/browser/trunk/p … lsafe_wait

And here is the actual entrance to failsafe:
https://dev.openwrt.org/browser/trunk/p … lsafe_hook
Comment out lines 7 and 8, and I think that there is no failsafe entrance any more.
(That is probably /lib/preinit/40_run_failsafe_hook in a live Openwrt box)

Re: How to disable FailSafe Mode

Destroy the button xD

Re: How to disable FailSafe Mode

hnyman, if I change the default value 2 (fs_failsafe_wait_timeout=2) for 0, the failsafe will have not time anymore to start. But I'm with problem on the 30_failsafe_wait. Which lines of these files refers to the specific entrance of failsafe? Or should I comment out all the lines of the file?

nebbia88, maybe it could be an option tongue


Best Regards

Re: How to disable FailSafe Mode

quadro20 wrote:

But I'm with problem on the 30_failsafe_wait. Which lines of these files refers to the specific entrance of failsafe?

Probably you don't need to edit that file.
30_failsafe_wait / line 81 calls the key-wait routine (which is defined above in lines 5-74), and if a key event happens, then FAILSAFE variable is set true and exported.

And then later 40_run_failsafe_hook checks that FAILSAFE variable and if true, goes into the failsafe mode.

Alternatives for you are to
a) prevent that variable ever being true,
b) disable the check for the variable's value, or
c) disable reaction to that variable's value.

Easiest might be to comment out / delete lines 7-8 of 40_run_failsafe_hook, like I said earlier. That would match c).
Or whole "if" clause, lines 6-9. That is b).

Editing 30_failsafe_wait would be a).

Re: How to disable FailSafe Mode

OK, It worked! Thanks a lot!
Now I will be more confortable althrough my device still stay in an inappropriate places.

Thanks a lot!

7 (edited by briankb 2013-08-27 02:07:16)

Re: How to disable FailSafe Mode

hnyman wrote:

/lib/preinit/40_run_failsafe_hook in a live Openwrt box
..
c) disable reaction to that variable's value.
Easiest might be to comment out / delete lines 7-8 of 40_run_failsafe_hook

I would advise against "c" since that makes your router unbootable, but ironically leaves failsafe intact if you just edited the overlay.  My understanding is that failsafe occurs before the overlay is mounted.  Please correct me if I'm wrong.  You can still get this to work by building the image and only commenting line 7 (commenting both lines seems to result in a non booting system). You can also just remove the entire file before building (preinit is supposed to be modular, afterall).

I think all of these files can be removed from your build: 10_indicate_failsafe  30_failsafe_wait  40_run_failsafe_hook  99_10_failsafe_login
The router still hangs if you press the button for failsafe on boot.  That's not really a problem of course, since we just want to make it disabled, so I'm there are probably still some failsafe guts somewhere.