Debian without need to flash

From NAS-Central Zyxel Wiki
Jump to: navigation, search


It is possible to run a Debian distro (Lenny) on a NSA-220 (plus), completely from usbstick or usbdisk, putting aside the firmware. The firmware is untouched, when you remove the stick and reboot, the box will happily run the firmware again.

How to install

  • Download the package here.
  • Format an usbstick (at least 256MB) ext2 or ext3 (no reiserfs). You can do this using the webinterface, using the Create External Volume button.
  • Extract the package, and put the contents on the stick. Users of firmware 2.20 or older will have to rename nsa220_check_file.fw220_and_older to nsa220_check_file.
  • The stick should (at least) contain
    • nsa220_check_file
    • usb_key_func.salted_md5sum
    • extract_me.tgz
  • should be executable. When you use the samba interface of the NAS to put the files on the stick, this is automatically done.
  • Plug the stick in the NAS, and reboot the box.

The first time it will last several minutes before the box is booted, because the Lenny package has to be extracted. The box will use DHCP to get an IP address. Maybe the webinterface of your router can tell you which ip address is assigned. If you want a static address you'll have to edit /etc/network/interfaces (I have put an example of a static address inside.) The default MAC address is 12:34:56:78:9a:bc. When you want another one, for instance the one ZyXEL provided, again, edit /etc/network/interfaces The box is running a telnet server. There is one user configured, root with password root. I suggest you to install sshd, and remove telnetd when ssh has proven to work:

apt-get update
apt-get install openssh-server
apt-get remove telnetd

The harddisks are not yet mounted. You'll have to install mdadm:

apt-get update
apt-get install mdadm

The install script will automatically recognize and assemble your array(s). To mount them use 'mount -a' (or 'reboot'). When you've got a reiserfs system, the kernelmodule has to be loaded first:

modprobe reiserfs
# let it load at boot:
echo reiserfs >>/etc/modules

The box has no NAS functions, at the moment. Install samba and/or nfsd:

apt-get update
apt-get install samba
apt-get install nfs-kernel-server

Go nuts, there are more than 21000 packets available.

How it works is used to let the firmware start Lenny. A modified version of fonz' reloaded.ko is used to reboot the box, with a new kernel, an initramfs and a modified commandline. This kernel boots Lenny. The firmware kernel cannot run Lenny due to wrong kernel configuration.

Known issues

  • You can't use the powerbutton to shutdown. Instead open a shell and use the 'halt' command.
  • The kernel only works after a reboot. Because of that /boot/ will first reboot the box before it reloads the kernel. /boot/reload.status is used to keep track of this.
  • With newer firmware (>3.10?) some modifications have to be made to /etc/init.d/, in order to start fanctrld, and stop the blinking sys-led. In function start(), after the check if fanctrld is running, but before it's actually started, add:

if [ -f /mnt/firmware/AllPack.lzma ]; then
    if [ ! -d ${DECOMPRESS_PATH} ]; then 
        mkdir ${DECOMPRESS_PATH} 
        cd ${DECOMPRESS_PATH} 
        lzma d /mnt/firmware/AllPack.lzma -c | tar x -C ${DECOMPRESS_PATH} 
        rm AllPack.tar 
        cd / 
   mount --bind ${DECOMPRESS_PATH}/usr/ /mnt/firmware/usr/ 
   mount --bind ${DECOMPRESS_PATH}/sbin/ /mnt/firmware/sbin/

In the beginning of the script is checked for the existance of fanctrld. Comment that out:

# [ -x "$DAEMON" ] || exit 0


As far as I know this hack is harmless for your hardware and data. But I do not take any responsibility for damage caused by this software. Use at own risk