Install Debian 10 Buster on Netgear ReadyNAS RN104 (RN102)

V 1.1 2020-07-11 Stefan Katerkamp

This is how I set up Debian 10 Buster on a Netgear ReadyNAS RN104 NAS Hardware. An ARM Armada-370 based hardware which was sold around 2013-2016 or so. Power consumption of an idle system with disks in standby mode is about 24 Watts. In poweroff mode with power supply connected to mains it draws 0.4 Watts, according to my non calibrated cheap power meter.

Note that this install deletes the original Netgear firmware in NAND. Reason is that we use the bigger ubifs partition instead of minirootfs for initrd. This makes life easier as we don’t have to create our own device tree blob.

Connection to U-Boot console is a prerequisite. We tftp Debian Net Installer into RAM and run it from there. All needed packages get pulled in via Ethernet from a debian pool server.

Result is a plain vanilla Debian Buster system which will boot kernel and initrd from built in NAND flash, and then chroots to /boot and /root on a hard disk in the box. This means, about 16GB of disk space is used for the system, all other disk space can be used for payload.

Hardware Preparations

RN104 serial console access is a basic prerequisite. It is accessible behind the sticker on the upper left corner in the back. I am using a FTDI FT232RL adapter. Set the Vccio Jumper to 3.3V. Upper left pin goes to TX, lower left to GND, and upper right to RX:

to TX
  o o-- to RX
  o o
to GND

Finally connect the USB cable to some other computer near it, and connect to it with your favorite serial interface program like cu, picocom or screen.

cu -s 115200 -l /dev/ttyUSB0

If screen is garbled and you are using KDE Konsole, reset it with Shift-Ctrl-K.

Connect the RN104 to a LAN with Internet access and DHCP server via an Ethernet cable, use the upper port.

Make sure a fresh hard disk is installed in the ReadyNAS.

Set up TFTP server

