Qnap: clean install

Aus FHEMWiki

Cleanup Qnap

This is an simple sequence for starting all over with an qnap TS-219 after having played with an TS-219 for some time. In this time we have problably damaged many parts and settings and it is better to have an nice blank system again

Features

  • Reset to factory settings
  • Create Basic configuration.
  • Clean up the HD
  • Install mail
  • Install perl


Note

  • There is also a [http://forum.qnap.com/viewtopic.php?f=182&t=61052 step-by-step-description] for a TS109



Firmware upgrade

Download the latest firmware from the qnap distribution

http://www.qnap.com/download.asp
Qnap0.png


1: Select: storage (qnap1)

2: Select: modelname

3: Select the tab >> Firmware

4: Save to file on your local PC

5: Unzip the compressed fileto an winzip file

Reset to default factory constants

log into the qnap

select reset to default factory settings

select Firmware update (QNAP3)

select browse-key to select your downloaded firmware version

select start

Update your Basic server setting

Change name to FaserTaiwan

change admin passw: xxxxxxxx

create xxxx passw: xxxxxxxx

enable web Server

enable NSF

enable Mail

SMTP Server: smtp.gmail.com

Port Number: 587 sender: ACE External services user Name: your.services@gmail.com passw: xxxxxxxxx


Install Optware

Select Get QPKG (QNAP4) version 0.99.163

save the file to your local pc

unzip the file (qnap5)

select tab Installation

select browse

press install

The pinguin should be visable (qnap6)

Click on the IPKG image and select Enable (qnap8)

Restart the qnap

Enable perl scripting

to enable p-l files we have to change the apache configuration

/mnt/HDA_ROOT/.config/apache/apache.conf This will force the .pl files to be executed as an cgi

If you run an .pl file, and you get the save dialog... look here

get Filezilla to log into your qnap

add this to the apache configuration

<Directory "/share/Qweb/cgi-bin">  
	AllowOverride None
	Options ExecCGI
	AddHandler cgi-script .cgi .pl
	Order allow,deny
	Allow from all
</Directory>

restart apache

[~] # /etc/init.d/Qthttpd.sh restart

Check ipkg

look for your ipkg version

[~] # ipkg --version

the system will reply with the present ipkg version

ipkg version 0.99.163

[~] #

Check for ipkg Updates

update ipkg

[~] # ipkg update

The system will respond with something like

Downloading http://ipkg.nslu2-linux.org/feeds/optware/tsx19/cross/unstable/Packages

Updated list of available packages in /opt/lib/ipkg/lists/tsx19

Downloading http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/unstable/Packages.gz

Inflating http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/unstable/Packages.gz

Updated list of available packages in /opt/lib/ipkg/lists/cs08q1armel

Successfully terminated.

[~] #

Perl 5.10.0 install

make and check .cpan directory in /opt/

?????

[~] # find / -name '.cpan' The system will respond like

/share/MD0_DATA/.qpkg/Optware/.cpan

[~] #

link the directory

[~] # ln -s /opt/.cpan /root/.cpan

List the available modules

[~] # ipkg list |grep perl

Check the installed ipgk modules

[~] # ipkg list_installed

install perl

[~] # ipkg install perl automake autoconf libtool m4 binutils coreutils gcc

the install ends like

Configuring m4

Configuring make

Configuring perl

Successfully terminated.

[~] #

Perl 5.10.0 modules install

The following Perl modules have to be loaded

[~] # ipkg install libgd

The Graphical module

[~] # ipkg install perl-gd

[~] # ipkg install perl-yaml-syck The Serial communication module

[~] # ipkg install perl-device-serialport

add CPAN modules

[~] # perl -MCPAN -e '$ENV{FTP_PASSIVE} = 1; install GD::Text'

[~] # perl -MCPAN -e '$ENV{FTP_PASSIVE} = 1; install GD::Graph'

GNU plot install

Install one of my favorite plot functions for 3d

[~] # ipkg install gnuplot

Test perl file

Map your server to your pc as an new drive

create an cgi-bin in Qweb

copy gd_test1.pl to here

try http://asmlonline.com/cgi-bin/samples/gd_test1.pl

#!/opt/bin/perl -w
# Change above line to point to your perl binary if youb insist to have it elsware 
# name: test1.pl
use CGI::Carp qw/fatalsToBrowser/;
use CGI ':standard';
use GD::Graph::bars;
use strict;
 
# Both the arrays should same number of entries.
my @data = (["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug","Sep", "Oct", "Nov", "Dec"],
      [23, 5, 2, 20, 11, 33, 7, 31, 77, 18, 65, 52]);
my $mygraph = GD::Graph::bars->new(500, 300);
$mygraph->set(
   x_label   => 'Month',	
   y_label   => 'Number of Hits',     
   title    => 'Number of Hits in Each Month in 2002',
) 
 or warn $mygraph->error;
 
my $myimage = $mygraph->plot(\@data) or die $mygraph->error;
print "Content-type: image/png\n\n";
print $myimage->png;

Dont forget to make the test file as executable

chmod 755 test1.pl

Test email function

test additional if we can email an local file

locate the file eg in Qweb/cgi-bin/samples

Create an file testmail.txt

# cat /share/MD0_DATA/Qweb/cgi-bin/samples/testmail.txt | sendmail -t

the data for the mail has to be copied in an file


Subject: Anytext you want to have as mailsubject 
From: Asmlonline server
To: your-email@live.nl
1 !!! ONE EMPTY LINE AT THE BOTTOM - else the body will not be transmitted
2 Any text you want to transmit in the body of the mail.
3
4 !!! ONE EMPTY LINE AT THE BOTTOM - else the body will not be transmitted
5 Any text you want to transmit in the body of the mail.
6
7 !!! ONE EMPTY LINE AT THE BOTTOM - else the body will not be transmitted
8 Any text you want to transmit in the body of the mail.
9
1
2
3 !!! ONE EMPTY LINE AT THE BOTTOM - else the body will not be transmitted
4 any text you want to transmit in the body of the mail.
5 !!! ONE EMPTY LINE AT THE BOTTOM - else the body will not be transmitted
6 Any text you want to transmit in the body of the mail.
7 !!! Footer.... need to be here and will not be send !!!!!
8

Install of the 2302 Prolific Technology driver on a QNAP 219

Start Putty

input here the putty stuff

Check kernel

[~] # Type: uname -a

Check the actual kernel version of the Qnap in our example the following line is displayed

[~] Responce:Linux Faservtaiwan 2.6.22.18 #1 Thu Apr 30 21:30:06 CST 2009 armv5tejl unknown

The Qnap name is:Faservtaiwan
The actual Kernel version is : 2.6.22.18

Double check the USB interfaces on the QNAP

[~] # Type: lsusb

Check if you see the hardware if it is connected at the front

The system will reply with EG:

[~] Responce:Bus 001 Device 003: ID 067b: 2303 Prolific Technology, Inc.. Pl2303 Serial Port

[~] Responce:Device 002: ID 058f: 6254 Alcor Micro Corp.

[~] Responce:Device 001: ID 0000:0000

One of the issues of the 2303 driver, is that LINUX unfortunally does not like to recognize
the device at once, and needs some extra help. 
If you dont see the top line with 2303 Prolific , please remove the USB connector from the QNAP 
and replug it after 5 seconds. This will do the job

to do

Install Optware in Server web page Tab by selecting QPKG-Plugins >> Optware.ipkg

[~] # Type: dmesg | grep tty [~] # Type: dmesg | grep usb

Check the actual driver status

[~] # Type: cat /proc/bus/usb/devices

The responce of the sysem will be something like this

	T: Bus=01 Lev=02 Prnt=02 Port=00 Cnt=01 Dev#= 7 Spd=12 MxCh= 0
	D: Ver= 1.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1
	P: Vendor=067b ProdID=2303 Rev= 3.00
	S: Manufacturer=Prolific Technology Inc.
	S: Product=USB-Serial Controller
	C:* #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=100mA
	I:* If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=none
	E: Ad=81(I) Atr=03(Int.) MxPS= 10 Ivl=1ms
	E: Ad=02(O) Atr=02(Bulk) MxPS= 64 Ivl=0ms
	E: Ad=83(I) Atr=02(Bulk) MxPS= 64 Ivl=0ms

The Driver=none indicates that there is no driver attached

#!/bin/sh

ln -s /opt/lib/modules/2.6.12.6-arm1/kernel /lib/modules
insmod /lib/modules/kernel/drivers/usb/serial/usbserial.ko vendor=0x03eb product=0x204b
insmod /lib/modules/kernel/drivers/usb/serial/ftdi_sio.ko
insmod /lib/modules/kernel/drivers/usb/serial/pl2303.ko

[~] # Type: ipkg update
[~] # Type: ipkg list | grep usb
[~] # Type: ipkg install kernel-module-usbserial
[~] # Type: cd /opt/lib/modules/2.6.22.18/kernel/drivers/usb/serial
[~] # Type: ll
[~] # type: insmod usbserial.ko
[~] # Type: ipkg list | grep pl23
[~] # Type: ipkg install kernel-module-pl2303
[~] # Type: cd /opt/lib/modules/2.6.22.18/kernel/drivers/usb/serial
[~] # Type: ll
[~] # type: insmod pl2303.ko

Check the actual driver is attached

[~] # Type: cat /proc/bus/usb/devices
	T: Bus=01 Lev=02 Prnt=02 Port=00 Cnt=01 Dev#= 7 Spd=12 MxCh= 0
	D: Ver= 1.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1
	P: Vendor=067b ProdID=2303 Rev= 3.00
	S: Manufacturer=Prolific Technology Inc.
	S: Product=USB-Serial Controller
	C:* #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=100mA
	I:* If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=pl2303
	E: Ad=81(I) Atr=03(Int.) MxPS= 10 Ivl=1ms
	E: Ad=02(O) Atr=02(Bulk) MxPS= 64 Ivl=0ms.,
	E: Ad=83(I) Atr=02(Bulk) MxPS= 64 Ivl=0ms

The Driver=pl2303 indicates that there is an driver attached 

[~] # Type: lsmod 
[~] # Type: dmesg | grep pl2303

Check the driver

[~] # Type: ls -al /dev/usb/ttyUSB*

Reboot und Test

Much Fun

Jan 05.02.2010

www.asmlonline.com >> asmlonline@hotmail.com