Troubleshooting QNAP Debian NAS box by setting up DHCP and TFTP servers in Ubuntu

I have QNAP TS-110 home NAS box installed with Debian Linux 6.0 (Squeeze). Recently it was broken with latest kernel update (I expect all these since it is a Testing branch). I took this opportunity to learn more on recovery of QNAP. Martin Michlmayr maintains nice documents to get the recovery done. It has instructions to restore the image. Thanks, Martin.

To complement this document, I am writing this post. In Martin’s document it is assumed that user has fair knowledge of setting up DHCP and TFTP servers. But I am not so (I am a desktop Linux guy!). Here I am writing complete instructions on recovery process which includes DHCP and TFTP server setup on Ubuntu 10.10 (Beta). The basic purpose of this post is as a reference for myself in future.

The purpose of DHCP server is to allocate IP Address to QNAP server. TFTPD is for transferring recovery image to QNAP.

What is the trouble I faced?

Recently I run “# apt-get update && apt-get upgrade”, which brought new kernel and flashed. After update, I restarted the system. But.. oops.. the system did not come up!!! The status LED blinks RED and GREEN alternatively. I don’t have TTL Serial adapter to get debug console. Right now I don’t even have keyboard and mouse ( I use laptop only ). As a learning process I thought of doing a recovery. Here is how I did it.

Preparing recovery image

Recovery image can be any of the following. You can select as per your requirement. I assume that you have backup of flash partitions in your workstation. In my case it is Ubuntu. So run these command in your workstation.

Case 1. Factory installed QNAP firmware – You should have backed up before installing Debian as explained here.

In this case run the following command to make a recovery image.

$ cat mtd0 mtd4 mtd5 mtd1 mtd2 mtd3 > F_TS-110_qnap

Case 2. Debian Installer – In this also you should have backed up before installing Debian as explained here. And also download linux kernel and initrd images from this debian repository. Run the following commands to create installer image.

$ dd if=kernel of=kernel.pad ibs=2097152 conv=sync

$ cat mtd0 mtd4 mtd5 kernel.pad initrd.gz mtd3 > F_TS-110_di

Case 3. Working Debian System image – In this case, you should have run the following command from running Debian system periodically to create backup of this working Debian linux.

$ cat /dev/mtdblock0 /dev/mtdblock4 /dev/mtdblock5 /dev/mtdblock1 /dev/mtdblock2 /dev/mtdblock3 > F_TS-110_debian

The recovery image file name should start with specific QNAP model number. In my case it is F_TS-110. You can identify your model number with following command.

$ strings mtd4 | grep bootp_vendor_class

In this case I am restoring the Debian installer to start installing Debian again (F_TS-110_di).

Setting up TFTP Server in Ubuntu

I go for quick command to get it done.

$ sudo apt-get install tftpd

$ sudo vi /etc/xinet.d/tftp

Create above mentioned file with below content.

service tftp {

protocol = udp

port = 69

socket_type = dgram

wait = yes

user = nobody

server = /usr/sbin/in.tftpd

server_args = /tftpboot

disable = no


$ sudo mkdir /tftpboot

$ sudo chown -R nobody /tftpboot

$ sudo chmod -R 777 /tftpboot

$ sudo service xinetd restart (or) $ sudo /etc/init.d/xinetd restart

Copy the image to be restored (F_TS-110_di) to /tftpboot directory.

Setting up DHCP Server in Ubuntu

Installing the DHCP Server –

$ sudo apt-get install dhcp3-server

Configuring interface – Set the network interface in Ubuntu used for DHCP. In my case it is wireless card, so it is “wlan0”. In wired LAN case it may be eth0, eth1…

$ sudo vi /etc/default/dhcp3-server

I have just configured the follwing in this file.


Configuring DHCP server parameters –

$ sudo vi /etc/dhcp3/dhcpd.conf

Ensure that following are set properly apart from other default values – In my case IP Address of Ubuntu is For QNAP, is allocated.  Set the subnet and mask value also according to it. Note down the MAC address (00:08:xx:xx:xx:f0 in this case) of QNAP from a sticker behind the server (You can also note down from /var/log/syslog file once DHCP server started. QNAP will send DHCPDISCOVER message to Ubuntu). Enter right filename, which is nothing but our recovery image.

default-lease-time 600;
max-lease-time 7200;

subnet netmask {



host ts110 {
hardware ethernet 00:08:xx:xx:xx:f0;
filename “F_TS-110_qnap”;

Restart the DHCP server –

$ sudo service dhcp3-server restart (or) $ sudo /etc/init.d/dhcp3-server restart

Now you should have both DHCP and TFTP servers running on Ubuntu.

Pushing Debian installer to QNAP

Power on the QNAP server while keep pressing the reset button (at rear side, use small pin to do it). Keep pressing this button after starting the QNAP till you hear two consecutive beeps. If everything goes fine, QNAP should get IP address from DHCP server and fetch debian installer image from TFTP server. It will then write the image on flash and restart itself again. Once it is booted, you will hear a single beep, which indicates that Debian installer is ready. Now connect to QNAP through the SSH terminal with IP address you assigned. Use username as “installer” and password as “install”.

Happy hacking!


1. Recovery process of QNAP for Debian Linux

2. Setting up DHCP server

3. Setting up TFTP server

Share this post