Dienstag, 21. November 2017, 13:07 UTC+1

Sie sind nicht angemeldet.

  • Anmelden
  • Registrieren

Lieber Besucher, herzlich willkommen bei: NAS Forum. Falls dies Ihr erster Besuch auf dieser Seite ist, lesen Sie sich bitte die Hilfe durch. Dort wird Ihnen die Bedienung dieser Seite näher erläutert. Darüber hinaus sollten Sie sich registrieren, um alle Funktionen dieser Seite nutzen zu können. Benutzen Sie das Registrierungsformular, um sich zu registrieren oder informieren Sie sich ausführlich über den Registrierungsvorgang. Falls Sie sich bereits zu einem früheren Zeitpunkt registriert haben, können Sie sich hier anmelden.

1

Montag, 25. November 2013, 14:50

OpenWRT on Edimax NS-2502

After I found much helpful threads in this forum, I'd like to provide a
"report" of my experiences with OpenWRT on an Edimax NS-2502.
It's a longer story, but maybe someone can use something of it somehow 8)

----

The whole time i had a serial console cable (left from unbricking :rolleyes: )
connected to the device to watch and interfere more directly.

USB-to-RS232 3.3V TTL cable from FTDI sold for the Raspberry Pi:
http://www.ftdichip.com/Products/Cables/RPi.htm
http://www.ftdichip.com/Drivers/VCP.htm

----

I had the NS-2502 configured for RAID1, and the RAID was fully synchronised,
before I downloaded and flashed OpenWRT from OpenGemini

http://opengemini.free.fr/wiki/doku.php?id=openwrt
images-planex-mzknas2openwrt.bin

via the Edimax web interface. No problems here.

----

After that the OpenWRT web interface was available and login via ssh was possible.
(default ip address 192.168.1.250)

On the shell I noticed the partitioning/filesystem of the internal hardisks was
still usable and the RAID1 had been activated by the kernel as /dev/md0.

I just had to create a mount point and reformat the swap partitons.

Quellcode

1
2
3
# mkdir /mnt/md0
# mkswap -L "SWAP1" /dev/sda3
# mkswap -L "SWAP2" /dev/sdb3


----

Next I set up the device further via the web interface, basically doing:

Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
Network -> Interfaces
  delete eth1

System -> Mount Points
  Delete all present mount points
  Add new mount point
    Enabled: yes
    Device: /dev/md0
    Mount point: /mnt/md0
    Filesystem: ext4
    Run filesystem check: no

Swap: add /dev/sda3 and /dev/sdb3


And sharing a subfolder of /dev/md0 via Samba.

----

I wasn't able to set the samba password in the web interface, but via ssh shell.
The default-non-admin user in /etc/passwd is "user".

Quellcode

1
# smbpassword user <PASSWORD>


And I noticed that an ntpd should be started in the boot sequence, but /usr/sbin/ntpd
was missing. So i disabled it (System -> Startup -> disable sysntpd) and removed the start script.

Quellcode

1
# rm /etc/rc.d/S98sysntpd


But NTP is still used, because /usr/sbin/ntpclient is called by hotplug when an interface comes up.

----

Now the NAS was ready and I could use it via the samba share, and even some data I had
left on the RAID while using the original Edimax firmware was there and accessible.

----

But after a reboot the web interface didn't work. On the shell I was able to
find out that /usr/bin/lua was missing. To get some free space on the flash i uninstalled
rsync/rsyncd and xinet/xinetd/luci-app-xinetd, because I didn't need them.

I downloaded the necessary packages from OpenGemini:

http://opengemini.free.fr/openwrt/trunk/….4-8_cs351x.ipk
http://opengemini.free.fr/openwrt/trunk/….4-8_cs351x.ipk
http://opengemini.free.fr/openwrt/trunk/….2-1_cs351x.ipk

copied them to the samba share and installed them manually:

Quellcode

1
2
3
# opkg install lua_5.1.4-8_cs351x.ipk
# opkg install liblua_5.1.4-8_cs351x.ipk
# opkg install libuci-lua_2011-10-21.2-1_cs351x.ipk


Then LUA survived further reboots and I don't know how it got missing in the first place.

----

I also noticed that the wrong LEDs of the Edimax NS-2502 were in use.
USB2 and SATA1 did blink for the two harddisks, but SATA2 was always off.

----

Next, one missing piece was mdadm, in case I had rebuild the RAID sometime.

