Restoring the original QNAP firmware or re-installing Debian

QNAP TS-419P from the front

If you want to restore the original QNAP firmware or re-install Debian on your TS-41x or TS-42x device for some reason, you can follow the instructions below. Please note that this will only work if your Debian system is still working. If your Debian system is broken but the machine itself works, you can use the recovery mode to restore the QNAP firmware or re-install Debian.

Restoring the original QNAP firmware

There are two steps to restore the original QNAP firmware. First, you have to put the backup of the flash partitions from the QNAP firmware you made before the installation of Debian into flash.

sudo modprobe mtdblock
sudo dd if=mtd1 of=/dev/mtdblock1
sudo dd if=mtd2 of=/dev/mtdblock2

Second, you have to restart your QNAP, and then go to the web interface to format your disk and install the full QNAP firmware.

After you put the QNAP firmware back in flash and installed the complete the QNAP software, your device will run the original software from QNAP again.

Re-installing Debian

If you want to re-install Debian using Debian installer, you can put the installer in flash and restart your device.

Since there are two different kernel variants for QNAP devices, you first have to determine which variant you need. You can do this by calling this script:

/usr/share/flash-kernel/dtb-probe/kirkwood-qnap

Alternatively, you can look up the CPU model in the table listing all supported QNAP devices.

If the output is kirkwood-ts419-6281.dtb, you need the kernel-6281 file. If the output is kirkwood-ts419-6282.dtb, you need the kernel-6282 file.

You also have to download the initrd files of the installer (make sure the initrd does not get uncompressed when you download it).

You can now write the installer files to flash:

sudo modprobe mtdblock
sudo dd if=kernel-628x of=/dev/mtdblock1
sudo dd if=initrd of=/dev/mtdblock2

Reboot your QNAP device and Debian installer will start and you can connect via SSH, as documented on the install page. Please be aware that the SSH key of the machine will have changed.