Select a system in the LAN which will act as a TFTP server. Note down the IPv4 address of this server. (Example: Install tftp server:

ip addr
apt install tftpd

Fix write permissons of the TFTP server data directory for your account so you don’t need to work as superuser: sudo chown $USER /srv/tftp.

Prepare Debian Installer Images

I had no success booting vmlinuz and initrd.gz directly on my ReadyNAS Firmware V.6.0 using bootz. However, old uImage/uInitrd format works. So we need to convert our debian installer files into this format.

Log in to your workstation. We need the u-boot-tools package:

sudo apt install u-boot-tools

Download d-i images for the RN104 and build the uImage:

cd /tmp
rm -f initrd.gz vmlinuz armada-370-netgear-rn104.dtb
cat vmlinuz armada-370-netgear-rn104.dtb > vmlinuz_rn104
mkimage -A arm -O linux -T multi -C none -a 0x04000000 -e 0x04000000 \
 -n "Debian Buster armhf installer" -d vmlinuz_rn104:initrd.gz uImage_di_rn104

Copy the uImage_di_rn104 file to the TFTP server data directory /srv/tftp.

Prepare U-Boot settings

Open serial console window and power on the ReadyNAS box. Quickly hit Return key to interrupt automatic boot sequence and get into U-Boot CLI. To make life easier adapt bootdelay to 10 seconds:

setenv bootdelay 10

This is needed for mtdparts and load_addr, its factory default and looks like this:

printenv mtdparts
printenv load_addr

Check that partition definition is recognized:

Marvell>> mtdparts

device nand0 <armada-nand>, # parts = 5
 #: name                size            offset          mask_flags
 0: u-boot              0x000000180000          0x000000000000          0
 1: u-boot-env          0x000000020000          0x000000180000          0
 2: uImage              0x000000600000          0x000000200000          0
 3: minirootfs          0x000000400000          0x000000800000          0
 4: ubifs               0x000007400000          0x000000c00000          0

active partition: nand0,0 - (u-boot) 0x000000180000 @ 0x000000000000

mtdids  : none
mtdparts: none

Marvell>> nand info

Device 0: nand0, sector size 128 KiB
  Page size      2048 b
  OOB size         64 b
  Erase size   131072 b

Adapt boot settings to match increased file sizes. U-Boot settings have to match the Linux RN104 dtb. Debian kernel ignores mtdparts command line arg (CONFIG_MTD_CMDLINE_PARTS is not set). This is used by U-Boot only.

We are going to install kernel and DTB into NAND uImage partition, and initrd into NAND ubifs partition. Upon boot, we copy the complete uImage area (0x600000 bytes) and just parts of ubifs (0xf00000 bytes) for speed.

Adapt the boot command sequence for it:

setenv bootcmd 'nand read 0x2000000 uImage 0x600000;nand read 0x3000000 ubifs 0xf00000;bootm 0x2000000 0x3000000'

For ease of use, save TFTP server IPv4 address in U-Boot env, example for IP

setenv serverip

Run Debian Installer

Get IP address, download the installer image and run it.

tftp uImage_di_rn104

Now kernel boots and d-i gets started as usual. Use eth0 for the Ethernet port. Due to little memory in the box d-i guided partitioning creates a quite small swap partition of just 500MB. You may want to partition disk manually. However, use a simple partitioning scheme without raid on root and boot. Otherwise initramfs has problems as there is no raid module loaded for now.

Now all should run fine till the installation is finished. This may take a while, be patient.

Finally, you’ll see a a red screen. Failing step is: Make the system bootable.

Hit Return key to continue. Debian installer main menu shows up.

Select Execute a shell, Continue and get the command prompt.

Check this:

cat /proc/mtd
dev:    size   erasesize  name
mtd0: 08000000 00020000 "pxa3xx_nand-0"

MTD has no partitions. For whatever reason…​ (Let me know if you have an idea.)

This stops us from writing to NAND and boot Linux from there. The target contains a proper kernel and initrd, so lets build our uImage from that, chroot into it:

mount --bind /proc /target/proc
mount --bind /sys /target/sys
mount --bind /dev /target/dev
mount --bind /dev/pts /target/dev/pts
chroot /target /bin/bash

Create the uImage.


this uImage is specific to the host and an uImage created on another system cannot be reused. So you might wish to add the hostname to it, i.e. vmlinux_rn104_myhost:

cd /boot
cat vmlinuz dtb > vmlinuz_rn104
mkimage -A arm -O linux -T multi -C none -a 0x04000000 -e 0x04000000 -n "Debian Buster armhf" -d vmlinuz_rn104:initrd.img uImage_rn104

Transfer (scp) this uImage_rn104 to the tftp server.

In d-i, exit, exit and Finish the installation. Then continue to reboot. System shuts down and U-Boot comes up.

Interrupt U-Boot autoboot sequence. If the screen looks garbled, reset Konsole: Shift-Ctrl-K.

Load and execute our uImage:

tftp uImage_rn104

Kernel boots, and login prompt appears. Login as root. Check if NAND flash is partitioned properly:

# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00180000 00020000 "u-boot"
mtd1: 00020000 00020000 "u-boot-env"
mtd2: 00600000 00020000 "uImage"
mtd3: 00400000 00020000 "minirootfs"
mtd4: 07400000 00020000 "ubifs"

This looks good now. Lets install kernel and initrd to RN104 flash. Configure flash-kernel database:

cat >> /etc/flash-kernel/db <<EOF
Machine: NETGEAR ReadyNAS 104
DTB-Id: armada-370-netgear-rn104.dtb
DTB-Append: yes
Mtd-Kernel: uImage
Mtd-Initrd: ubifs
U-Boot-Kernel-Address: 0x04000000
U-Boot-Initrd-Address: 0x06000000
Required-Packages: u-boot-tools
Bootloader-Sets-Incorrect-Root: yes

Keep initramfs size small and load only needed ones. However, it seems that this is missing raid1 module, so it cannot boot from raid (need to fix this).

sed -i -e s/MODULES=most/MODULES=dep/ /etc/initramfs-tools/initramfs.conf

Build and flash:

update-initramfs -u -k $(uname -r)


sync; reboot

Now the system boots properly from U-Boot and NAND flash into Debian Buster.

Essential packages

Log in as Root.

apt -y install u-boot-tools i2c-tools fancontrol hddtemp software-properties-common \
avahi-daemon lm-sensors rsync sudo parted

Prepare u-boot-tools config:

cat <EOR >/etc/fw_env.config
# RN104
# MTD device name  Device offset  Env size  Flash sector size
/dev/mtd1          0x0000         0x20000    0x20000


grep i2c-dev /etc/modules || echo i2c-dev >> /etc/modules


Work in progress.

RN104 has a RS5C372 RTC, but with standard Debian kernel CONFIG_RTC_DRV_RSC372 is not set.

apt install module-assistant
m-a prepare
m-a update
m-a a-i rtc-rs5c372


We need to create /etc/fancontrol. Run pwmconfig, answer yes to run it and save /etc/fancontrol file:

DEVPATH=hwmon0=devices/virtual/thermal/thermal_zone0 hwmon1=devices/platform/soc/soc:internal-regs/d0011000.i2c/i2c-0/0-003e
DEVNAME=hwmon0=d0018300.thermal hwmon1=g762
FCFANS= hwmon1/pwm1=hwmon1/fan1_input


systemctl enable fancontrol

D-I Rescue Boot

Just in case, this is how to boot D-I in rescue mode:

setenv bootargs $console rescue/enable=true
tftp uImage-di-rn104