UNTESTED!

please checkout this excellent guide: http://www.cyrius.com/debian/kirkwood/qnap/ts-219/install/

if you want a slim and sleak and reliable NAS and do WIHTOUT THE NEED for the 10.000x billion features, iTunes-Media server, Video transcoding slowing down your expensive QNAP NAS system (i think the hardware is ok but expensive) – install debian on Qnap Turbo Station TS-219P.

you then can install all the Debian-apt software that you normally could not with the default BusyBox linux shipped.

e.g. htop:

htop

instead of using expensive QNAP hardware

you could also use this (same) hardware to build yourself a similar NAS:

Seagate FreeAgent GoFlex Net  stak200 arm kirkwood

seagate_stak200_arm_kirkwood_cheapest_nas_possible_x-d

http://www.cyrius.com/debian/kirkwood/

Debian on Kirkwood devices

Kirkwood is a system on a chip (SoC) from Marvell that integrates an ARM CPU, Ethernet, SATA, USB, SDIO and other functionality in one chip. Kirkwood is targeted at Network Attached Storage (NAS) devices, digital home media servers, plug computers and other devices. Kirkwood based devices are a great platform to run Debian and together with Debian they can be a very powerful environment.

Debian supports a number of Kirkwood based devices.

There are additional pages with instructions and information about all supported devices:

http://www.cyrius.com/debian/kirkwood/qnap/

QNAP TS-219P and TS-219P+

Component

Comment

CPU

Marvell Kirkwood 88F6281 A0, 1.2 GHz (TS-219P) or 88F6282 1.6 GHz (TS-219P+)

RAM

512 MB DDR II

Flash ROM

16 MB STMicroelectronics 25P28V6P SPI

Internal hard drive

2x 3.5″ SATA, integrated in SoC

External hard drive

2x eSATA, JMB362

Ethernet

1x 10/100/1000 Mbit, integrated in SoC

USB

3x USB 2.0, GL850G and integrated in SoC

RTC

Seiko Instruments S-35390A

Fan

Yes, one; Y.S. Tech FD127025LB

Boot loader

U-Boot

are powerful NAS devices that can be used for a variety of tasks. You can use the user-friendly Debian installer to install Debian.

Information

External Resources

Help

If you have problems with Debian on QNAP HS-210, TS-21x or TS-22x and cannot solve them with Google, you can consult the following resources:

  • The debian-arm list for questions specifically related to the ARM port of Debian or about running Debian on the QNAP TS-21x/TS-22x.
  • If you don’t want to post to a mailing list, please post to the Debian area on the QNAP forum.
  • For questions about QNAP devices that are not related to Debian, please use the QNAP forum.

Acknowledgements

A lot of people helped to make Debian on QNAP Turbo NAS possible. The folks at QNAP have been very supportive of this effort and have supplied some hardware and technical expertise. Marvell has done a fabulous job integrating Kirkwood support into the mainline kernel.

Overview

In a nutshell, the installation of Debian on your QNAP HS-210, TS-21x or TS-22x works like this:

you use the QNAP firmware to write a Debian installer image to flash.

When you restart your device, Debian installer starts and allows you to login via SSH to perform the installation.

Debian will be installed to disk and a Debian kernel will be put in flash that will start Debian from disk.

If you follow this procedure, Debian 7 (wheezy) will be installed to your SATA disk and the QNAP firmware on disk and in flash will be replaced with Debian.

Debian does not install a web interface to configure your machine, although it’s possible to install such software.

If this is not what you want, please don’t proceed with the installation.

Requirements and Preparation

In order to install Debian on a QNAP TS-21x/TS-22x device, you need the following:

  • A QNAP HS-210, TS-210, TS-212, TS-212-E, TS-219, TS-219P, TS-219P+, TS-219P II, TS-220 or TS-221.
  • An internal SATA disk.
  • A network connection.
  • Another machine on which you have a telnet and an SSH client. Telnet is included in Linux and Windows. SSH is included in every Linux distribution as OpenSSH and there isPuTTY for Windows.

Making a Backup

You have to make a backup of all the data stored on your QNAP before starting with the installation of Debian since Debian will format the whole disk during the installation.

Also, Debian will replace the QNAP firmware in flash, so it’s also recommended to make a copy of the flash (mtd) partitions.

Debian will only modify the first two flash partitions but it’s a good idea to keep a copy of all partitions as you may need them to use the recovery mode.

More detailed instructions for making a backup of your flash partitions will be given later.

Starting the Installer

Start your QNAP device and login via SSH.

