Output of dmesg on the D-Link DNS-320

Here the output of dmesg on the D-Link DNS-320:

Linux version 2.6.22.18 (bill@SWTEST3) (gcc version 4.2.1) #22 Tue Aug 10 11:59:29 CST 2010
CPU: ARM926EJ-S [56251311] revision 1 (ARMv5TE), cr=00053977
Machine: Feroceon-KW
Using UBoot passing parameters structure
Memory policy: ECC disabled, Data cache writeback
On node 0 totalpages: 32768
  DMA zone: 256 pages used for memmap
  DMA zone: 0 pages reserved
  DMA zone: 32512 pages, LIFO batch:7
  Normal zone: 0 pages used for memmap
CPU0: D VIVT write-back cache
CPU0: I cache: 16384 bytes, associativity 4, 32 byte lines, 128 sets
CPU0: D cache: 16384 bytes, associativity 4, 32 byte lines, 128 sets
Built 1 zonelists.  Total pages: 32512
Kernel command line: root=/dev/ram console=ttyS0,115200 :::DB88FXX81:egiga0:none
PID hash table entries: 512 (order: 9, 2048 bytes)
Console: colour dummy device 80x30
Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
Memory: 128MB 0MB 0MB 0MB = 128MB total
Memory: 123776KB available (4028K code, 246K data, 124K init)
Calibrating delay loop... 796.26 BogoMIPS (lpj=3981312)
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
NET: Registered protocol family 16
 
CPU Interface
-------------
SDRAM_CS0 ....base 00000000, size 128MB
SDRAM_CS1 ....disable
SDRAM_CS2 ....disable
SDRAM_CS3 ....disable
PEX0_MEM ....base e8000000, size 128MB
PEX0_IO ....base f2000000, size   1MB
INTER_REGS ....base f1000000, size   1MB
NFLASH_CS ....base fa000000, size   2MB
SPI_CS ....base f4000000, size  16MB
BOOT_ROM_CS ....no such
DEV_BOOTCS ....no such
CRYPT_ENG ....base f0000000, size   2MB
 
  Marvell Development Board (LSP Version KW_LSP_4.3.4_patch30)-- DB-88F6281A-BP  Soc: 88F6281 A1 LE
 
 Detected Tclk 166666667 and SysClk 200000000
MV Buttons Device Load
Marvell USB EHCI Host controller #0: c0fb3600
PEX0 interface detected no Link.
PCI: bus0: Fast back to back transfers enabled
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
NET: Registered protocol family 2
Time: kw_clocksource clocksource has been installed.
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 4096 (order: 3, 32768 bytes)
TCP bind hash table entries: 4096 (order: 2, 16384 bytes)
TCP: Hash tables configured (established 4096 bind 4096)
TCP reno registered
checking if image is initramfs...it is not (no cpio magic); looks like an initrd
Freeing initrd memory: 1594K
cpufreq: Init kirkwood cpufreq driver
cpufreq: High frequency: 800000KHz - Low frequency: 200000KHz
cpufreq: Setting CPU Frequency to 800000 KHz
cpufreq: Setting PowerSaveState to off
XOR registered 1 NET_DMA over 4 channels
XOR 2nd invalidate WA enabled
cesadev_init(c00119d8)
mvCesaInit: sessions=640, queue=64, pSram=f0000000
Warning: TS unit is powered off.
MV Buttons Driver Load
VFS: Disk quotas dquot_6.5.1
Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
squashfs: version 3.3 (2007/10/31) Phillip Lougher
squashfs: LZMA suppport for slax.org by jro
Installing knfsd (copyright (C) 1996 okir@monad.swb.de).
JFFS2 version 2.2. (NAND) é 2001-2006 Red Hat, Inc.
SGI XFS with large block numbers, no debug enabled
io scheduler noop registered
io scheduler anticipatory registered (default)
Serial: 8250/16550 driver $Revision: 1.7 $ 4 ports, IRQ sharing disabled
serial8250.0: ttyS0 at MMIO 0xf1012000 (irq = 33) is a 16550A
serial8250.0: ttyS1 at MMIO 0xf1012100 (irq = 34) is a 16550A
RAMDISK driver initialized: 16 RAM disks of 10240K size 1024 blocksize
loop: module loaded
Loading Marvell Ethernet Driver:
  o Cached descriptors in DRAM
  o DRAM SW cache-coherency
  o Single RX Queue support - ETH_DEF_RXQ=0
  o Single TX Queue support - ETH_DEF_TXQ=0
  o TCP segmentation offload enabled
  o LRO support supported
  o Receive checksum offload enabled
  o Transmit checksum offload enabled
  o Network Fast Processing (Routing) supported
  o Driver ERROR statistics enabled
  o Driver INFO statistics enabled
  o Proc tool API enabled
  o SKB Reuse supported
  o SKB Recycle supported
  o Rx descripors: q0=128
  o Tx descripors: q0=532
  o Loading network interface(s):
    o  register under egiga0 platform
    o egiga0, ifindex = 1, GbE port = 0
 
Warning: Giga 1 is Powered Off
 
mvFpRuleDb (c7d5d000): 1024 entries, 4096 bytes
Integrated Sata device found
scsi0 : Marvell SCSI to SATA adapter
scsi1 : Marvell SCSI to SATA adapter
scsi 0:0:0:0: Direct-Access     ATA      GB0500C4413           PQ: 0 ANSI: 5
scsi 1:0:0:0: Direct-Access     Seagate  ST3500630AS      3.AA PQ: 0 ANSI: 5
scsi 0:0:0:0: Attached scsi generic sg0 type 0
scsi 1:0:0:0: Attached scsi generic sg1 type 0
NFTL driver: nftlcore.c $Revision: 1.1.1.1 $, nftlmount.c $Revision: 1.1.1.1 $
NAND device: Manufacturer ID: 0xec, Chip ID: 0xf1 (Samsung NAND 128MiB 3,3V 8-bit)
Scanning device for bad blocks
Bad eraseblock 854 at 0x06ac0000
Using static partition definition
Creating 6 MTD partitions on "nand_mtd":
0x00000000-0x00100000 : "u-boot"
0x00100000-0x00600000 : "uImage"
0x00600000-0x00b00000 : "ramdisk"
0x00b00000-0x07100000 : "image"
0x07100000-0x07b00000 : "mini firmware"
0x07b00000-0x08000000 : "config"
ehci_marvell ehci_marvell.70059: Marvell Orion EHCI
ehci_marvell ehci_marvell.70059: new USB bus registered, assigned bus number 1
ehci_marvell ehci_marvell.70059: irq 19, io base 0xf1050100
ehci_marvell ehci_marvell.70059: USB 2.0 started, EHCI 1.00, driver 10 Dec 2004
usb usb1: configuration #1 chosen from 1 choice
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 1 port detected
ohci_hcd: 2006 August 04 USB 1.1 'Open' Host Controller (OHCI) Driver
USB Universal Host Controller Interface driver v3.0
mice: PS/2 mouse device common for all mice
i2c /dev entries driver
md: linear personality registered for level -1
md: raid0 personality registered for level 0
md: raid1 personality registered for level 1
device-mapper: ioctl: 4.11.0-ioctl (2006-10-12) initialised: dm-devel@redhat.com
dm_crypt using the OCF package.
cpufreq: Setting CPU Frequency to 800000 KHz
cpufreq: Setting PowerSaveState to off
usbcore: registered new interface driver usbhid
drivers/hid/usbhid/hid-core.c: v2.6:USB HID core driver
TCP cubic registered
NET: Registered protocol family 1
NET: Registered protocol family 17
md: Autodetecting RAID arrays.
md: autorun ...
md: ... autorun DONE.
RAMDISK: Compressed image found at block 0
EXT2-fs warning: mounting unchecked fs, running e2fsck is recommended
VFS: Mounted root (ext2 filesystem).
Freeing init memory: 124K
sd 0:0:0:0: [sda] 976773168 512-byte hardware sectors (500108 MB)
sd 0:0:0:0: [sda] Write Protect is off
sd 0:0:0:0: [sda] Mode Sense: 23 00 10 00
sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, supports DPO and FUA
sd 0:0:0:0: [sda] 976773168 512-byte hardware sectors (500108 MB)
sd 0:0:0:0: [sda] Write Protect is off
sd 0:0:0:0: [sda] Mode Sense: 23 00 10 00
sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, supports DPO and FUA
 sda: sda1 sda2 sda4
