MD-253 FTP problem

MD-253 & MD-500 Discussion
Post Reply
techman
Posts: 2
Joined: Sat Oct 26, 2013 11:47 am

MD-253 FTP problem

Post by techman » Sat Oct 26, 2013 12:13 pm

Hello, i habe a MD-253 with Firmware 2.4.21, when i make a Factory Reset the FTP Server running. When i make a Restart of the Nas the FTP Server is not running, when i startet in Service the FTP Server then jump the point from Enabel to Disabel. After a Factory reset then runing Again the FTP server.

Chris

emiespo
Posts: 12
Joined: Sat Feb 11, 2012 11:03 am

Re: MD-253 FTP problem

Post by emiespo » Thu Nov 21, 2013 12:50 am

I had a similar problem, the NAS starts with the FTP server disabled, and it can't be enabled via Web interface.
I remembered it worked with DHCP on, thus resetting the NAS to factory settings, but I don't want to reset this shitty NAS whenever I have an issue, so I looked for a better solution myself! I noticed I set up a static IP, and also noticed that I can't change it back to DHCP, too!

Image

(trying to set "Dynamic IP" results in a popup saying: "No DHCP server."... shit!).

Connecting to the NAS via SSH (read this post: viewtopic.php?f=235&t=5109 for instructions on how to install the SSH daemon) and trying to start proftpd by hand, resulted in this error:

Code: Select all

emiliano@AO722:~$ ssh toor@192.168.1.140
toor@192.168.1.140's password: 
~ # proftpd 
 - warning: unable to determine IP address of 'nas'
 - error: no valid servers configured
 - Fatal: error processing configuration file '/etc/sysconfig/config/proftpd/proftpd.conf'
Bad luck: /etc/sysconfig/... is NOT writable, so I had to check elsewere. Then I looked into "/etc/hosts":

Code: Select all

~ # cat /etc/hosts 
127.0.0.1       localhost.localdomain   localhost
192.168.1.140   (none).localdomain         (none)
...BINGO! This command showed a weird configuration preventing proftpd from starting and possibly DHCP from being activated again. So in order to fix this, I added a couple of extra commands to the Twonky package init script (you can choose any other user package init script, since they are executed BEFORE the ftp service and WRITABLE because they are stored on the NAS disks).

Here are the steps required to fix this issue.

1) connect to the web interface, log-in, and click on the "Setup" tab.
Take note of the Device name value (mine was the default "nas").

Image

2) connect to the NAS via ssh, and check that you have those "none" stuff inside "/etc/hosts":

Code: Select all

emiliano@AO722:~$ ssh toor@192.168.1.140
toor@192.168.1.140's password: 
~ # cat /etc/hosts 
127.0.0.1       localhost.localdomain   localhost
192.168.1.140   (none).localdomain         (none)
3) now execute this command (I chose twonky startup script, any other user package startup script will do):

Code: Select all

~ # vi /home/PUBLIC/.pkg/Twonkymedia/scripts/twonkymedia/twonkymedia.sh 
4) look for the "start" command:

Code: Select all

case "$1" in                                                                   
  start)                                                                       
    if [ -e $PIDFILE ]; then                                                   
      PID=`cat $PIDFILE`                                                       
      echo "TwonkyMedia server seems already be running under PID $PID"        
      echo "(PID file $PIDFILE already exists). Checking for process..."       
      running=`ps --no-headers -o "%c" -p $PID`                                
      if ( [ "${DAEMON}"=="${running}" ] ); then                               
        echo "Process IS running. Not started again."                          
      else                                                                     
        echo "Looks like the daemon crashed: the PID does not match the daemon."
        echo "Removing flag file..."                                            
        rm $PIDFILE                                                             
        $0 start                                                                
        exit $?                                                                 
      fi                                                                        
      exit 0                                                                    
    else                                                                        
      if [ ! -x "${TWONKYSRV}" ]; then                                          
          echo "TwonkyMedia server not found".                                  
          rc_status -u                                                          
          exit $?                                                               
      fi                                                                        
      echo -n "Starting $TWONKYSRV ... "                                                                                        
      nice -n -10 "$TWONKYSRV" -D -inipath /home/twonkymedia -ininame twonkymedia-server.ini                                    
      rc_status -v                                                                                                              
    fi                                                                                                                          
  ;;                                                                                                                            
  stop)                                                                                                                         
5) add the first four lines below, just before "echo -n "Starting $TWONKYSRV ... ".
Remember to replace "nas" with your device name (see step 1):

Code: Select all

      DEVICENAME=nas                                                            
      echo -n "Patching /etc/hosts file..."                                     
      sed -r 's/([0-9\.]+(\s|\t)+)\(none\)(\.localdomain(\s|\t)+)\(none\)/\1'$DEVICENAME'\3\4'$DEVICENAME'/' /etc/hosts >/tmp/hosts.fixed
      mv /tmp/hosts.fixed /etc/hosts                                                                                                               
      
      # ADD BEFORE THIS LINE
      # echo -n "Starting $TWONKYSRV ... "
5bis - optional :) ) BONUS: the command:

Code: Select all

nice -n -10 "$TWONKYSRV" -D -inipath /home/twonkymedia -ininame twonkymedia-server.ini
(look for it inside step 4 above) starts Twonkyserver with a higher priority, making the DLNA service *totally usable* even with a full HD streaming AND the torrent service active (all the rest will be slowed down, but Twonkyserver won't lag anymore!).
Plus, with the param "-inipath" you can set a working dir on the HD (I chose /home/twonkymedia) and with "-ininame" you can customize your configuration file, making Twonky settings saved via the web interface finally persistent to system reboots.

6) reboot your nas:

Code: Select all

~ # reboot
7) connect again to the NAS, if everything went OK you should have your FTP server ON, and executing "cat /etc/hosts" you should see something like this (nas will be replaced with your device name, see step 1):

Code: Select all

~ # cat /etc/hosts
127.0.0.1       localhost.localdomain   localhost
192.168.1.140   nas.localdomain         nas
Problem solved! Hurrah! :mrgreen: :mrgreen:
(well, I still can't switch DHCP on, but I don't care atm since I don't need it, this will be dealt with another time :oops: )

I really hope my post helped!
Kind regards.
You do not have the required permissions to view the files attached to this post.

techman
Posts: 2
Joined: Sat Oct 26, 2013 11:47 am

Re: MD-253 FTP problem

Post by techman » Thu Nov 21, 2013 7:42 am

Many thx :-)

Post Reply