Some time after you start your machine, you will hear a beep and a bit later you’ll hear a longer beep.

Wait for a few more seconds and then connect to the machine via SSH.

The username is admin and the password is admin too.

Once you are logged in, you can save the content of your flash partitions to a USB stick.

Connect a USB stick to your QNAP and wait for the system to mount it.

In my case, it was mounted at /share/external/sdi but you can find the location with the following command:

mount | grep external

/dev/sdi1 on /share/external/sdi type vfat […]

Now go to this directory and make a backup of your flash partitions:

cd /share/external/sdi

cat /dev/mtdblock0 > mtd0;

cat /dev/mtdblock1 > mtd1;

cat /dev/mtdblock2 > mtd2;

cat /dev/mtdblock3 > mtd3;

cat /dev/mtdblock4 > mtd4;

cat /dev/mtdblock5 > mtd5;

cd ..

umount /share/external/sdi1;

Disconnect your USB stick from your QNAP, connect it to your PC and to add the mtdX files to your regular backup.

Now you can go ahead and download the installer.

Download and Flash the Installer

Issue the following commands on your QNAP to download the Debian installer images:

cd /tmp;

busybox wget http://ftp.debian.org/debian/dists/stable/main/installer-armel/current/images/kirkwood/network-console/qnap/ts-219/initrd.gz

busybox wget http://ftp.debian.org/debian/dists/stable/main/installer-armel/current/images/kirkwood/network-console/qnap/ts-219/kernel

busybox wget http://ftp.debian.org/debian/dists/stable/main/installer-armel/current/images/kirkwood/network-console/qnap/ts-219/flash-debian

busybox wget http://ftp.debian.org/debian/dists/stable/main/installer-armel/current/images/kirkwood/network-console/qnap/ts-219/model

These commands will download the Debian kernel,

the installer ramdisk,

a file with information about the support QNAP model,

and a script to write the kernel and ramdisk to flash.

You can now run the script by executing the following command:

sh flash-debian

Please note that this command will take about three minutes to run. You will see the following on your screen:

Updating MAC address…

Your MAC address is 00:08:9B:8C:xx:xx

Writing debian-installer to flash… done.

Please reboot your QNAP device.

Once the command has completed, you can reboot your QNAP device:

reboot

exit

The Installation

After you have flashed the Debian installer image and restarted your QNAP device, the Debian installer will start.

Since the TS-21x/TS-22x does not have any IO device, SSH will be used for the installation.

The installer will bring up the network, start the OpenSSH server and you can then connect to the device using SSH.

You have to wait a few minutes after starting the system before you can connect.

When the installer is ready, the status LED will change to solid green and your device will beep briefly to indicate that you can now login via SSH.

Since the TS-21x/TS-22x does not have an LCD, the installer cannot tell you which IP address to connect to or which password to use.

With regards to the IP address, the following strategy is used:

  • If your QNAP firmware is configured to use DHCP (the default configuration from QNAP), Debian installer will try to acquire an IP address with DHCP. If you have not initialized your QNAP firmware with QFinder, DHCP will be used. You can use the MAC address of your QNAP device to tell your DHCP server to give out a specific IP address to your machine.

[/tmp] # sh flash-debian

Updating MAC address…

Update /dev/mtdblock4 by using /tmp/debian.14382 done

Your MAC address is 00:08:9B:C0:AF:B4

Writing debian-installer to flash… done.

Please reboot your QNAP device.

[/tmp] # reboot

[/tmp] # exit

  • If you configured a static address in your QNAP firmware, this configuration will be used. However, if your network configuration was incomplete (e.g. IP address or DNS were missing), the installer will use DHCP instead.
  • If DHCP is used but your DHCP server does not respond, the device will use the fallback address 192.168.1.100. If you are unsure what the address of your QNAP is, unplug the Ethernet cable, start the machine again, wait until Debian installer is ready for SSH and then plug the cable back in and connect to this fallback address.

RE-SSH into your box (with previously fixed ip configured):

ssh installer@192.168.1.123

pwd: install

Before you can connect to the installer via SSH, you have to remove the SSH key from the QNAP firmware from your known_hosts file.

The QNAP firmware uses a different SSH key than the Debian installer, so when you try to connect to Debian you will get an error saying that the remote host identification has changed. Edit ~/.ssh/known_hosts and remove the entry for the IP address of your QNAP device. Now connect to the installer (again, replacing the address in the example with the actual IP address of your QNAP) and login as user installer with the password install:

ssh installer@192.168.1.100