sd 0:0:0:0: [sda] Attached SCSI disk
sd 1:0:0:0: [sdb] 976773168 512-byte hardware sectors (500108 MB)
sd 1:0:0:0: [sdb] Write Protect is off
sd 1:0:0:0: [sdb] Mode Sense: 23 00 10 00
sd 1:0:0:0: [sdb] Write cache: enabled, read cache: enabled, supports DPO and FUA
sd 1:0:0:0: [sdb] 976773168 512-byte hardware sectors (500108 MB)
sd 1:0:0:0: [sdb] Write Protect is off
sd 1:0:0:0: [sdb] Mode Sense: 23 00 10 00
sd 1:0:0:0: [sdb] Write cache: enabled, read cache: enabled, supports DPO and FUA
 sdb: sdb1 sdb2 sdb4
sd 1:0:0:0: [sdb] Attached SCSI disk
usbcore: registered new interface driver usblp
drivers/usb/class/usblp.c: v0.13: USB Printer Device Class driver
egiga0: mac address changed
egiga0: link down
egiga0: started
egiga0: link up, full duplex, speed 1 Gbps
ext3: No journal on filesystem on sda4
EXT2-fs warning: mounting unchecked fs, running e2fsck is recommended
ext3: No journal on filesystem on sdb4
EXT2-fs warning: mounting unchecked fs, running e2fsck is recommended
Initializing USB Mass Storage driver...
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
ext3: No journal on filesystem on sda2
EXT2-fs warning: mounting unchecked fs, running e2fsck is recommended
ext3: No journal on filesystem on sdb2
EXT2-fs warning: mounting unchecked fs, running e2fsck is recommended
Unable to find swap-space signature
NTFS driver 2.1.28 [Flags: R/O MODULE].
usbcore: deregistering interface driver usb-storage

Output of /proc/meminfo on the D-Link DNS-320

Here the output of cat cat /proc/meminfo on the D-Link DNS-320:

MemTotal:       125632 kB
MemFree:          9324 kB
Buffers:         17040 kB
Cached:          76964 kB
SwapCached:          0 kB
Active:          50308 kB
Inactive:        49620 kB
SwapTotal:           0 kB
SwapFree:            0 kB
Dirty:              12 kB
Writeback:           0 kB
AnonPages:        5940 kB
Mapped:           6812 kB
Slab:            13964 kB
SReclaimable:     4364 kB
SUnreclaim:       9600 kB
PageTables:        420 kB
NFS_Unstable:        0 kB
Bounce:              0 kB
CommitLimit:     62816 kB
Committed_AS:    37288 kB
VmallocTotal:   516096 kB
VmallocUsed:       972 kB
VmallocChunk:   515120 kB

Output of /proc/cpuinfo on the D-Link DNS-320

Here the output of cat cat /proc/cpuinfo on the D-Link DNS-320:

Processor       : ARM926EJ-S rev 1 (v5l)
BogoMIPS        : 796.26
Features        : swp half thumb fastmult edsp
CPU implementer : 0x56
CPU architecture: 5TE
CPU variant     : 0x2
CPU part        : 0x131
CPU revision    : 1
Cache type      : write-back
Cache clean     : cp15 c7 ops
Cache lockdown  : format C
Cache format    : Harvard
I size          : 16384
I assoc         : 4
I line length   : 32
I sets          : 128
D size          : 16384
D assoc         : 4
D line length   : 32
D sets          : 128
 
Hardware        : Feroceon-KW
Revision        : 0000
Serial          : 0000000000000000

Firmwareupgrade Procedure for NAS-Devices with fun_plug

Configuration interface for upgrading firmware
This procedure allows you to upgrade (or downgrade) the version of the firmware running on the NAS. Although backups are always nice (if you have that option), the data stored on the NAS is not affected. Similarly, any servers (daemons) running under fun_plug are also unaffected (although they are temporarily turned off and later turned on again).

Note that this somewhat elaborate procedure is needed if you are running fun_plug. If you do not have fun_plug installed, or it is no running, you can should use the simpler instructions provided by Conceptronic with the firmware file.

Checking the firmware version

You can tell which firmware version you are running by using a web browser:

  • browse to the CH3SNAS using an IP address (default is http://192.168.0.20) or a network name (maybe http://CH3SNAS)
  • If this brings you to a web page you created yourself, you are likely running fun_plug and have the lighttpd HTTP server running on port 80 and need to use port 81 to reach the configuration screen (e.g. using http://192.168.0.20:81). If you don’t know what funplug is, you are not using it and you can ignore this comment.
  • login as admin
  • Then go to: ”Configuration” >> ”Tools” >> ”Firmware”

This should get you to the screen shown in the picture.

Downloading firmware versions

An overview of the current stable version, any more recent beta (or “Release Candidate”) versions, or older versions can be found here.
The page contains links to sites where the firmware can be downloaded. After downloading the required version you will need to unzip or unrar it.

Installation if you don’t use funplug

If you are not running fun_plug, you can simplify things by following the instructions in the PDF readme file supplied with the downloaded firmware rather than following the fancier instructions below which assume you may be running various special servers and running with special settings.
So, in the following, we assume that you are running fun_plug.

Temporarily reactivate Telnet

If you are running funplug, it is likely that you enabled ssh (Secure Shell) and disabled telnet for security reasons. After the reboot, all modifications to /etc/passwd and /etc/group are gone, which is why we need to temporarily reactivate telnet to ensure that we can login after the upgrade:

  • run ssh (e.g. using PuTTY)
  • activate the telnet daemon so you can easily login later:
    cd /ffp/start
    ls -al telnetd.sh
    chmod a+x telnetd.sh
    ls -al telnetd.sh

    This means that on the next reboot telnet should be enabled.

Notes on CH3SNAS Firmware 1.05 regarding the fan

If you are upgrading from a pre-1.0.5 firmware version to version 1.0.5 or later, you may decide to replace the special fan control script “fanctl” from Fonz (see the fan control tutorial) with the standard fan control feature built into the Conceptronic firmware.

Which option is better? The firmware version 1.0.5 has a very simple fan control algorithm. The fan only runs when the internal temperature is 43°C or higher. This is a bit high. Furthermore, the fan speed does not depend on the temperature: the fan is either on or off. Fonz’ solution instead increases the fan speed as the temperature rises. This avoids the fan repeatedly turning on and off when the fan needs to spin, but doesn’t need to run at full speed.

If you decide to try the firmware’s solution, you can deactivate Fonz’ control program using:

cd /ffp/start
sh fanctl.sh status
ls -al fanctl.sh
chmod a-x fanctl.sh
ls -al fanctl.sh

The 2nd line reports whether the fanctl utility is running. The chmod a-x causes the special fan script to be disabled on the next reboot.

Temporarily disable funplug

Rename the file fun_plug to fun_plug.bak to deactivate ffp on the next boot. You can easily do this using e.g. Windows Explorer or using the command shell:

cd /mnt/HD_a2
ls fun_plug*
mv fun_plug fun_plug.bak
ls fun_plug*

Saving settings

Write down any special configurations you have set up in the system.

The main place to look is in the ”Advanced” tab of the Configuration web page. Write down a reminder to set any particular settings such as ”’users”’ who have access, ”’groups”’ you may have created, ”’ftp access”’ you may have given to groups, etc. If you forget to reconfigure these, you will find out later when e.g. an ftp account doesn’t work. Unfortunately there is no simple way to save these settings and later reload them: you will, for example, have to reenter or define new passwords.

The other setting worth saving is any non-default IP address or network name of your CH3SNAS.

Installing new firmware

Update the firmware via the web interface (see picture above). During the update, you will get a progress bar. Then, after confirmation, the CH3SNAS will reboot.

Next reset the CH3SNAS firmware settings to the factory defaults (the new firmware may interpret settings stored in Flash memory differently that the previous version). This step is mandatory to ensure correct operation!

  • Open the configuration page
  • Goto: Tools >> System >> Restore To Factory Default Settings

This will cause another reboot during which the IP address, group/user information, user privileges will be lost. Your browser may not find the device again if you use a non-default name. Try the default “http://CH3SNAS/” or using Conceptronic’s “Easy Search Utility” to find your NAS in the network.

Basic configuration

At this point, the administrator password is empty, so you can log onto the Config web page as admin with an empty password. Then you need to run Setup >> Run Wizard to get the basic settings correct again. These include

  • the admin password
  • timezone and daylight savings time setting
  • IP address (if set to static)
  • the network workgroup
  • the network name of the CH3SNAS

This will lead to a restart after which you will also be able to see the CH3SNAS under its original name on the network and the stored data should be accessible.

Fun_plug

At this point you cannot access the CH3SNAS via either telnet or ssh because an out-of-the-box CH3SNAS does not enable either daemon:

  • rename fun_plug.bak back to fun_plug using SAMBA (e.g. using Windows Exporer)
  • reboot the CH3SNAS (e.g. using the Configuration page: Tools >> System >> Restart).
    Note that before the reboot, your Config page is on port 80. It may be on port 81 after the reboot. From this point on telnet should work again.
  • Login with telnet and set the root password again using this procedure. This ends with running store-passwd.sh to save the password information.
  • deactivate telnet again (first be sure ssh is running!) using an ssh session on PuTTY:
    cd /ffp/start
    ls -al telnetd.sh
    chmod a-x telnetd.sh
    ls -al telnetd.sh
    sh telnetd.sh stop

    The final line stops the telnet daemon, so from this point on you (only) have access via the much more secure ssh.

User settings

You can now redefine any required user- and group settings (e.g. for ftp users).

Note that after updating the firmware, the NAS will spend a few hours reindexing the hard disks (searching for movies and audio-files) for the itunes and UPnP-services. You can stop this activity by deactivating the respective services.

Store-Passwd.sh for the DNS-343 and Acer easystore NAS

Fonz Version of the store-passwd.sh-Script for the DNS-343 and the Acer easystore NAS can be downloaded like this:

wget http://wolf-u.li/u/121 -O /ffp/sbin/store-passwd.sh

The Content of this script is the following:

#!/ffp/bin/sh
 
PATH=/ffp/sbin:/ffp/bin:$PATH
 
echo "Mounting flash ..."
mount -t minix /dev/mtdblock0 /sys/mtd1
mount -t minix /dev/mtdblock1 /sys/mtd2
 
echo "Updating files ..."
for d in /sys/mtd1 /sys/mtd2 /mnt/HD_a4/.systemfile/AccountFile /mnt/HD_b4/.systemfile/AccountFile; do
    if [ -d "$d" ]; then
	for f in /etc/passwd /etc/group /etc/shadow /etc/samba/smbpasswd; do
	    b=$(basename $f)
	    if [ -e "$d/$b" ]; then
		echo "  $d/$b"
		cp -f $f $d
	    fi
	done
    fi
done
 
echo "Unmounting ..."
sync
umount /sys/mtd1
umount /sys/mtd2
 
echo "Done."

Inspired by this Thread, i (Uli) did a rewrite of the store-passwd.sh-script. You need to use BASH for this to execute. Better use the Script above if you are not sure!

#!/ffp/bin/sh
# This script was written by Ulrich Wolf <ffp [a] wolf-u [dot] li>
# Inspired by the original Scripts of fonz and OneArmedMan
 
# Defining the various locations for these files:
BACKUPLOCATION[0]="/sys/mtd1"
BACKUPLOCATION[1]="/sys/mtd2"
BACKUPLOCATION[2]="/mnt/HD_a4/.systemfile/AccountFile"
BACKUPLOCATION[3]="/mnt/HD_b4/.systemfile/AccountFile"
 
# Defining the backup-locations of the files
BACKUPFILE[0]="/etc/shadow"
BACKUPFILE[1]="/etc/group"
BACKUPFILE[2]="/etc/passwd"
BACKUPFILE[3]="/etc/samba/smbpasswd"
# Inactive Files
#BACKUPFILE[4]="/etc/ftp_tbl"
#BACKUPFILE[5]="/etc/ftpgroup"
 
# Mounting the internal DRAM
mount -t minix /dev/mtdblock0 /sys/mtd1
mount -t minix /dev/mtdblock1 /sys/mtd2
 
# Iterate through the files for backup of the files
for BUFILESEQ in $(seq 0 $((${#BACKUPFILE[@]} - 1)))
do
	# Iterate through the backup-locations of the files
	for BULOCSEQ in $(seq 0 $((${#BACKUPLOCATION[@]} - 1)))
	do
		if [ -e ${BACKUPLOCATION[$BULOCSEQ]}/${BACKUPFILE[$BUFILESEQ]##*/} ]; then
			# File exists, copy the original one
			echo -n "${BACKUPFILE[$BUFILESEQ]##*/} found in ${BACKUPLOCATION[$BULOCSEQ]}, copying"
			cp -f ${BACKUPFILE[$BUFILESEQ]} ${BACKUPLOCATION[$BULOCSEQ]}/. 2> /dev/null && echo "done" || echo "failed"
		else
			# File does not exist, skip
			echo "${BACKUPFILE[$BUFILESEQ]##*/} not found in ${BACKUPLOCATION[$BULOCSEQ]}, skipping"
		fi
	done
done
 
 
echo -n "Flushing unwritten filesystem I/O buffers..."
sync && echo "done" || echo "failed"
 
# Unmount the internal DRAM
umount /sys/mtd1
umount /sys/mtd2
 
echo "Backup complete"
exit 0

Installation and Configuration of fanctl for Fonz fun_plug

This tutorial is deprecated and should only be used with fonz fun_plug 0.5!
Please check the tutorial page for updated tutorials on this topic!

The CH3SNAS, as well as other small nas devices, has a small fan at the back. This fan is necessary because the NAS can generate significant amounts of heat when one or two drives are used heavily.

CH3SNAS fan
Although the fan is speed-controlled through software provided by Conceptronic, the fan never switches off completely. Some people find this too noisy for quiet environments like bedrooms or even some offices. An obvious solution is to turn the CH3SNAS off entirely when it is not in use (e.g. at night), but this is very inconvenient and it gives problems when the CH3SNAS may be accessed occasionally by remote (Internet) users.

Thanks to the fun_plug, the user can change the fan control algorithm to reduce noise, save a bit of power and reduce wear on the fan itself.

Contents

  1. Replacing the default fan control software
    1. The standard fan control solution
    2. Using shell scripts versus using binaries
  2. Installation
    1. Installing fanctl
    2. Activating fanctl
  3. How fanctl works
    1. Warning!
    2. The graph
    3. Temperatures
    4. Fan speed
    5. Changing fanctl.conf
  4. Notes
    1. A CH3SNAS in a hot room
    2. Shut down on overheating
    3. Logging the temperature
    4. Deinstallation

Replacing the default fan control software

The standard fan control solution

By default, the fan is controlled by a program embedded within the CH3SNAS called fancontrol. This program adjusts the fan speed depending on the temperature measured inside the CH3SNAS.

Conceptronic also provides two other utilities which are helpful to control the fan:

  • temperature – shows the actual temperature (on some devices in Fahrenheit and on others in Celsius) by entering the command "temperature g 0"
  • fanspeed – returns the current fan speed when you enter "fanspeed g". It can also set a new fan speed by entering the command "fanspeed w YourFanSpeed" (where YourFanSpeed is the desired speed in Rotations Per Minute).

Using shell scripts versus using binaries

There are different ways to control the fan. In any case the new software needs to stop (“kill”) the built-in fancontrol program provided by Conceptronic before it takes over control.

One approach is to use the programs temperature and fanspeed within a simple bash script that repeatedly measures the temperature and adjusts the fan speed accordingly. Such a script can even choose to turn off the fan entirely below a certain temperature. But a script-based approach, which, compared to a compiled C program, uses more (valuable) memory and CPU cycles.

Fortunately Fonz, the author of fun_plug, has written a small and efficient binary program named fanctl. It controls the fan without relying on the temperature and fanspeed) programs and without using the bash shell. This efficiency is nice as the program is intended to run as long as the CH3SNAS is powered up. By default, fanctl adjusts the fan speed every 30 seconds if needed.

Installation

Installing fanctl

Uli has created a package to simplify installation of fanctl.

In this tutorial we assume that the fun_plug is already installed on the NAS and that you synchronized Uli’s repository (see here for instructions on how to do this). Afterwards install the package (see detailed instructions here):

funpkg -i /ffp/pkg/additional/ffp-misc/fanctl-*.tgz
cp /ffp/etc/examples/fanctl.conf /ffp/etc/fanctl.conf

The final steps copies default configuration settings to the appropriate directory.

Activating fanctl

Please make sure, that no other scripts than the original fancontroller are active! You can check this by:

ps aux|grep fan

This should show the following output (the process identification numbers will vary):

1431 root fancontrol
12620 root grep fan

These are all the running processes (ps) which were filtered (grep) on whether they include the text fan somewhere in their name. Despite appearances, [http://en.wikipedia.org/wiki/Ps_(Unix)#Options aux] is not a command or name, but 3 separate options for ps with a missing “-” this time.

Now test the first run of the fanctl script by entering the following command on the command line:

sh /ffp/start/fanctl.sh start

After entering the above command, the fan will run with a audible noise for a few seconds. You can check the correct opertion of fanctl now:

ps aux|grep fan

This should show the following output (again the PID numbers will vary):

12628 root     /ffp/sbin/fanctl /ffp/etc/fanctl.conf
12635 root     grep fan

This shows that the fancontrol process disappeared and was replaced by the fanctl process (with its configuration file).

As the last step, you can activate the daemon permanently:

chmod a+x /ffp/start/fanctl.sh

How fanctl works

To understand or to adjust the behaviour of fanctl, you may want to inspect its configuration file /ffp/etc/fanctl.conf. If you use the nanoeditor:

nano /ffp/etc/fanctl.conf

Under normal circumstances the defaults should be fine.

Warning!

Do not change these values unless you completely understand the consequences.
Overheated hard drives can lead to data loss or early drive failure. So if you want to change the settings in the configuration file, please study the following documentation carefully and test any modifications you make carefully.

The graph

The graph (by Uli) explains how the program adjusts the fan speed. It assumes the default settings (which you won’t change unless you need to and know what you are doing – right?). Room temperature is typically about 20 degrees Celcius (68 degrees Fahrenheit).

Fanctl adjusts the fan speed depending on the measured temperature

When you boot the CH3SNAS, but hardly use the drives the temperature should increase a few degrees, but stay well below 40 degrees. In that case, the fan follows the blue line: it stays off because there is no real need to cool the CN3SNAS yet. However, when you use the drives a lot, the temperature can rise above 40 degrees. Especially if the room temperature also happens to be hot. This causes the fan to switch on. The fan speed (in RPM) follows the curved slope (part of a parabolic curve). The maximum fan speed is limited by default to 6300 RPM (called pwm_hi). Like the original software, there is a actually a safety threshold as well: above 51 degrees, the CN3SNAS is turned off. The latter shouldn’t normally happen unless something goes very wrong (like a broken drive, or operating your CH3SNAS in the sauna).

Now assume that the CH3SNAS has become relatively hot (say 45 degrees Celcius), but the drives now enter a period of infrequent access. This causes the drive motors to automatically shut down, reducing heat production and causing the temperature to drop. Every 30 seconds, a drop in temperature will cause the fan to slow down. When the temperature drops below 40 degrees (called temp_hi) the fan speed stabilizes for a while. When the temperature then drops below 37 degrees (called temp_lo), the fan is turned off.

Note that turning the fan on and off occur at different temperatures. This is called (hysteresis). This reduces the chance that at some temperature the fan repeatedly runs for 30 seconds, then turns off for 30 seconds, and then turns on again.

Temperatures

If you want to change the temperatures (e.g. if the fan never switches off completely (NAS too warm) or you want to cool it down to a certain level), there are various values in the script for configuring these. All values have to be set in Celsius*1000! E.g. 40°C would be 40000

There are four different values:

  • temp_stop: If the temperature decreases below this value, the fan is set to the speed, which is configured as the variable pwm_stop (normally this will be zero and thus stops the fan). If the temperature rises about this temperature, nothing happens (hysteresis). Default is 37 degrees Celcius.
  • temp_lo: If the temperature rises above this temperature, pwm_start will be set for one second (Starts the fan). After this, the fan speed will be adjusted somewhere beween pwm_lo and pwm_hi – depending on the measured temperature. If the temperature drops below this temperature, the fan runs at pwm_lo (hysteresis). Default is 40 degrees Celcius.
  • temp_hi: If the temperature rises above this value, pwm_hi is set as fan speed. Default is 50 degrees Celcius.
  • temp_crit: If the temperature rises above this value, the CH3SNAS is shut down to prevent damage. Default is 51 degrees Celcius. Be extra careful with this value.

Fan speed

If you want to change the fan speed (e.g. if you think, the fan turns too slowly or if you want the fan to idle and not to stop), there are various values in the script for configuring these.

  • pwm_stop: This is the speed which is set below temp_stop. If set to zero, the fan will halt. It may not be a good idea to use really low non-zero values here (difficult to run the fan smoothly at these speeds).
  • pwm_start: This is the speed which is set for one second if pwm_stop was set and the temperature rises above temp_lo again. (Default: 3200 rpm)
  • pwm_lo: This is the speed which is set at temp_lo. (Default: 2700 rpm)
  • pwm_hi: This is the speed which is set at temp_hi. (Default: 6300 rpm)

Between pwm_lo and pwm_hi the fan speed will be interpolated according to the following formula:

RPM = (pwm_hi - pwm_lo) * (temp - temp_lo) / (temp_hi - temp_lo) * (temp - temp_lo) / (temp_hi - temp_lo) + pwm_lo

Changing fanctl.conf

Again, editing fanctl.conf should be done with care. Just editing the file will not cause the new values to be used immediately because the running program reads the file once when it starts. One safe way to reload a modified /ffp/etc/fanctl.conf file is to simply reboot the CH3SNAS. When the program is started, it will load the modified /ffp/etc/fanctl.conf file. Another way is to use

cd /ffp/start
sh fanctl.sh status
sh fanctl.sh restart
sh fanctl.sh status

The sh fanctl.sh retart stops and restarts the fan. Actually between the stop and the restart, fancontrol is briefly run.

Notes

A CH3SNAS in a hot room

According to the graph, if you put the CH3SNAS in a very hot environment (e.g. 38 degrees Celcius), the fan will turn on – even when the hard disks are not being used. Turning the fan on wouldn’t help lower the device temperature: it will only get the device temperature closer to room temperature. Currently the software cannot distinguigh this condition (but this obviously also applies to the default fancontrol software which never turns the fan off).

Shut down on overheating

In exceptional conditions, the CH3SNAS will shut down if it ever reaches temp_crit (typically 51′ Celcius). When it shuts down, it will create a file named OVERHEAT in the root directory. By checking for this file and its creation or modification time, you can get confirmation about the cause of the shutdown.

See the file /ffp/etc/fanctl.conf for more details how this works.

Logging the temperature

From an E-mail exchange with fonz (this hasn’t been tested):

PeterH> Other features might be more fun (e.g. log of temperature?).

That’s pretty easy. Just change /ffp/start/fanctl.sh and replace

/ffp/sbin/fanctl $fanctl_config >/dev/null 2>/dev/null </dev/null &

with

/ffp/sbin/fanctl $fanctl_config >/mnt/HD_a2/fan.log 2>&1 </dev/null &

You can plot nice graphs from the log file using gnuplot:

gnuplot> set timefmt "%Y-%m-%d %H:%M:%S"
gnuplot> set xdata time
gnuplot> plot '< grep fan /path/to/fan.log' u 1:4 w st, '' u 1:8 w st

Deinstallation

If you deinstall fanctl using

funpkg -r /ffp/pkg/additional/fanctl-2-1.tgz

and reboot your CH3SNAS, you will find using

ps aux|grep fan

that the original fancontrol appication automatically reappears. This is because fanctl is activated via a script (/ffp/start/fanctl.sh) that stops the default fancontrol process before starting the fanctl program.

This implies that deinstalling funplug and rebooting will also return fan behaviour back to the default behavior and default mechanisms provided by Conceptronic.

Removing the Fonz fun_plug

If you only want to temporarily deactivate fun_plug, simply rename the file fun_plug in the topmost directory of your CH3SNAS, reboot, and you are done.

But there could be cases where you want to completely remove fun_plug. Because the folder containing the fun_plug packages is owned by user root, this folder can only be deleted by root. This can be done by a single rm (remove) command in a PuTTY (ssh) terminal session if you are log in as root. You may want to see this article on root user for information about the special role of the root user.

But let’s assume pessimistically that that doesn’t work because the ssh server is not running or because you have problems logging in as root. Fortunately, the fun_plug script is no owned by root can still be modified by non-root users. This enables a trick to remove the folders without using root privileges: simply add commands for the removal of the fun_plug folder and the fun_plug script to the script itself. These commands will be executed under root privileges during the next reboot.

Note that the folder may be named either ffp or fun_plug.d – depending on the version of fun_plug that you have installed.

Script

You have to download the Script for the Removal here

Installation and execution

Rename the downloaded script to fun_plug and copy it to the NAS in the topmost directory of Volume_1. This will probably overwrite a existing script file fun_plug.

Reboot the CH3SNAS by holding down the power button 5 seconds or via the web interface (Tools -> System -> Reboot). During the reboot, fun_plug will be completely removed.

Installation of the Fonz fun_plug 0.5 for CH3SNAS, CH3MNAS, DNS-323 and many more

This tutorial is outdated and no longer maintained! Please check for the current tutorial here

The Conceptronic CH3SNAS runs an embedded version of the Linux operating system (OS). This includes a kernel and various Linux programs (mainly servers). Because the CH3SNAS (and many others) runs on an ARM processor, the executable version of Linux and the programs are binaries generated for the ARM processor.

The Firmwares includes a very interesting bonus: the user can execute a script (file) named “fun_plug” when the OS is booted. Unlike all the other Linux software which is loaded when the NAS boots, this file is located on Volume_1 of the hard disk rather than within the flash memory. This means the user can easily and safely modify the file because the contents of the flash memory is not changed. If you delete the fun_plug file (see here for instructions), or replace your hard disk, the modification is gone.

Fun_plug allows the user to start additional programs and tools on the NAS. A Berlin-based developer named “Fonz” created a package called “ffp” (Fonz fun_plug), which includes the script and some extra software which can be invoked by fun_plug.

Installation of fun_plug is easy and takes about 6 steps (with two optional more if you want to do some sightseeing rather than just racing over the Autobahn). These steps should be performed carefully, as they depend on typed commands and running with “root” privileges.

Contents

Purpose, risks, and benefits

Fun_plug is essentially a technique to stepwise turn a NAS with fixed out-of-the-box functionality into an open Linux machine on which you can install additional software packages and, if you want, learn a bit about Linux.

Responsibility

This also implies that you are (temporarily or permanently) turning a stable turnkey system into a system that Conceptronic no longer supports. This is similar to buying a notebook with Microsoft software, and installing Linux on it. The shop where you bought it can no longer help you if you claim the audio no longer works. Although there is a Tutorial on how to disable and even remove fun_plug, and although the authors have tested their recipes, checked the wording and added warnings, these are advanced tools which can, if you experiment more than your own know-how can handle, give advanced problems.

Risks involved in all this are not so much damaging your hardware (shouldn’t be possible), but loss of reliability of the NAS (you bought a file server to reliably store files, didn’t you). This risk may be acceptable because the software was preintegrated and tested by competent people. But you yourself are, at the end of the day, responsible for deciding to use this.

Possibly a less obvious, but more real risk is that some kind of extensions to the NAS (e.g. adding a server) imply that you may decide to open your local network a bit to the outside world. For example, to allow others to view your holiday videos stored on the device. The out-of-the-box NAS can already have this problem (via the ftp server). The point here is that you are responsible for the security of your device and entire network. This site doesn’t even have tutorials on basic security issues like firewalls, etc. because these are all NAS independent and the tutorials would never be foolproof anyway. So when used wrongly, the NAS and firewall obviously do allow others to read more data than you intended. Or to delete your valuable data. Or to replace software by other software (chance is small, but the impact is high).

Conclusion: as the NAS is a powerful networked device, and as these tutorials can help you make it even more powerful, you are responsibility for having the basic understanding of networked security. Again, this also applies to an out-of-the-box NAS. But the more you mess with it, the more you need to apply some common sense. This is incidentally the reason why we provide some explanation on what you are doing in the tutorials, rather than just telling you what to type 😉

Benefits

The main reason why people go this route is to extend their NAS with servers such as BitTorrent clients and Web servers. Other typical uses are to add extensions which fix current limitations of the device (e.g. time accuracy, fan noise).

Technical synopsis

In a first step, we install a script named fun_plug that provides a hook to extend the boot process of Linux on the NAS. That hook was intentionally added by the vendor to enable this. But Conceptronic does not document or support all of this.

An initial set of packages (downloaded as a single compressed archive) gives you enough tools to get started and, if you are curious about the machine or its software, to carefully look around.

This set of tools gives you the ability to install even more software packages (typically servers) from trusted sources. These packages should obviously all have been compiled for the ARM-type processor in the CHS3SNAS and should have been tested on the device (or a very similar device) by a software expert.

Tested Devices

This Tutorial has been tested on various devices. Other devices may work, please leave a comment in case you have tested an additional device.

Steps for installing fun_plug

Download

Download the latest files from fonz’ fun_plug repository:

  • fun_plug (this is a text file, you probably have to right-click to save it to disk)
    Note: If you want to install fun_plug on the D-Link DNS-320/DNS-325/DNS-345, download this file: fun_plug
  • fun_plug.tgz (this is a 10 MByte “tarball” file, roughly the Linux counterpart of a Zip file)

Place a copy of both files in the topmost directory of Volume_1 of your NAS using Windows Explorer (see Screenshot of what shared network drives looks like in Explorer, or alternatively use Samba or FTP).

Option: view the fun_plug script

For fun, you may want to open the file fun_plug by left-clicking here. Alternatively you can open it in Windows’ Wordpad or, better, Notepad++ under Windows. Please be careful not to accidentally modify it. Avoid using Windows’ Notepad for viewing/editing Linux text files: Windows and Linux use different end-of-line conventions.

The script fun_plug is an ASCII file with commands which are executed by the Linux command interpreter (sh for “shell”).

Lines starting with “#” are comments (“#!/bin/sh” is a special case).

You might be able to decode that the program creates a log file called ffp.log (an ASCII file used here to capture the lines which start with “echo”).

Firstly, a number of named constants are defined for various file names and fragments of file names (the lines like “FFP_SOMETHING=...“).

You can see that Fonz developed it for a D-Link DNS-323 (rather than a Conceptronic CH3SNAS, but this doesn’t matter as Uli, PeterH and others have tested in on the CH3SNAS).

The command date will copy the current date and time to the log file.

Next, a first script setup.sh is run if it is found in the expected /mnt/HD_a2/.bootstrap/ folder. Initially it will not be found.

Then a new directory “ffp” is created (mkdir) and the fun_plug.tgz file is unpacked (tar) into that directory. This step is a bit more complex than normal due to a problem with the tar version supplied with the NAS. As a workaround tar is run twice (first the older version, and then the tar version which was untarred from fun_plug.tgz).

If all went well, the log file gets an extra “OK” string. And the tarball input file is deleted (rm). This obviously only happens once (the script skips the unpacking if the tarball file is not found using the if [condition]; commands fi construct).

The “chown” is about changing ownership for a program called busybox. And “chmod” is about changing access privileges.

Then, a script file /ffp/etc/fun_plug.init (“containing the ffp-scripts package”) is executed if it is detected.

Next, a script file /ffp/etc/fun_plug.local is executed if it is detected. It can be used to add your own startup commands: it will not be overwritten by package updates.

Finally, a script file /ffp/etc/rc is run if it exists.

Reboot

Reboot the NAS by holding down the power button 5 seconds or via the web interface (”Tools” -> ”System” -> ”Reboot”). This causes the NAS to go and find the file fun_plug on Volume_1 and execute it.

Option: view ffp.log

If you are interested, you will find that the fun_plug.tgz tarball has disapeared, and has been unpacked into the newly created ffp directory.

You will also find the ffp.log file created during execution of the fun_plug script and while executing some of its commands. It is longish (e.g. 47 KBytes) because the tar program generates a lot of warnings about repairing links (this only happens once). You can view the log file with WordPad or NotePad++.

From now on, whenever the NAS is rebooted and thus the fun_plug script is re-executed, the script appends about 15 extra text lines to the end of this log file. These contain the date/time of reboot and the status of various servers which you may enable in the future (see below). This appending of information to ffp.log gives you one way to determine whether fun_plug is really running: if you last reboot of the NAS is listed, fun_plug and any servers that it actives are running.

Note that the end of the initial log file already states that a server called telnetd is already running. We will use Telnet in the next step.

Connect via telnet

Telnet Session
After rebooting, you need to connect to the NAS using a protocol called Telnet. Telnet allows you to “login” on a remote machine via a command line window.

Windows users can use an open-source telnet client called PuTTY. PuTTY is a self-contained program: the PuTTY.exe file can be stored wherever convenient and executed without any prior installation. In the PuTTY configuration screen you need to set the following before pressing Open:

  • Host name (or IP address): use the name of the share (e.g. CH3SNAS) or its IP address (the factory default is 192.168.0.20)
  • Select Connection type “Telnet” (which defaults to port 23)

Now you can press Open (PuTTY can save these settings under a default or name if you want, but you will likely be using ssh instead of telnet later on).

Linux users are “supposed to be” familiar with how to use telnet.

After connecting to the device, the first line telnet will show:

/ #

Now you are logged in. This command “prompt” is where you can type in commands. The prompt shows you are in the root directory. Note that Linux command lines are not very communicative. These Rambo-like social skills are generally attributed to Linux’ resource-deprived childhood.

Change root password

We proceed with updating /etc/shadow by using the program pwconv. It uses /etc/passwd to generate the necessary lines in the shadow-file.

pwconv

Now we need to change the password of user “root” to prevent unauthorized access.
Run the passwd command and enter a new password twice (note that Linux passwords are case-sensitive):

passwd

Next, activate the root-user which is disabled by default:

usermod -s /ffp/bin/sh root

And change the home-directory of root to a permanent one:

mkdir -p /ffp/home/root/
usermod -d /ffp/home/root/ root

Now check if everything went right using:

login

If this was successful, proceed to the next step, otherwise return to “passwd“.

Store the password in the NAS. This step is essential, otherwise your password will be cleared on the next reboot! Please check the following section before executing the command itself:

  • Note: For the D-Link DNS-343, you need a different store-passwd.sh script. See DNS-343 store-passwd.sh
  • Note: For the D-Link DNS-320/DNS-325/DNS-345, you need a different store-passwd.sh script. See this entry for further details

Now execute the command:

store-passwd.sh

This invokes another shell (.sh) script which copies the password-related files to data partitions in Flash memory (mtd1 and mtd2).

Activate SSH

Now activate SSH (secure shell: telnet has major security limitations). Such lines can best be copied line-by-line or together into PuTTY:

chmod a+x /ffp/start/sshd.sh
sh /ffp/start/sshd.sh start

First Connection with SSH
Note that executing sshd.sh takes a while to execute and generates three pairs encryption keys for secure communication between the CH3SNAS and a remote client (computer). Each pair has a “fingerprint” for the public key and a corresponding graphical “randomart” image. The fingerprint for the RSA encryption algorithm will incidentally show up again in the next step.

As shown in one of the pictures, the first time you connect to this new (as far as ssh is concerned) machine, you will get a stern warning from ssh. This is because ssh expects to be connecting to this machine through an encrypted connection (now and likely in the future). But ssh wants to be sure that you are connecting to the intended machine rather than to an imposter (“man-in-the-middle”) and has no way of knowing if this is the case. Assuming that you are connecting to via your own (safe) LAN, you don’t need to worry whether the presented identification (public-key fingerprint) is the right one. If you need to connect over the internet (very unlikely) or are paranoid (unlikely), you can follow the confirmation procedure described in this website.

Note that this step associates the name and IP number of your NAS with this public key (this is stored on your computer). This means that during future ssh sessions to this machine the confirmation of the public key is done automatically.

Logging in using SSH

Now you can try to login using an ssh session as user root. This involves starting a second copy of PuttY.

Once you were logged in sucessfully, you can deactivate telnet using:

chmod -x /ffp/start/telnetd.sh

SSH Session
If the login was not successful, please check that you executed all necessary steps from above. If you still cannot login, please contact us in our forums.

Note that at this point telnet is actually still running, but it will stop working the next time you reboot the NAS. Once you have tested that the ssh server and the associated root password, and encryption keys are working fine you can reboot the NAS: from then on your NAS appliance has essentially been turned into a (somewhat) general purpose Linux computer which you can tweak via “normal” (sic) ssh command line sessions.

Now what?

Congratulations! With the last step, you’ve installed your fun_plug 🙂

You can now install additional packages or (carefully) look around using the command line!

Notes

Fun_plug and user accounts

Note that the initial execution of the fun_plug script creates a new usThe Conceptronic CH3SNAS runs an embedded version of the Linux operating system (OS). This includes a kernel and various Linux programs (mainly servers). Because the CH3SNAS (and many others) runs on an ARM processor, the executable version of Linux and the programs are binaries generated for the ARM processor.

The Firmwares includes a very interesting bonus: the user can execute a script (file) named “fun_plug” when the OS is booted. Unlike all the other Linux software which is loaded when the NAS boots, this file is located on Volume_1 of the hard disk rather than within the flash memory. This means the user can easily and safely modify the file because the contents of the flash memory is not changed. If you delete the fun_plug file (see here for instructions), or replace your hard disk, the modification is gone.

Fun_plug allows the user to start additional programs and tools on the NAS. A Berlin-based developer named “Fonz” created a package called “ffp” (Fonz fun_plug), which includes the script and some extra software which can be invoked by fun_plug.

Installation of fun_plug is easy and takes about 6 steps (with two optional more if you want to do some sightseeing rather than just racing over the Autobahn). These steps should be performed carefully, as they depend on typed commands and running with “root” privileges.

Contents

Purpose, risks, and benefits

Fun_plug is essentially a technique to stepwise turn a NAS with fixed out-of-the-box functionality into an open Linux machine on which you can install additional software packages and, if you want, learn a bit about Linux.

Responsibility

This also implies that you are (temporarily or permanently) turning a stable turnkey system into a system that Conceptronic no longer supports. This is similar to buying a notebook with Microsoft software, and installing Linux on it. The shop where you bought it can no longer help you if you claim the audio no longer works. Although there is a Tutorial on how to disable and even remove fun_plug, and although the authors have tested their recipes, checked the wording and added warnings, these are advanced tools which can, if you experiment more than your own know-how can handle, give advanced problems.

Risks involved in all this are not so much damaging your hardware (shouldn’t be possible), but loss of reliability of the NAS (you bought a file server to reliably store files, didn’t you). This risk may be acceptable because the software was preintegrated and tested by competent people. But you yourself are, at the end of the day, responsible for deciding to use this.

Possibly a less obvious, but more real risk is that some kind of extensions to the NAS (e.g. adding a server) imply that you may decide to open your local network a bit to the outside world. For example, to allow others to view your holiday videos stored on the device. The out-of-the-box NAS can already have this problem (via the ftp server). The point here is that you are responsible for the security of your device and entire network. This site doesn’t even have tutorials on basic security issues like firewalls, etc. because these are all NAS independent and the tutorials would never be foolproof anyway. So when used wrongly, the NAS and firewall obviously do allow others to read more data than you intended. Or to delete your valuable data. Or to replace software by other software (chance is small, but the impact is high).

Conclusion: as the NAS is a powerful networked device, and as these tutorials can help you make it even more powerful, you are responsibility for having the basic understanding of networked security. Again, this also applies to an out-of-the-box NAS. But the more you mess with it, the more you need to apply some common sense. This is incidentally the reason why we provide some explanation on what you are doing in the tutorials, rather than just telling you what to type 😉

Benefits

The main reason why people go this route is to extend their NAS with servers such as BitTorrent clients and Web servers. Other typical uses are to add extensions which fix current limitations of the device (e.g. time accuracy, fan noise).

Technical synopsis

In a first step, we install a script named fun_plug that provides a hook to extend the boot process of Linux on the NAS. That hook was intentionally added by the vendor to enable this. But Conceptronic does not document or support all of this.

An initial set of packages (downloaded as a single compressed archive) gives you enough tools to get started and, if you are curious about the machine or its software, to carefully look around.

This set of tools gives you the ability to install even more software packages (typically servers) from trusted sources. These packages should obviously all have been compiled for the ARM-type processor in the CHS3SNAS and should have been tested on the device (or a very similar device) by a software expert.

Tested Devices

This Tutorial has been tested on various devices. Other devices may work, please leave a comment in case you have tested an additional device.

Steps for installing fun_plug

Download

Download the latest files from fonz’ fun_plug repository:

  • fun_plug (this is a text file, you probably have to right-click to save it to disk)
    Note: If you want to install fun_plug on the D-Link DNS-320/DNS-325/DNS-345, download this file: fun_plug
  • fun_plug.tgz (this is a 10 MByte “tarball” file, roughly the Linux counterpart of a Zip file)

Place a copy of both files in the topmost directory of Volume_1 of your NAS using Windows Explorer (see Screenshot of what shared network drives looks like in Explorer, or alternatively use Samba or FTP).

Option: view the fun_plug script

For fun, you may want to open the file fun_plug by left-clicking here. Alternatively you can open it in Windows’ Wordpad or, better, Notepad++ under Windows. Please be careful not to accidentally modify it. Avoid using Windows’ Notepad for viewing/editing Linux text files: Windows and Linux use different end-of-line conventions.

The script fun_plug is an ASCII file with commands which are executed by the Linux command interpreter (sh for “shell”).

Lines starting with “#” are comments (“#!/bin/sh” is a special case).

You might be able to decode that the program creates a log file called ffp.log (an ASCII file used here to capture the lines which start with “echo”).

Firstly, a number of named constants are defined for various file names and fragments of file names (the lines like “FFP_SOMETHING=...“).

You can see that Fonz developed it for a D-Link DNS-323 (rather than a Conceptronic CH3SNAS, but this doesn’t matter as Uli, PeterH and others have tested in on the CH3SNAS).

The command date will copy the current date and time to the log file.

Next, a first script setup.sh is run if it is found in the expected /mnt/HD_a2/.bootstrap/ folder. Initially it will not be found.

Then a new directory “ffp” is created (mkdir) and the fun_plug.tgz file is unpacked (tar) into that directory. This step is a bit more complex than normal due to a problem with the tar version supplied with the NAS. As a workaround tar is run twice (first the older version, and then the tar version which was untarred from fun_plug.tgz).

If all went well, the log file gets an extra “OK” string. And the tarball input file is deleted (rm). This obviously only happens once (the script skips the unpacking if the tarball file is not found using the if [condition]; commands fi construct).

The “chown” is about changing ownership for a program called busybox. And “chmod” is about changing access privileges.

Then, a script file /ffp/etc/fun_plug.init (“containing the ffp-scripts package”) is executed if it is detected.

Next, a script file /ffp/etc/fun_plug.local is executed if it is detected. It can be used to add your own startup commands: it will not be overwritten by package updates.

Finally, a script file /ffp/etc/rc is run if it exists.

Reboot

Reboot the NAS by holding down the power button 5 seconds or via the web interface (”Tools” -> ”System” -> ”Reboot”). This causes the NAS to go and find the file fun_plug on Volume_1 and execute it.

Option: view ffp.log

If you are interested, you will find that the fun_plug.tgz tarball has disapeared, and has been unpacked into the newly created ffp directory.

You will also find the ffp.log file created during execution of the fun_plug script and while executing some of its commands. It is longish (e.g. 47 KBytes) because the tar program generates a lot of warnings about repairing links (this only happens once). You can view the log file with WordPad or NotePad++.

From now on, whenever the NAS is rebooted and thus the fun_plug script is re-executed, the script appends about 15 extra text lines to the end of this log file. These contain the date/time of reboot and the status of various servers which you may enable in the future (see below). This appending of information to ffp.log gives you one way to determine whether fun_plug is really running: if you last reboot of the NAS is listed, fun_plug and any servers that it actives are running.

Note that the end of the initial log file already states that a server called telnetd is already running. We will use Telnet in the next step.

Connect via telnet

Telnet Session
After rebooting, you need to connect to the NAS using a protocol called Telnet. Telnet allows you to “login” on a remote machine via a command line window.

Windows users can use an open-source telnet client called PuTTY. PuTTY is a self-contained program: the PuTTY.exe file can be stored wherever convenient and executed without any prior installation. In the PuTTY configuration screen you need to set the following before pressing Open:

  • Host name (or IP address): use the name of the share (e.g. CH3SNAS) or its IP address (the factory default is 192.168.0.20)
  • Select Connection type “Telnet” (which defaults to port 23)

Now you can press Open (PuTTY can save these settings under a default or name if you want, but you will likely be using ssh instead of telnet later on).

Linux users are “supposed to be” familiar with how to use telnet.

After connecting to the device, the first line telnet will show:

/ #

Now you are logged in. This command “prompt” is where you can type in commands. The prompt shows you are in the root directory. Note that Linux command lines are not very communicative. These Rambo-like social skills are generally attributed to Linux’ resource-deprived childhood.

Change root password

We proceed with updating /etc/shadow by using the program pwconv. It uses /etc/passwd to generate the necessary lines in the shadow-file.

pwconv

Now we need to change the password of user “root” to prevent unauthorized access.
Run the passwd command and enter a new password twice (note that Linux passwords are case-sensitive):

passwd

Next, activate the root-user which is disabled by default:

usermod -s /ffp/bin/sh root

And change the home-directory of root to a permanent one:

mkdir -p /ffp/home/root/
usermod -d /ffp/home/root/ root

Now check if everything went right using:

login

If this was successful, proceed to the next step, otherwise return to “passwd“.

Store the password in the NAS. This step is essential, otherwise your password will be cleared on the next reboot! Please check the following section before executing the command itself:

  • Note: For the D-Link DNS-343, you need a different store-passwd.sh script. See DNS-343 store-passwd.sh
  • Note: For the D-Link DNS-320/DNS-325/DNS-345, you need a different store-passwd.sh script. See this entry for further details

Now execute the command:

store-passwd.sh

This invokes another shell (.sh) script which copies the password-related files to data partitions in Flash memory (mtd1 and mtd2).

Activate SSH

Now activate SSH (secure shell: telnet has major security limitations). Such lines can best be copied line-by-line or together into PuTTY:

chmod a+x /ffp/start/sshd.sh
sh /ffp/start/sshd.sh start

First Connection with SSH
Note that executing sshd.sh takes a while to execute and generates three pairs encryption keys for secure communication between the CH3SNAS and a remote client (computer). Each pair has a “fingerprint” for the public key and a corresponding graphical “randomart” image. The fingerprint for the RSA encryption algorithm will incidentally show up again in the next step.

As shown in one of the pictures, the first time you connect to this new (as far as ssh is concerned) machine, you will get a stern warning from ssh. This is because ssh expects to be connecting to this machine through an encrypted connection (now and likely in the future). But ssh wants to be sure that you are connecting to the intended machine rather than to an imposter (“man-in-the-middle”) and has no way of knowing if this is the case. Assuming that you are connecting to via your own (safe) LAN, you don’t need to worry whether the presented identification (public-key fingerprint) is the right one. If you need to connect over the internet (very unlikely) or are paranoid (unlikely), you can follow the confirmation procedure described in this website.

Note that this step associates the name and IP number of your NAS with this public key (this is stored on your computer). This means that during future ssh sessions to this machine the confirmation of the public key is done automatically.

Logging in using SSH

Now you can try to login using an ssh session as user root. This involves starting a second copy of PuttY.

Once you were logged in sucessfully, you can deactivate telnet using:

chmod -x /ffp/start/telnetd.sh

SSH Session
If the login was not successful, please check that you executed all necessary steps from above. If you still cannot login, please contact us in our forums.

Note that at this point telnet is actually still running, but it will stop working the next time you reboot the NAS. Once you have tested that the ssh server and the associated root password, and encryption keys are working fine you can reboot the NAS: from then on your NAS appliance has essentially been turned into a (somewhat) general purpose Linux computer which you can tweak via “normal” (sic) ssh command line sessions.

Now what?

Congratulations! With the last step, you’ve installed your fun_plug 🙂

You can now install additional packages or (carefully) look around using the command line!

Notes

Fun_plug and user accounts

Note that the initial execution of the fun_plug script creates a new user group utmp.

The script that installs the ssh server creates a new user named sshd and adds the user to utmp. This user is for internal use only, and has no ability to login. It is standard procedure when installing OpenSSH, and believed to be safe.

On a NAS, user sshd also shows up as having read-only ftp access to Volume_1. Although it is doubtful that this user really can access ftp, this seems to be a bug and is being investigated.er group utmp.

The script that installs the ssh server creates a new user named sshd and adds the user to utmp. This user is for internal use only, and has no ability to login. It is standard procedure when installing OpenSSH, and believed to be safe.

On a NAS, user sshd also shows up as having read-only ftp access to Volume_1. Although it is doubtful that this user really can access ftp, this seems to be a bug and is being investigated.

Output of /proc/cpuinfo on the D-Link DNS-323

Here the output of cat /proc/cpuinfo on the D-Link DNS-323:

Processor       : ARM926EJ-Sid(wb) rev 0 (v5l)
BogoMIPS        : 331.77
Features        : swp half thumb fastmult edsp java
CPU implementer : 0x41
CPU architecture: 5TEJ
CPU variant     : 0x0
CPU part        : 0x926
CPU revision    : 0
Cache type      : write-back
Cache clean     : cp15 c7 ops
Cache lockdown  : format C
Cache format    : Harvard
I size          : 32768
I assoc         : 1
I line length   : 32
I sets          : 1024
D size          : 32768
D assoc         : 1
D line length   : 32
D sets          : 1024
 
Hardware        : MV-88fxx81
Revision        : 0000
Serial          : 0000000000000000

Output of /proc/meminfo on the D-Link DNS-323

Here the output of cat /proc/meminfo on the D-Link DNS-323:

MemTotal:        61948 kB
MemFree:          6040 kB
Buffers:         13360 kB
Cached:          16344 kB
SwapCached:       6968 kB
Active:          32444 kB
Inactive:        12696 kB
HighTotal:           0 kB
HighFree:            0 kB
LowTotal:        61948 kB
LowFree:          6040 kB
SwapTotal:     1060208 kB
SwapFree:      1047916 kB
Dirty:              56 kB
Writeback:           0 kB
Mapped:          22616 kB
Slab:             8404 kB
CommitLimit:   1091180 kB
Committed_AS:    36204 kB
PageTables:        620 kB
VmallocTotal:   450560 kB
VmallocUsed:      9804 kB
VmallocChunk:   440316 kB
Exit mobile version