PDA

Bekijk de volledige versie : Rc.local problem



ZZero
05-04-2007, 08:33
I know there is probably a simple solution to this but:
I don't think my rc.local is working properly. I installed it the way KC discribed in the firmware upgrade. But whenever i log into TELNET i have to type in:
export PATH=/opt/bin:${PATH}
export LD_LIBRARY_PATH=/opt/lib:${LD_LIBRARY_PATH}
in order to use Screen or enhanced-ctorrent.
I have my Rc.local in /shares/MYVOLUME1/

This is the coding in my rc.local:
-----
#!/bin/sh

pool=`nvram get apps_pool`
share=`nvram get apps_share`
internal_hdd=/dev/ide/host2/bus0/target0/lun0/disc

if [ \! -f /tmp/rc.local.done ]; then

# Indicate we've already done this
touch /tmp/rc.local.done

#
# Mount /opt and connect in various system files
#
if [ -e /shares/${pool}/opt ]; then
mount -o bind /shares/${pool}/opt /opt

cat /proc/mounts > /opt/etc/fstab

ln -s /opt/etc/shells /tmp/shells
ln -s /opt/etc/fstab /tmp/fstab

export PATH=/opt/bin:/opt/sbin:${PATH}
export LD_LIBRARY_PATH=/opt/lib:${LD_LIBRARY_PATH}
fi

# Start utelnetd on local interface only!
/apps/bin/utelnetd -i br0 &

fi

/opt/sbin/cron

/opt/sbin/syslogd -m 0 -O /opt/var/log/messages -S

/opt/sbin/thttpd -d /opt/share/www -c /cgi-bin/* -p 8008 -u root
-------
thanks thanks

kfurge
05-04-2007, 18:41
The $PATH and $LD_LIBRARY_PATH environment variables won't stick outside of rc.local.

To fix that, install bash and make /opt/bin/bash your shell then add the $PATH and $LD_LIBRARY_PATH lines to the .profile file in your user directory.

- K.C.

ZZero
06-04-2007, 11:03
I installed bash, however when i restarted my router i can no longer log into telnet. Putty pops up for a second and then closes. I figured i messed up on the rc.local and tried to install the asus firmware then back to KC's and apply telnet hack and i still cannot log into router. What am i doing wrong, i didn't setup a password but my rc.local in directory /shares/MYVOLUME1/so i can't delete it. Please help! Is there anyway to scrub HD and start from scratch, i tried holding down reset and nothing, i also tried ezsetup and nothing. I can only log in through FTP and windows interface.

Thanks
ZZero

kfurge
07-04-2007, 01:38
To fix an rc.local problem:

1. reflash with asus firmware
2. Apply telnet hack
3. Telnet in and delete rc.local
4. reflash with custom firmware
5. put working rc.local back on

- K.C.

ZZero
07-04-2007, 02:31
Thanks, it worked. Your a life saver :)

medsource
09-04-2007, 22:04
To fix an rc.local problem:

1. reflash with asus firmware
2. Apply telnet hack
3. Telnet in and delete rc.local
4. reflash with custom firmware
5. put working rc.local back on

- K.C.

You could also use the poor-mans telnet enable hack... for quick fixes

1) Enable (or re-enable) the built-in web site
2) Modify the index.cgi in the shares/MYSHARE1/web/Layout_English/index.cgi and add "/apps/bin/utelnetd -i br0" (minus the quotes) to the last line and save (use the appropriate editor)
3) Direct your web browser to the website (usually http://<ip>:8081)
4) Telnet to your hearts content (and fix your rc.local)
5) Make sure to remove the added line to index.cgi (or disable the website or whatever).

Easier than a re-install when it works (saved me about a week ago).

kfurge
11-04-2007, 03:25
You could also use the poor-mans telnet enable hack... for quick fixes


True, unless you mess up rc.local so bad that the router failes to even progress to the point of being able to service http requests. In that case, only the bullet-proof recipe works.

- K.C.

medsource
12-04-2007, 22:01
True, unless you mess up rc.local so bad that the router failes to even progress to the point of being able to service http requests. In that case, only the bullet-proof recipe works.

- K.C.

Agreed, but it's also worth the 2 minutes effort to see if salvage is an option prior to starting over.

oclee
07-05-2007, 20:39
You could also use the poor-mans telnet enable hack... for quick fixes
[...]
2) Modify the index.cgi in the shares/MYSHARE1/web/Layout_English/index.cgi and add "/apps/bin/utelnetd -i br0" (minus the quotes) to the last line and save (use the appropriate editor)
[...]


Could you please tell me what the appropriate editor is? I locked myself out of my shell (stupid I know), however, I cannot get this telnet hack to work for me.

I use linux to get to the files (through nfs), but when I edit a .cgi file the editor messes up the ownership. Unfortunately, I am not allowed to change this back to 0:42000 (as it should be).

As a result I get the source of the file displayed, in stead of it being parsed. So I'm still locked out. (A very safe situation, although it isn't the one I was hoping for...)

How did you stop this ownership change from happening?

Or is there an alternative? For instance, is it possible to reset the WL700 in such a way that it erases the rc.local file? Reflashing (at this moment) doesnt affect it at all.

Thanks for any suggestions.

tiwag
07-08-2007, 14:12
Could you please tell me what the appropriate editor is?
on Windows i'm using TextPad editor www.textpad.com
which is able to keep unix linefeeds automatically



I locked myself out of my shell (stupid I know), however, I cannot get this telnet hack to work for me.

I use linux to get to the files (through nfs), but when I edit a .cgi file the editor messes up the ownership. Unfortunately, I am not allowed to change this back to 0:42000 (as it should be).

As a result I get the source of the file displayed, in stead of it being parsed. So I'm still locked out. (A very safe situation, although it isn't the one I was hoping for...)

How did you stop this ownership change from happening?

...

had the same problem :mad:

if you want to use the index.cgi-hack (/shares/MYSHARE1/web/Layout_English/index.cgi)
it works best with ftp-access

if you first delete and then copy a new version of index.cgi,
then the execute permissions are lost (at least when using my ncftp client)

better is to edit the index.cgi file first and to overwrite it,
then the permissions are preserved

to correct the premissions, i've created a user with full access to ftp,
ftp'ed in with this user account. change the working directory to

cd /shares/MYSHARE1/web/Layout_English

and the just run from your ftp client

chmod 777 index.cgi




originally i wanted to set the permissions of my /shares/MYVOLUME1/rc.local
which i forgot before i commented out utelnetd :mad: :mad:

for this purpose i added the following command to the end of the index.cgi file

chmod 755 /shares/MYVOLUME1/rc.local

then browsed to my Web-page once and restarted the WL700g
which corrected the permissions, fixed and works

hth

--
tiwag