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 9 (stretch) 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-212P, 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 is PuTTY 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 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
admin and the password is
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/sdi1 but you
can find the location with the following command:
mount | grep external /dev/sdi1 on /share/external/sdi1 type vfat [...]
On systems that have never been initialized with the QNAP firmware, the
VFAT module may not be available. If your USB stick does not get mounted,
put it back in your PC and format it with the
Now go to this directory and make a backup of your flash partitions:
cd /share/external/sdi1 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
mtdX files to your regular backup.
Now you can go ahead and download the installer.
Download and Flash the Installer
Issue the following commands to download the Debian installer images:
cd /tmp busybox wget http://ftp.debian.org/debian/dists/stretch/main/installer-armel/current/images/kirkwood/network-console/qnap/ts-21x/initrd busybox wget http://ftp.debian.org/debian/dists/stretch/main/installer-armel/current/images/kirkwood/network-console/qnap/ts-21x/kernel-6281 busybox wget http://ftp.debian.org/debian/dists/stretch/main/installer-armel/current/images/kirkwood/network-console/qnap/ts-21x/kernel-6282 busybox wget http://ftp.debian.org/debian/dists/stretch/main/installer-armel/current/images/kirkwood/network-console/qnap/ts-21x/flash-debian busybox wget http://ftp.debian.org/debian/dists/stretch/main/installer-armel/current/images/kirkwood/network-console/qnap/ts-21x/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:
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:
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.
- 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.
- 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.
ssh-keygen -f ~/.ssh/known_hosts -R 192.168.1.100