Install Debian on DNS-323 NAS from D-Link

I have an old DNS-323 NAS and decided to upgrade it to a small Web/FTP server, thus I’ve decided to install debian on it. I’ve used the device for many years with D-LINK original firmware and “fun_plug” and I was very satisfied about it.



For a short period of time (due to a HDD failure) I’ve switched to “Alt-F” firmware, which, unlike “fun_plug”, is an alternative firmware and it replaces the original D-LINK firmware entirely. “Alt-F” can also coexist  with “fun_plug” but it also have an interesting option, to install Debian, along “Alt-F”, and although you can’t use them both at the same time (you have to choose which one you start with) it’s a nice preview of what you may or may not do with Debian + DNS-323.

I strongly suggest to use the method I’ve just presented to you, Debian through Alt-F firmware, to see how Debian will act on DNS-323 (it has quite limited capabilities, with 64MB RAM and ~400MHz ARM CPU).

~ # cat /proc/cpuinfo
processor : 0
model name : Feroceon rev 0 (v5l)
BogoMIPS : 331.26
Features : swp half thumb fastmult edsp
CPU implementer : 0x41
CPU architecture: 5TEJ
CPU variant : 0x0
CPU part : 0x926
CPU revision : 0

Hardware : D-Link DNS-323
Revision : 0002
Serial : 0000000000000000

So if you decide to install Debian directly to your DNS-323, I’ll show you how I did it on mine.

In this article we cover:

  1. Installation
  2. Basic config
  3. Uninstall (reverting to factory firmware)

DNS-323 comes in 3 flavors, A1, B1, C1. A1 and B1 are best supported by Debian and you’ll find a few custom scripts across the internet to allow you to control the fan and LEDs. Unfortunately version C1 ( my version also :( )  it’s not very well supported and although it’s possible to install Debian on it you’ll get stuck with the following annoyances:

  1. Power LED will not stop flashing even after successful install;
  2. reboot / shutdown from command line isn’t possible (it just hangs in there after dropping connection);
  3. Fan will work at full speed and if it’s in the same room can be annoying.

I hope I will find solutions to these in the future or maybe somebody will post a comment and help us :)

Now let’s start with the installation… First of all, I recommend NOT to install Debian directly unless if you know what you are doing or if you don’t care bricking your DNS-323 !

In case of successful brick :) you’ll need to upgrade your DNS-323 with a serial connection

Install – Now, in order to install Debian you will need the following:

  1. D-LINK DNS-323 (A1, B1, C1)
  2. At least a SATA HDD inside the device
  3. A network connection
  4. Internet
  5. If you have rev. C1, a computer running Debian

The installer will use same network settings as your original firmware, so I recommend setting a fixed IP address first.



1. Download the current Debian installer image to your PC from here.

IMPORTANT: If you have rev. C1, the installer image needs to be repacked:

On the Debian machine mentioned earlier:

apt-get install dns323-firmware-tools
splitdns323fw -k kernel.uboot -i initrd.uboot netboot.img
rm netboot.img
mkdns323fw -k kernel.uboot -i initrd.uboot -p 7 -c 1 -m 1 -o netboot.img

If you don’t have a Debian at hand, you can use my repacked image.

2. Go to your administration page on the DNS-323 and install new firmware (netboot.img). I would recommend using Google Chrome, I’ve got some strange results with Firefox.



Click “Browse” and select “netboot.img” thent click “Apply”. If for some reason the update procedure is unsuccessful, DO NOT  restart the device, just login again and repeat the update procedure again. When you receive “Update was successful..” message, you can click “Restart” under that message.

dns323-upgrade-firmware     dns323-upgrade-done

3. After restart, login to the installer:

ssh installer@
  • replace “” with your IP.
  • accept the warning about connecting to a new host.
  • installer username and password are user: installer and pass: install
  • if you restart the installer it will generate another id and you’ll need the delete the old one from your PC in order to reconnect:
ssh-keygen -f ".ssh/known_hosts" -R
  • you must open 2 sessions, in the first one choose “Start Shell”:

dns323-start-shell   dns323-start-shell-1

  • we open a shell window to the installer because, at least in my setup, the installer fails to update the UUID’s after creating new partitions and you will end up stuck at 33% on “Finishing installation…”. I had to find out this the hard way and my solution was to update those manually. Maybe at the time you read this post this bug will be solved and you won’t be needing the second session, but i suggest to keep it open just in case :)
  • now in the second session choose “Start installer”, and select your country, debian mirror of your choice and proxy server if it’s the case:

dns323-start-installer   dns323-choose-mirror   dns323-choose-mirror-1

  • on the next screen you will choose packages to be downloaded for the installer.


  • For my setup, 2 x WD 1TB disks in RAID 1 (mirroring), I’ve chosen:
[*] md-modules-3.16.0-4-orion5x-di: RAID and LVM support
[*] partman-auto-raid: Allow preseeded RAID installs
[*] partman-ext3: Add to partman support for ext3 and ext4
[*] partman-md: Add to partman support for MD
  • next select your location, configure users and passwords, configure clock and arrive at disk partitioner screen:


  • now, if you want to use a software RAID like I did, you have to select “Manual” to create the RAID first:

dns323-configure-software-raid dns323-create-md-device dns323-create-raid1 dns323-create-raid1-1 dns323-create-raid1-2 dns323-create-raid1-3 dns323-create-raid1-4 dns323-create-raid1-5

  • next will use guided partitioning to create partitions in the newly created “md” device:

dns323-guided-partitioning dns323-guided-partitioning-1 dns323-guided-partitioning-2 dns323-guided-partitioning-3 dns323-guided-partitioning-4 dns323-guided-partitioning-5 dns323-installing-base-system

  • after “Installing the base system” has begun, switch to second session, the one with the shell and give the following 2 commands:
~ # ls -l /dev/disk/by-uuid/
lrwxrwxrwx 1 root root 11 May 24 08:52 0d3d9971-6a0c-48b1-973e-6f82874f55ca -> ../../md0p5
lrwxrwxrwx 1 root root 11 May 24 08:52 234e9ed5-7c0e-4823-bb42-fcf148e96c65 -> ../../md0p1
lrwxrwxrwx 1 root root 11 May 24 08:52 c11d3a00-c7a5-4bf6-9f70-312b14847366 -> ../../md0p2
~ # blkid | grep "md0p"
/dev/md0p2: UUID="5128ca2f-5aa4-4cf8-bb76-9665f890bac6" TYPE="ext4" PARTUUID="bbbcc3f5-02"
/dev/md0p1: UUID="8692fb9c-a095-40ec-963f-e781a078a174" TYPE="ext2" PARTUUID="bbbcc3f5-01"
/dev/md0p5: UUID="54378031-dd50-4624-80b0-7d61ac6c21a9" TYPE="swap" PARTUUID="bbbcc3f5-05"
  • as you can see the UUID’s are not the same and we need to update them manually, so I’ve did a little script to ease your work (use this only if you created software RAID as I did, else make the links manually)
~ # nano
  • in the “” file paste this:
rm /dev/disk/by-uuid/*
for PART in `blkid | grep md0p | cut -f1 -d":" | cut -f3 -d"/"`; do
    UUID=`blkid | grep $PART | cut -f2 -d"\""`
    echo $PART" --> "$UUID
    ln -s ../../$PART /dev/disk/by-uuid/$UUID
  • run “”:
~ # sh
md0p2 --> 5128ca2f-5aa4-4cf8-bb76-9665f890bac6
md0p1 --> 8692fb9c-a095-40ec-963f-e781a078a174
md0p5 --> 54378031-dd50-4624-80b0-7d61ac6c21a9
  • now check that everything is ok:
~ # ls -l /dev/disk/by-uuid/
lrwxrwxrwx 1 root root 11 May 24 09:13 5128ca2f-5aa4-4cf8-bb76-9665f890bac6 -> ../../md0p2
lrwxrwxrwx 1 root root 11 May 24 09:13 54378031-dd50-4624-80b0-7d61ac6c21a9 -> ../../md0p5
lrwxrwxrwx 1 root root 11 May 24 09:13 8692fb9c-a095-40ec-963f-e781a078a174 -> ../../md0p1
~ # blkid | grep "md0p"
/dev/md0p2: UUID="5128ca2f-5aa4-4cf8-bb76-9665f890bac6" TYPE="ext4" PARTUUID="bbbcc3f5-02"
/dev/md0p1: UUID="8692fb9c-a095-40ec-963f-e781a078a174" TYPE="ext2" PARTUUID="bbbcc3f5-01"
/dev/md0p5: UUID="54378031-dd50-4624-80b0-7d61ac6c21a9" TYPE="swap" PARTUUID="bbbcc3f5-05"
  • now sit back and relax for a while, as the base system it’s being installed…
  • after a while you’ll be presented with the “Software selection” menu:


  • here I will stick with the default selection and install only standard system and ssh server, you can customize your system after installation.
  • and some more waiting… While you wait you can watch my cat, Pufi, doing some keyboard killing :)

  • finally we’re done ! reboot into your new debian machine…


Basic config – Now you are on your own customizing your installation, but you should consider these first steps before doing anything else:

  • Set the hostname by editing “/etc/hostname” and “/etc/hosts”. These should look like this (of course you should replace “dns-323” with whatever hostname you want for your device):
dns-323 localhost dns-323

# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
  • Add “contrib” and “non-free” to apt sources:
# deb jessie main

deb jessie main contrib non-free
deb-src jessie main contrib non-free

deb jessie/updates main contrib non-free
deb-src jessie/updates main contrib non-free

# jessie-updates, previously known as 'volatile'
deb jessie-updates main contrib non-free
deb-src jessie-updates main contrib non-free
apt-get update

create files “/bin/dns323fancontrol” and “/etc/init.d/dns323init”:


# save in /bin and mark as executable

while [ true ]

#in original file was:
TEMP=$(cat /sys/class/hwmon/hwmon0/temp1_input)

echo 0 > /sys/class/gpio/gpio18/value
echo 0 > /sys/class/gpio/gpio19/value

if [ $TEMP -ge 43000 ]
 echo 1 > /sys/class/gpio/gpio18/value
 echo 0 > /sys/class/gpio/gpio19/value
 if [ $TEMP -ge 40000 ]
 echo 0 > /sys/class/gpio/gpio18/value
 echo 1 > /sys/class/gpio/gpio19/value

if [ $TEMP -ge 60000 ]
 shutdown -s now

sleep 60

#! /bin/sh

# save in /etc/init.d/ and run update-rc.d accordingly.

# Provides: dns323
# Required-Start:
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: dns323
# Description: dns323 revc1

. /lib/lsb/init-functions

echo 18 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio18/direction
echo 19 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio19/direction

echo 1 > /sys/class/gpio/gpio19/value

#echo 0 if you want power led to be off
echo 1 > /sys/class/leds/power:blue/brightness

#start-stop-daemon --start --oknodo --startas /bin/dns323fancontrol --daemon
exit 0

make the files executable, install and start service:

chmod +x /bin/dns323fancontrol
chmod +x /etc/init.d/dns323init
update-rc.d dns323init defaults
/etc/init.d/dns323init restart
  • Install “dns323d” daemon to control power and reset buttons:

download the file from HERE or HERE, install gcc and compile the file:

apt-get install gcc
gcc dns323d.c -o dns323d
mv dns323d /sbin/

add “/sbin/dns323d” to your “/etc/rc.local” file (before “exit 0″…)

Now your good to go ! Have fun with your new Debian box !

Uninstall – If you decide to uninstall debian and revert to the factory firmware, it’s very simple actually.

apt-get install dns323-firmware-tools zip unzip
  • Download original firmware from D-Link website and unzip it (This example it’s for rev. C1 ONLY. You should get the firmware versions for you hardware revision!):
wget ""
  • Split the firmware:
splitdns323fw -k uKernel -i uRamdisk DNS-323_C1_FW_v1.10_04062011
  • Write extracted kernel and ramdisk to flash:
cat uKernel > /dev/mtdblock2
cat uRamdisk > /dev/mtdblock3

If everything was successful you can reboot the device and start using factory firmware.