I got an mdadm package created by AQUAR from this thread:
http://www.nas-forum.org/index.php?page=Thread&threadID=555

copied it again to the samba share, and installed it via ssh.

Quellcode

1
2
3
4
# opkg install mdadm_3.2-1_cs351x.ipk
# chmod +x /sbin/mdadm
# /sbin/mdadm
Segmentation fault


Unfortunately it didn't work and kept segfaulting. AQUAR later told me his package
was specially for OpenWRT on the Mbox, and thus not compatible. So I tried to
compile it myself with OpenWRT buildroot for some time, but I gave up on it.

----

Another missing piece was a method or mail binary to send e-mail-notifications.
I created the following scripts to send mails with raw SMTP commands over a telnet
connection to an open mail server, and put them in /root/.

Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/sh

# /root/sendmail-telnet.sh

SERV="$1"
FROM="$2"
RCPT="$3"
SUBJ="$4"
HELO="$5"

if [ -z "$SERV" -o -z "$FROM" -o -z "$RCPT" -o -z "$SUBJ" ] ; then
  echo "Usage: sendmail-telnet.sh <smtpserver> <sender> <recipient> <subject> [helohost]"
  echo "       message on stdin"
  exit 1
fi

if [ -z "$HELO" ] ; then
  HELO=`hostname -f`
fi

( sleep 4
  echo "HELO $HELO"
  sleep 2
  echo "MAIL FROM: $FROM"
  sleep 2
  echo "RCPT TO: $RCPT"
  sleep 2
  echo "DATA"
  sleep 2
  echo "Date: "`date -R`
  echo "Subject: $SUBJ"
  echo "From: $FROM"
  echo "To: $RCPT"
  echo ""
  cat - | sed 's/^\.\s*$/../'
  echo ""
  echo "."
  sleep 2
  echo "QUIT"
) | (
  while read LINE ; do
    echo "$LINE"
    echo "$LINE" >&2
  done
) | telnet "$SERV" 25


This generic script is called by another script with the apropriate parameters for your mail server.

Quellcode

1
2
3
#!/bin/sh
# /root/sendmail.sh
cat - | /root/sendmail-telnet.sh mail.example.com root@example.com user@example.com 'OpenWRT NAS Message' nas.example.com


Which is called by a third script that checks the status of the RAID.

Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/sh

# /root/raidcheck.sh

exec  >/dev/nul
exec 2>/dev/nul

cat /proc/mdstat | grep '[UU]bla'
R1=$?

cat /proc/mdstat | grep 'finish'
R2=$?

if [ "$R1" -ne 0 -o "$R2" -eq 0 ] ; then
  ( echo "non-optimal RAID status on tamir"
    echo ""
    cat /proc/mdstat
  ) | /root/sendmail.sh
fi


And now this script is periodically called by a cronjob (twice a day).

Quellcode

1
0 6,18 * * * /root/raidcheck.sh


----

I pulled out a harddisk to check if the scripts worked in reality and I got
notified indeed. Unfortunately I wasn't able to rebuild the RAID after
putting the harddisk back due to the missing mdadm.

So I switched back to original Edimax firmware by flashing a
"revert image" provided on OpenGemini:

http://opengemini.free.fr/wiki/doku.php?…vendor_firmware
images-openwrt2edimax-ns250x.bin

Everything worked like before, and again all data on the RAID hab been preserved and
the rebuild of the RAID could be done. The only thing I had to do manually was putting
the swap partitions back to their former format via the serial console.

Quellcode

1
2
# mkswap /dev/hdc3
# mkswap /dev/hdd3


----

So finally I was were I began :)
And I deceided to keep it that way for the time beeing, because trying OpenWRT was quite
interesting, but I after this time I just wanted to put the NS-2502 back to "productive use".

Again, thank you for the help and information in this forum.

AQUAR

Schüler

Beiträge: 100

Wohnort: Australia

2

Mittwoch, 27. November 2013, 12:38

@ hawkeye

Pity about the mdadm package giving a segmentation fault.
I am sure with some help from the developers of this program that you could get it to work.

On opengemini, the OpenWRT firmwares for the different vendors now share the common identity of cx351.
The mdadm package I compiled for the MvixBOX also has this identity, so it can at least be installed for the Edimax OpenWRT.
Packages without a matching identity to the firmware woun't install - that is all I was saying.

This obsolete hardware can sometimes be had for little money - maybe interesting to try mdadm on an experimental NAS box.
I 'm not much of a linux person but happy to assist and even try it on my test unit.

AQUAR