The installation itself should be pretty standard and you can follow the installation guide.

The installer knows about the TS-21x/TS-22x and at the end of the installation it will flash a kernel and ramdisk that will automatically boot into Debian.

It will also install the qcontrol package that can be used to control the fan, LEDs and beeper on your QNAP device.

Since the TS-21x/TS-22x boots from flash you don’t have many limitations as to how you partition your hard drive. You can use LVM and RAID and a number of filesystems.

At the end of the installation, the installer will write the new kernel to flash.

Afterwards you will get a confirmation that the installation is complete.

Confirm, wait for the installer to finish and once your SSH session terminates, wait a few minutes before you can connect to your newly installed system via SSH. Your QNAP device will beep when you can connect via SSH. You will be able to log in as root or your newly created user.

Success

You should now have a complete Debian system running on your QNAP. You can use apt-get and other tools to install additional software. The TS-21x/TS-22x is an ARM based device and the armel architecture is fully supported by Debian.

Finally, make sure to read the tips and tricks about running Debian on the QNAP TS-21x/TS-22x.

Go back to my Debian on QNAP TS-21x/TS-22x page.

If you find this site helpful, you’re welcome to make a donation.

Tips and tricks for Debian on QNAP TS-21x/TS-22x

Here are some tips and tricks about running Debian on the QNAP TS-21x/TS-22x.

Upgrading qcontrol for automatic fan control

Debian ships a program called qcontrol which can be used to control the fan, LEDs and buttons on QNAP devices.

The version of qcontrol included in Debian 7 (wheezy) is missing a number of important features, such as automatic temperature control.

Fortunately, Ian Campell, the maintainer of qcontrol, has provided a backport of qcontrol to Debian 7 which includes many new features.

In order to install this updated version of qcontrol, you have to configure the wheezy-backports repository by editing the file /etc/apt/sources.list and adding the following line:

echo “deb http://ftp.debian.org/debian/ wheezy-backports main” >> /etc/apt/sources.list;

Afterwards, run the following commands to active the new repository and install the updated qcontrol package:

apt-get update;

apt-get install -t wheezy-backports qcontrol;

qcontrol will now run in daemon mode and control the fan and listen for button presses.

You can edit the /etc/qcontrol.conf configuration file to change the behaviour of qcontrol, for example how the fans are regulated depending on the temperature or which commands to run when a button is pressed.

Scheduled power on

You can tell your QNAP device to power on at a specific time using the wakealarm system.

For example, if you want your QNAP to power on in 5 minutes, issue the following commands and turn off your device:

echo 0 > /sys/class/rtc/rtc0/wakealarm

echo `date ‘+%s’ -d ‘+ 5 minutes’` > /sys/class/rtc/rtc0/wakealarm

You can check check whether a wakealarm has been configured with:

cat /proc/driver/rtc

Look for alrm_time and and alrm_date.

Automatic power on

QNAP machines can turn on automatically when power is applied if the device was not powered down correctly.

This is helpful when your power goes down.

In order to enable this feature, run the following command:

qcontrol –direct autopower on

Disk order on the QNAP TS-219P

One note for Debian users on the TS-219P (this note does not apply to TS-210 and TS-219): when you use the QNAP firmware, the disk on the left is HDD1 whereas the disk on the right is HDD2. However, on Debian it is the other way around (HDD1 is on the right, HDD2 is on the left). This doesn’t really matter since Debian uses unique IDs (UUIDs) to refer to partitions, but don’t be surprised when the “HDD2” light goes on when you access the first disk.

get this guide as pdf: Debian on QNAP NOTEZ.pdf

now let’s install some useful software:

the plan is to access this NAS via NFS (which is faster than SMB) from a super fast and power efficient Linux Debian Client.

apt-get install htop; # nicer version of top... more colors... you can scroll etc.
apt-get install vim; # vim - we all know what that is (advanced editor)

DO NOT INSTALL nfs-kernel-server!!! – it gonna brick the device…

and you will have to: TFTP load a recovery image – http://www.cyrius.com/debian/kirkwood/qnap/ts-219/recovery/

http://wiki.qnap.com/wiki/Firmware_Recovery

liked this article?

  • only together we can create a truly free world
  • plz support dwaves to keep it up & running!
  • (yes the info on the internet is (mostly) free but beer is still not free (still have to work on that))
  • really really hate advertisement
  • contribute: whenever a solution was found, blog about it for others to find!
  • talk about, recommend & link to this blog and articles
  • thanks to all who contribute!
admin