Sunday, 8 February 2015

D Link DNS 320: Installing fun_plug and Transmission. Trial and error for Linux newbie.

19th March 2016: There were some broken links for the pictures. I have updated it.


I have a D-Link DNS 320 ShareCenter Network Access Storage (NAS) for quite some time. It is a basic NAS which I used to store photos, documents and most importantly, movies. From the NAS, I stream it via LAN to my AC Ryan outside in the living room. The functionality of DNS 320 is nothing compared to Synology or Asustor but it is serving me well so far.

One of the things that I like about it is the in-built torrent download. I put in the torrent URL, click on Add Torrent button and the download will be start straight into the NAS, without going through the PC. I can leave the NAS overnight and it will download anything.



Unfortunately, this has not worked, ever since I upgraded the firmware.So I used a torrent client. But I would need to turn on the PC. I have used this for the longest time until I decided to install fun_plug and transmission. It was not easy to come to this. I did initial research on fun_plug and I was put off as there are Linux commands involve. I know nothing of Linux and I was worried I would screwe up the NAS. I did more research and there is no one single site that can show me how to do this. I would have to rely on multiple sites and these are the ones that I rely on:

http://tutboss.com/how-to-install-funplug-0-7transmissionpyload-on-dlink-dns-320l/

http://klseet.com/index.php/d-link-dns-320-nas/173

http://bernaerts.dyndns.org/nas/71-dns325-ffp07/224-dns325-funplug-07

http://nas-tweaks.net/371/hdd-installation-of-the-fun_plug-0-7-on-nas-devices/


This article that I am writing is more for a reference for what I have done with my NAS, so that I do not have to refer to multiple sites if anything goes wrong. If you plan to install ffp, I suggest that you read all the resources I mentioned earlier and read my article until the end. I do not suggest that mine is definitive and it comes with its own caveat. It has worked with my DNS 320. I do not know if it works for other NAS.

My current setup is as follows:
Windows 7
DNS 320 with Firmware 2.03

My intention is to install:
fun_plug
Transmission

I would need the following tools as well:
PuTTY
WinSCP

In summary, I am going to install fun_plug. Make sure that it is correctly installed and running. Next I am going to install transmission.

1. Download fun_plug (ffp)

i. The current version of fun_plug is funplug 0.7. There are lots of repository to download this version. And it comes with a embedded with a software called slacker, which is very useful later on. I downloaded fun_plug 0.7 from the following site:

http://nas-tweaks.net/371/hdd-installation-of-the-fun_plug-0-7-on-nas-devices/

Reason is because it is catered for the NAS that I am using. The files that I download are as follows:

  • fun_plug
  • fun_plug.tgz
    • Version “ARM” for EABI-devices (like the DNS-320/325/345 and CH3MNAS) (Mirror)
    • Version “OABI” for OABI-devices (like the DNS-323 and CH3SNAS) (Mirror)

Ensure that these two files are named fun_plug (not fun_plug.sh) and fun_plug.tgz (not fun_plug.gz or fun_plug.tar.gz or fun_plug.tar).

2. Install ffp

On the DNS 320, place it on the top directory of Volume_1.

Place this 2 files in Volume_1 of your NAS.

Restart the DNS-320




After the reboot, go back to Volume_1. There will be a couple of new files added to your Volume_1.
That means fun_plug was successfully installed.



With the reboot done and the additional fun_plug files install, we would need to connect to the DNS-320 using a protocol called Telnet with a telnet client called PuTTY. 

In the PuTTY configuration screen, we would need the following
- the host name (or IP address) of the DNS-320. In my case, I use the IP address.
- select the Connection type as 'Telnet' (which defaults to port 23)

Click on Open.






I would get a response as follows:

Response when telnet into NAS.

This prompt tells me that I am logged in.


3. Change Root Password

The root password has to be changed.

In the telnet session, enter the following commands:

sh-4.1# usermod -s /ffp/bin/sh root
sh-4.1# mkdir -p /ffp/home/root/
sh-4.1# sed -ie 's#:/home/root:#:/ffp/home/root:#g' /etc/passwd
sh-4.1# pwconv
pwconv: failed to change the mode of /etc/passwd- to 0600
sh-4.1


Afterwards, we will need to set a new root password, with the following command:

sh-4.1# passwd
Changing password for root
Enter the new password (minimum of 5 characters)
Please use a combination of upper and lower case letters and numbers.
New password:
Re-enter new password:
passwd: password changed.



To test the password, do the following:

sh-4.1# login
NAS login: root
Password:<Enter Password>
No mail.
root@NAS:~ 

This means we are able to login with the password. 


4. Save Root Password

Next step is to store the password and configuration in the memory, otherwise the new password is lost everytime we boot the DNS 320.

Command is as follows:
wget http://wolf-u.li/u/172/ -O /ffp/sbin/store-passwd.sh
store-passwd.sh

It will look as follows:

Password saved. Do note that your response may be different from the 
screenshot above. Its ok,as long as the password is saved.


5. Activate SSH
According to nas-tweaks.net, telnet has major security limitations. So we would be using secure shell.

Continuing from our existing session from where we left off earlier on.

Login using the password we set earlier on.


And type in the commands as follow:

sh-4.1# chmod a+x /ffp/start/sshd.sh
sh-4.1# sh /ffp/start/sshd.sh start
Generating public/private rsa1 key pair.
Your identification has been saved in /ffp/etc/ssh/ssh_host_key.
Your public key has been saved in /ffp/etc/ssh/ssh_host_key.pub.

The script will generate some funny looking figures.
Then it will start /ffp/sbin/sshd.
The SSH daemon is now active and running.

Leave the telnet session running. Do not exit yet.


6. Login SSH

Open another PuTTY session and login into the device again, this time using the SSH mode.


Click on Open


Click on Yes to continue.



Login as: root and put in the password we have set earlier on.
the command: ls will list the files within the folder.
So we have tested the ssh server and the associated root password, and encryption keys are working. So we can exit the telnet session by entering that last command:
sh /ffp/start/telnetd.sh stop


Reboot the DNS 320. Launch PuTTY and SSH login with the password we have set earlier.
If you are able to login, congrats!!
FunPlug 0.7 installed successfully!!


7. Installing Transmission

We need to install additional packages from the following commands:

Launch PuTTY and SSH root login with password.
Enter the following command:

wget http://wolf-u.li/u/441 -O /ffp/bin/uwsiteloader.sh
chmod a+x /ffp/bin/uwsiteloader.sh
uwsiteloader.sh

After entering the last line, a pop-up will appear:



Select Yes


Select OK



Select the packages.
Use the arrow-keys on the keyboard to move the highlight. To select, press the spacebar. It is selected when there is a [*] at the beginning at the line.

Select the following:
- fonz
- Uli
- kylek
- Memiks

At the end, choose 'OK' and press 'Enter'


Note of the packages selected. Press 'Enter'



Yes to Slacker!!

With slacker installed, it is much easier for the next steps.

On the SSH session, with the root login, run the following command:

root@NAS:~# slacker

And the following will appear:
slacker options pattern...
Options:
        -U      Update package lists
        -C      Clear cache

        Install, reinstall or upgrade:
         -a     List all available packages
         -I     List available packages that are installed and up-to-date
         -i     List available packages that are not installed
        -u     List available packages that differ from the installed version
       

        Remove packages:
         -r     Remove installed packages
         -o     List installed packages not present at sites

        -A      Pre-select all packages in the dialog
        -F      Do not apply ignore list
        -c      Print report to stdout, no menu


So I will type the following:
root@NAS:~# slacker -a




I have existing files. That is why it is showing to reinstall. 

We would need to locate and install the following:
- Transmission 2.83
- Curl 7.27.0

Press 'Enter' to execute the installation.


8. Location of hard disk drive.

Type in the following command to check the actual directory path.
root@NAS:~# df    and
root@NAS:~# mount






I have 2 hard disk drive (HDD). I am looking for the primary Volume_1. In this case, its
/mnt/HD/HD_a2. 
Take  note of this location address. We would need it later.


5. Run Transmission.
The command is as follows and hit ENTER:
root@NAS:~# su nobody -c "transmission-daemon -f -g /mnt/HD/HD_a2/.transmission-daemon -w /mnt/HD/HD_a2/Downloads -t -u <Your-Desire-UserID-Here> -v <Your-Desire-Password-Here> -a 127.0.0.1,192.168.*.*"

where:
/mnt/HD/HD_a2/: the location of the primary drive earlier on. 
<Your-Desire-UserID-Here> Your transmission login, without the brackets <>
<Your-Desire-Password-Here> Your transmission password, without the brackets<>.

After you hit ENTER, if you see something as follows, this means Transmission installation is a success.


Add caption


If there is no reaction, stop and go through the steps again. It could be as simple as a spelling error.

If all is ok and running, press CTRL+C to stop it.
The response will be as follows:
Closing transmission session...  done.

root@NAS:~#

The command to Start and Stop Transmission manually, are as follows:
root@NAS:~# /ffp/start/transmission.sh start
Starting transmission-daemon
root@NAS:~# /ffp/start/transmission.sh stop
Stopping transmission-daemon
root@NAS:~#


To check the status of Transmission, command is as follows:
root@BT:`# /ffp/start/transmission.sh status


6. Creating Folders for Transmission Download.

Login to DNS 320 via the web interface and create 2 folders.

Click on New to create new folder: Download


And create 2 sub-folders.

This means that the downloads from Transmission will be directed to the WIP. When it is completed, it will be moved the Download folder.


After which we chmod the directory:
root@NAS:~# chmod -R 777 /mnt/HD/HD_a2/Download
root@NAS:~#


7. Editing the settings.json file. 

A lot of the references that I reading up mentioned about using WINSCP application. But none of the resources mentioned about logging in. Until I eventually figure it out myself.

So I will tell you the 2 ways that I did. You can choose either one.

i. download the json file from the DNS 320 web interface and renamed it as settingsorig.json, for example.

The settings.json file is located within the transmission folder.
Highlight it and click on the Download button. Take note of the
Upload button next to it, which you would need to use it later.


Open it on a Notepad and make the following changes. It is underlined as follows.



Saved it back as settings.json and upload back into the transmission.daemon folder by using the Upload button mentioned earlier on.


ii. The other way is using the WINSCP.

Host name: IP address of the DNS 320. User name: root and
 password is what we have selected earlier on.


Navigate to the transmission.daemon folder and click on the
settings.json folder and make the same changes mentioned
earlier on. Save it.


8. Running Transmission 

Reboot the DSN 320. Open any browser and point it to:
http://<NAS IP ADDRESS>:9091


You will get something like this.

Transmission screen.


Click on the folder icon on the above screen and the following would appear.

Put in the torrent URL and check the location of the download
folder. Click on upload and it will start the transfer.

If there is no error message, congratulations!! Your transmission installation is a success!!

However, I had an error message on Transmission when I try to do a download:
Error: Permission denied (/mnt/HD/HD_a2/Downloads/

I read on so many websites about this error and ways to overcome it. But none of it work for me. Until I came across a tip from a forumer to do the following:

Open up WinSCP and go to settings.json file.
Locate the following and make the following change:

"incomplete-dir-enabled" to false.

Save it.

Launch Transmission and try to download again.

The error message was gone. This means that the download goes straight to the Download folder.


Before using Transmission, I was using a torrent client and it downloads to a folder in my NAS called Peer2Peer. Creating another folder called Download will make things troublesome when I want to locate files.

I decided to disregard the Download folder and point the Transmission download to my existing Peer2Peer folder.

Logging into the WinSCP, open the settings.json file and make the changes.

I changed the download location to my existing folder. And made
sure that the 'incomplete-dir-enabled': false.
Save it.

With that Transmission worked, pointing to the proper folder.

As mentioned earlier on, I have no Linux command experience. I had to rely on a lot of resources. Some of the resources can be confusing and contradictory. That is why I wrote this blog piece. I hope it would be informative for you and an additional resource as well.

Thanks again for dropping by.

No comments:

Post a Comment