Results 1 to 3 of 3

Thread: Emergency bypass of rc.local

  1. #1

    Emergency bypass of rc.local

    I'm sure I'm not the only person who has messed up his rc.local file resulting in a brain-dead router. When this happens, the only way out has been to reflash the original Asus firmware, install the telnet hack, fix the rc.local file, reload the custom firmware, and continue where I left off 1/2 hour earler.

    To rectify that, I now start the telnet server at the very beginning of rc.local then check to see if the copy button is pressed. If so, I immediately exit rc.local. The top of my rc.local file now looks like:

    #!/bin/sh

    # Always start utelnetd on local interface
    if [ ! -f /var/run/utelnetd.pid ]; then
    /apps/bin/utelnetd -d -i br0
    /bin/echo "unknown" > /var/run/utelnetd.pid
    fi

    # If the copy button is pressed, bypass rc.local
    bypass=`/bin/cat /proc/miscio/gpio_6`
    if test $bypass -eq "1"; then
    exit -1
    fi

    To activate the bypass, just press and hold the copy button during the boot sequence. You can then telnet in to fix whatever was wrong.

    - K.C.

  2. #2
    Simple but brilliant.

    Thanks

  3. #3
    i like that approach. But i will move the start of utelnetd inside the if $bypass .. block. This way i only need telnet when something goes wrong.
    Most of the time (actually allways since several month) i use ssh and leave telnet disabled.

    By the way, there is a simple solution for exchanging binaries without recompiling the whole firmware. I use the same method kfurge used to mount /opt (mount -o bind) and make copy of every directory (/etc /var /apps ...) I want to replace. I mount these copies from rc.local and can exchange links binaries libs as I like. Also this leaves you with persistent directories for /etc and /var wich makes using other apps much more comfortable. I think the few megabytes (even hundrets if neede) don't hurt this gigabyte monster of HDD.
    I tried this trick with an USB-flashdrive and it works realy nice, but i need my large thumbdrive. I will buy a new one and continue with this method. The advantage of the flashdrive is that i can use a very small rc.local which tries to mount the thumbdrive and than loads an rc.local from there. This way the router almost stays in its original state (even passwd group ...) unless the flashdrive is inserted on startup. Also the hdd is not used frequently even when running programs.


    cu Harald

Similar Threads

  1. Static route to bypass WAN port problem?
    By brusch in forum WL-500g Q&A
    Replies: 0
    Last Post: 22-06-2004, 10:38

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •