• March 18, 2024, 07:16:27 PM
  • Welcome, Guest
Please login or register.

Login with username, password and session length
Advanced search  

News:

This Forum Beta is ONLY for registered owners of D-Link products in the USA for which we have created boards at this time.

Pages: [1] 2

Author Topic: Tutorial: fun_plug 0.7 running off usb stick  (Read 34002 times)

Schnaaa

  • Level 1 Member
  • *
  • Posts: 2
Tutorial: fun_plug 0.7 running off usb stick
« on: February 15, 2013, 12:32:01 AM »

Since i spend a few hours to figure this one out because i couldn't find a guide specifically for the DNS-320L i decided to write up this little tutorial on how to get fun_plug running off an usb stick.

I hope it is ok to post this here since it is not really officially supported by D-Link and you will probably void your warranty by installing fun_plug. I decided to go with the DNS-320L because i found out about fun plug. Otherwise i probably would have bought something different and more expensive. So if you ask me fun_plug is really a great addition like the open source firmwares are to many compatible routers.

When i was looking for help to make it work this forum came up quite often in my search so maybe it will help some folks in the future and save them some time.
Before you start i must point out that i will probably not be able to help you out with any problems you may encounter during the process. I just registered here to post this guide. If you haven't done anything with unix or terminal in your life before you might want to ask someone to help you but then again you would probably not bother installing fun_plug anyway.

I would also recommend to install nano or midnight commander via slacker to make editing files easier. I always struggled with vi.


I tested this guide with a friend and it worked for him, so i hope it also does for you.

Anyway enough blahblah - let's go:

First of all you have to follow the standard fun_plug to hdd installation guide which can be found here: http://nas-tweaks.net/371/hdd-installation-of-the-fun_plug-0-7-on-nas-devices/

On the DNS-320L the ssh server is a bit tricky
you will have to add these lines in /ffp/start/sshd.sh just before the line “proc_start $command”:

chmod 700 /ffp/var/lib/sshd/
chmod 700 /ffp/etc/ssh/ssh_*

(this is probably not the best sshd practice but it works)

Make sure you have everything working properly before proceeding because you will just clone your installation to the usb stick.
The good thing ist that you will still have a working fun_plug installation on your harddrive in case your usb drive fails or your sneaky cat steals it.


I mostly copied and pasted a guide i found on the internet and made changes to make it work on the DNS-320L.
So the main credit goes to this great step by step tutorial: http://bernaerts.dyndns.org/dns325/242-dns325-ffp7-move-usb-key with the awesome bootstrapping script!


The main differences are:
- location of the usb device is different on the DNS-320L
- used file system (ext3)
- result: different location and filesystem in the bootstrapping script

IMPORTANT: Depending on your harddrive configuration the location of your usb stick and harddisk can be different.
I currently only have one harddrive installed.

commands to be entered in the terminal start with a "#" the other lines are output from the terminal for better orientation.

to start log in via ssh into your nas

1.1 Get Texteditor
# slacker -U
wait
# slacker -i
choose a nano package or mc package and install it - hit space to mark it and enter to install it


1.2. FORMAT THE USB KEY
# df
Filesystem 1K-blocks Used Available Use% Mounted on
%root% 9911 4490 4909 48% /
/dev/ram0 9911 4490 4909 48% /
...
/dev/sdb1 982096 926308 55788 95% /mnt/USB/USB1_b1 <- this is the line we are looking for.

so now we know that /dev/sdb is were the usb device is which gets automounted to /mnt/USB/USB1_b1

# umount /dev/sdb
# fdisk /dev/sdb

show commands: m
show partitions: p
delete partitions: d
make new partition: n
3x Enter
partion ID: t
partion ID: 83 for Linux
write table: w
.
.
# mke2fs –j /dev/sdb1 (creates ext 3 partition)
# reboot

check if usb gets automounted:
# df
/dev/sdb1 982096 926308 55788 95% /mnt/USB/USB1_b1


copy ffp directory:
# cp -a /mnt/HD/HD_a2/ffp /mnt/USB/USB1_b1

2.2. BOOTSTRAP /MNT/HD/HD_A2/.BOOTSTRAP/SETUP.SH
# mkdir /mnt/HD/HD_a2/.bootstrap
# chmod 777 /mnt/HD/HD_a2/.bootstrap
# nano -e /mnt/HD/HD_a2/.bootstrap/setup.sh
# chmod +x /mnt/HD/HD_a2/.bootstrap/setup.sh
# nano /mnt/HD/HD_a2/.bootstrap/setup.sh





the stuff below has to be copied inside -> /mnt/HD/HD_a2/.bootstrap/setup.sh:



Code: [Select]
#!/bin/sh
#
# Script .bootstrap/setup.sh
#
# Called by fun_plug to prepare USB key execution environment
# If everything is ok, fun_plug will run from the USB key
#
# 08/09/2012 - V1.0 by Nicolas Bernaerts

# Set default path
PATH=/usr/sbin:/sbin:/usr/bin:/bin
CONTINUE=1

# Environment variables. You may adjust them
FFP_HD="/mnt/HD/HD_a2"
FFP_USB="/mnt/USB/USB1_b1"
BCK_FLAG=${FFP_USB}/ffp/home/root/backup.do

# Check if a USB removable disk has been detected. If not, exit
if [ "$CONTINUE" -eq 1 ]; then
  # get the USB key partition
  USB_PARTITION=`df | grep "${FFP_USB}" | sed 's/^\([a-z0-9\/]*\).*$/\1/g'`

  # if partition has been mounted, remount it with noatime, else exit
  if [ -z "${USB_PARTITION}" ]; then
    CONTINUE=0
    echo "ERROR - USB device has not been detected as Mass Storage"
  else
    umount ${USB_PARTITION}
    mount ${USB_PARTITION} -t ext3 ${FFP_USB} -o noatime 2>/dev/null
    echo "USB - USB disk mounted under ${FFP_USB}"
  fi
fi

# Check presence of ffp directory at the USB key root. If not present, exit
if [ "$CONTINUE" -eq 1 ]; then
  if [ ! -d "${FFP_USB}/ffp" ] ; then
    CONTINUE=0
    echo "ERROR - Directory ${FFP_PATH} doesn't exist"
  else
    echo "USB - Directory ${FFP_PATH} present"
  fi
fi

# Check if a backup of USB key ffp directory is needed
if [ "$CONTINUE" -eq 1 ]; then
  if [ -f ${BCK_FLAG} ] ; then
    echo "USB - Backup of ${FFP_USB}/ffp needed. Target is ${FFP_HD}/ffp"
    rm -r ${FFP_HD}/ffp
    cp -a ${FFP_USB}/ffp ${FFP_HD}/ffp
    rm ${BCK_FLAG}
    echo "USB - Backup of ${FFP_USB}/ffp done. Backup flag deleted"
  fi
fi

# Declare USB key ffp directory as ffp root
if [ "$CONTINUE" -eq 1 ]; then
  FFP_PATH=${FFP_USB}/ffp
  echo "USB - Fun_Plug is running from USB key under ${FFP_PATH}, accessible thru /ffp"
else
  echo "ERROR - Fun_Plug root can't be moved to USB Key"
fi



ctrl + x and save the file

# reboot


# ls -la /ffp
lrwxrwxrwx 1 root root 16 Sep 6 22:36 /ffp -> /mnt/USB/USB1_b1/ffp (fun_plug is running off the usb key)
Every package you install will also be installed on the usb stick


If you want to keep your fun_plug on usb and the one on the harddrive synced create the file backup.do in root folder

# touch /ffp/home/root/backup.do
# reboot


booting will take a bit longer because the usb installation is copied back to your harddrive

Done!
« Last Edit: February 15, 2013, 01:21:39 AM by Schnaaa »
Logged

fourfourfun

  • Level 1 Member
  • *
  • Posts: 4
Re: Tutorial: fun_plug 0.7 running off usb stick
« Reply #1 on: February 15, 2013, 03:32:43 AM »

Curious, what exactly does fun_plug offer me as a user?
Logged

marse

  • Level 1 Member
  • *
  • Posts: 3
Re: Tutorial: fun_plug 0.7 running off usb stick
« Reply #2 on: February 15, 2013, 03:36:55 AM »

Curious, what exactly does fun_plug offer me as a user?

From google.

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

tharos

  • Level 1 Member
  • *
  • Posts: 7
Re: Tutorial: fun_plug 0.7 running off usb stick
« Reply #3 on: August 16, 2013, 05:40:01 AM »

Hello, i have a DNS320L and i have been using fun_plug for 6 months. I very happy with it. It works great, but it would be even greater if i could run fun_plug from an USB. I have followed all the steps above, but ssh doesn't work. i can access using telnet, but i am not able to access using ssh. I can't solve the permission problem. The same configuration works well from HD, but not in USB.

thanks.
Logged

dansdec

  • Level 1 Member
  • *
  • Posts: 1
Re: Tutorial: fun_plug 0.7 running off usb stick
« Reply #4 on: January 03, 2014, 07:05:36 AM »

Hello, i have a DNS320L and i have been using fun_plug for 6 months. I very happy with it. It works great, but it would be even greater if i could run fun_plug from an USB. I have followed all the steps above, but ssh doesn't work. i can access using telnet, but i am not able to access using ssh. I can't solve the permission problem. The same configuration works well from HD, but not in USB.

thanks.

Same problem for me
Logged

pizzaking

  • Level 2 Member
  • **
  • Posts: 34
Re: Tutorial: fun_plug 0.7 running off usb stick
« Reply #5 on: January 03, 2014, 08:47:52 AM »

The problem is, that the NAS makes all mounts world writable (chmod 777) by default. Therefor you need to suppress this command on startup, because the ssh sever won't accept world writeable private keys.

Fortunately there is a simple solution to the problem. Log in using telnet. Type:

Code: [Select]
chmod -R 700 /ffp/etc/ssh
Now you should be able to log ind using SSH, but if you do nothing, the directory will be world writeable again after next boot. To disable this "feature" install the uwchmod from Uli's repository by typing:

Code: [Select]
slacker -UaA uli:uwchmod
That should do the trick
Logged

pierre.huybens

  • Level 1 Member
  • *
  • Posts: 16
Re: Tutorial: fun_plug 0.7 running off usb stick
« Reply #6 on: January 04, 2014, 06:12:44 AM »

Hi ,

I have follow all the steps but after reboot ffp is still on hard disk.
How can I know that the script  .bootstrap/setup.sh  is executed. Where is the output of the echo command ?
What could be my error ?


root@NasMapi:/mnt/USB/USB1_b1# df -k

Filesystem                1K-blocks      Used  Available Use% Mounted on
%root%                         8919      5436       3023  65% /
/dev/ram0                      8919      5436       3023  65% /
mdev                         124208         0     124208   0% /dev
/usr/local/tmp/image.cfs      42752     42752          0 100% /usr/local/modules
/dev/mtdblock5                 5120       480       4640  10% /usr/local/config
none                           2048       408       1640  20% /mydlink
/dev/sda4                    982936     34108     948828   4% /mnt/HD_a4
/dev/sda2                2881702700 614379668 2267323032  22% /mnt/HD/HD_a2
/dev/sdb1                   3847808    264488    3387856   8% /mnt/USB/USB1_b1


root@mynas:/mnt/USB/USB1_b1# ls -la /ffp
lrwxrwxrwx 1 root root 17 Feb 24  2013 /ffp -> /mnt/HD/HD_a2/ffp


root@mynas:/mnt/USB/USB1_b1# ls /mnt/USB/USB1_b1

ffp  lost+found


Thanks a lot

Logged

pizzaking

  • Level 2 Member
  • **
  • Posts: 34
Re: Tutorial: fun_plug 0.7 running off usb stick
« Reply #7 on: January 04, 2014, 01:11:05 PM »

Fun_plug i supposed to be on both the hard disk and the USB drive.

The fun_plug script, which is placed in the root of your hard disk, calls the script from /mnt/HD/HD_a2/.bootstrap/setup.sh (line 24).

Every echo output from this script should therefor be placed in the ffp.log in the root of your hard drive.

Which tutorial did you follow in your first attempt to install fun_plug? The part where the fun_plug script is being called my not be included in your version. For reference you can see mine here: http://pastebin.com/dfcaiNFf

Could you maybe upload your ffp.log, so we can see what is going on? Are you sure the .bootstrap/setup.sh script is executable (chmod +x setup.sh)?
« Last Edit: January 04, 2014, 01:26:36 PM by pizzaking »
Logged

pierre.huybens

  • Level 1 Member
  • *
  • Posts: 16
Re: Tutorial: fun_plug 0.7 running off usb stick
« Reply #8 on: January 06, 2014, 11:24:31 PM »

I found the following information in the log file :
Sat Jan  4 14:52:59 CET 2014

* Running /mnt/HD/HD_a2/.bootstrap/setup.sh ...
ERROR - USB device has not been detected as Mass Storage
ERROR - Fun_Plug root can't be moved to USB Key

The usb was properly inserted, and I run the script manually without error ; so I reboot the NAS and the ffp  was on the USB. Nice

Thanks
Logged

JavaLawyer

  • BETA Tester
  • Level 15 Member
  • *
  • Posts: 12190
  • D-Link Global Forum Moderator
    • FoundFootageCritic
Re: Tutorial: fun_plug 0.7 running off usb stick
« Reply #9 on: January 08, 2014, 08:24:09 AM »

Call for support...  :)

I would like to create a Fun_Plug sticky post on our FAQ describing (1) purpose/functionality of Fun_Plug; (2) supported ShareCenter models; (3) Links to the official dev/support sites. Although D-Link does not officially support Fun_Plug, we can at least point ShareCenter to the correct third-party location for more information.

Are there any forum members who would like to take a stab at drafting the text for the FAQ entry?  ???
Logged
Find answers here: D-Link ShareCenter FAQ I D-Link Network Camera FAQ
There's no such thing as too many backups FFC

JavaLawyer

  • BETA Tester
  • Level 15 Member
  • *
  • Posts: 12190
  • D-Link Global Forum Moderator
    • FoundFootageCritic
Re: Tutorial: fun_plug 0.7 running off usb stick
« Reply #10 on: April 04, 2014, 07:01:37 AM »

Logged
Find answers here: D-Link ShareCenter FAQ I D-Link Network Camera FAQ
There's no such thing as too many backups FFC

Morphic

  • Level 1 Member
  • *
  • Posts: 5
Re: Tutorial: fun_plug 0.7 running off usb stick
« Reply #11 on: September 05, 2014, 05:36:58 AM »

The problem is, that the NAS makes all mounts world writable (chmod 777) by default. Therefor you need to suppress this command on startup, because the ssh sever won't accept world writeable private keys.

Fortunately there is a simple solution to the problem. Log in using telnet. Type:

Code: [Select]
chmod -R 700 /ffp/etc/ssh
Now you should be able to log ind using SSH, but if you do nothing, the directory will be world writeable again after next boot. To disable this "feature" install the uwchmod from Uli's repository by typing:

Code: [Select]
slacker -UaA uli:uwchmod

That should do the trick

I can't get SSH to work after doing this and if I run via telnet:
Code: [Select]
slacker -UaA uli:uwchmod
I get
Code: [Select]
Updating package lists...
fetch: rsync -q 'rsync://ffp.inreto.de/ffp/0.7/arm/packages/CHECKSUMS.md5' '/ffp/funpkg/cache/s'
No packages found (status Iiu, pattern (^uli:.*uwchmod))

Logged

Morphic

  • Level 1 Member
  • *
  • Posts: 5
Re: Tutorial: fun_plug 0.7 running off usb stick
« Reply #12 on: September 05, 2014, 10:12:08 AM »

Ok so I figured out I had to install uli into slacker:

Code: [Select]
wget http://wolf-u.li/u/441 -O /ffp/bin/uwsiteloader.sh
chmod a+x /ffp/bin/uwsiteloader.sh
uwsiteloader.sh
Then select uli from the sites listed.

I can get ffp running off usb but debian is running but struggling with the chmod so cant access via SSH still.
Logged

Grosvenor

  • Level 1 Member
  • *
  • Posts: 4
Re: Tutorial: fun_plug 0.7 running off usb stick
« Reply #13 on: September 13, 2014, 04:56:08 AM »

I can get ffp running off usb but debian is running but struggling with the chmod so cant access via SSH still.

If you enable remote backup server, you can SSH to the box without need for fun plug.
Logged

k1kfr3sh

  • Level 1 Member
  • *
  • Posts: 1
Re: Tutorial: fun_plug 0.7 running off usb stick
« Reply #14 on: February 08, 2015, 06:18:47 PM »

It seems that the uwchmod hack does not work for the DNS-320l. At least with firmware 1.04b012
the script /usr/local/config/rc.init.sh is not executed at startup. Therefore the hook into this script and the exchange
of chmod with uwchmod is not executed.

The solution of chmod'ing sshd and its keys is not satisfying from my point of view e.g. all the scripts in /ffp/start/ are
executed because all are executed.

I therefore propose the following solution:
Changing .bootstrap/setup.sh to copy ffp to the USB drive. Although several 100M it is only done at startup.
Change your setup.sh to look like this:
Code: [Select]
#!/bin/sh
#
# Script .bootstrap/setup.sh
#
# Called by fun_plug to prepare USB key execution environment
# If everything is ok, fun_plug will run from the USB key
#
# 08/09/2012 - V1.0 by Nicolas Bernaerts

# Set default path
PATH=/usr/sbin:/sbin:/usr/bin:/bin
CONTINUE=1

# Environment variables. You may adjust them
FFP_HD="/mnt/HD/HD_a2"
FFP_USB="/mnt/USB/USB1_c1"


# Check if a USB removable disk has been detected. If not, exit
if [ "$CONTINUE" -eq 1 ]; then
  # get the USB key partition
  USB_PARTITION=`df | grep "${FFP_USB}" | sed 's/^\([a-z0-9\/]*\).*$/\1/g'`

  # if partition has been mounted, remount it with noatime, else exit
  if [ -z "${USB_PARTITION}" ]; then
    CONTINUE=0
    echo "ERROR - USB device has not been detected as Mass Storage"
  else
    echo "Unmounting usb partition: ${USB_PARTITION}"
    umount ${USB_PARTITION}
    mount ${USB_PARTITION} -t ext3 ${FFP_USB} -o noatime 2>/dev/null
    echo "USB - USB disk mounted under ${FFP_USB}"
  fi
fi

# Check presence of ffp directory at the USB key root. If not present, exit
if [ "$CONTINUE" -eq 1 ]; then
  if [ ! -d "${FFP_USB}/ffp" ] ; then
    CONTINUE=0
    echo "ERROR - Directory ${FFP_USB}/ffp doesn't exist"
  else
    echo "USB - Directory ${FFP_PATH} present"
  fi
fi

# Check presence of ffp directory at the HD root. If not present, exit
if [ "$CONTINUE" -eq 1 ]; then
  if [ ! -d "${FFP_HD}/ffp" ] ; then
    CONTINUE=0
    echo "ERROR - Directory ${FFP_PATH} doesn't exist"
  else
    echo "HD - Directory ${FFP_PATH} present"
    rm -rf ${FFP_USB}/ffp 2>/dev/null
    cp -a ${FFP_HD}/ffp ${FFP_USB}/
    echo "HD -> USB | Files copied to USB"
  fi
fi

# Declare USB key ffp directory as ffp root
if [ "$CONTINUE" -eq 1 ]; then
    FFP_PATH=${FFP_USB}/ffp
    # Move tmp to the usb stick, such that there is enough temp space
    rm -rf ${FFP_USB}/tmp
    mkdir ${FFP_USB}/tmp
    cp -a /tmp/* ${FFP_USB}/tmp
    rm -rf /tmp 2>/dev/null
    ln -s ${FFP_USB}/tmp /tmp
    echo "USB - Fun_Plug is running from USB key under ${FFP_PATH}, accessible thru /ffp"
else
    echo "ERROR - Fun_Plug root can't be moved to USB Key"
fi

 Further add the script to /ffp/bin/sync_ffp.sh and make it executable:
Code: [Select]
#!/bin/sh
#
# /ffp/bin/sync_ffp.sh
#
# Sync all changes from the usb drive back to the HD.
# All changes on the USB key will be removed after reboot.
#
# V 0.1 - Thomas Preindl


CONTINUE=1

# Environment variables. You may adjust them
FFP_HD="/mnt/HD/HD_a2"
FFP_USB="/mnt/USB/USB1_c1"

# Check presence of ffp directory at the USB key root. If not present, exit
if [ "$CONTINUE" -eq 1 ]; then
  if [ ! -d "${FFP_USB}/ffp" ] ; then
    CONTINUE=0
    echo "ERROR - Directory ${FFP_USB}/ffp doesn't exist"
  else
    echo "USB - Directory ${FFP_PATH} present"
  fi
fi

# Check presence of ffp directory at the HD root. If not present, exit
if [ "$CONTINUE" -eq 1 ]; then
  if [ ! -d "${FFP_HD}/ffp" ] ; then
    CONTINUE=0
    echo "ERROR - Directory ${FFP_PATH} doesn't exist"
  else
    echo "USB - Directory ${FFP_PATH} present"
    rsync --delete -av ${FFP_USB}/ffp/ ${FFP_HD}/ffp
    echo "USB -> HD | Files synced to HD"
  fi
fi

You will have to call this script whenever you change something on your setup. This is the only drawback of this approach.
Logged
Pages: [1] 2