Painless Debian

From NAS-Central Lacie Wiki
Revision as of 09:25, 24 November 2010 by Mijzelf (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


Running Debian on the EdMini is a painful operation. A recent Debian version cannot run on the stock kernel, because it's too old. Fortunately a more recent kernel is available (thanks, rosbif), but unfortunately you cannot just put this kernel on the box, due to a wrong machtype. So you'll have to flash the bootloader, or patch the kernel. Then you're bound to use sda6 for kernel image and sda7 for rootfs, or you'll have to flash the bootloader, and ...


There is another way, using reloaded.ko, a kernel module developed for the D-Link DNS-323, but what I ported to the EdMini v2 (sources). Using this module it's possible to reboot the box using a different kernel, initramfs, commandline and/or machtype.

How to use it

Download lenny.tgz here, and extract it to a ext2/3 or xfs formatted USB stick. It contains a Lenny rootfs, a 2.6.36 kernel and modules, and 2 tastes of reloaded.ko. Plug the stick in the NAS, and then you can start Lenny:

cd /home/usbdisksdb1/boot
./ /dev/sdb1

(When your stick is mounted somewhere else, or has another devicename, change the commands accordingly)
The box will reboot immediately, so make sure you wasn't doing anything else.

  • After reboot the box will request an IP address by DHCP.
  • A lightweight ssh server will be running (dropbear)
  • There are two users, user with password user, and root with password root.


When you want Lenny automatically to start on boot, you can extract reload.tgz to the root of the firmware filesystem. It contains 2 files, a script /etc/init.d/, which will try to mount all partitions, and look if there is a /boot/ inside, in which case it will be called. The other file is a symlink in rc.3, which calls the script. Now on boot Debian will be started automatically, and you can boot the firmware again by removing the stick. If you don't have shell access you can get it by installing a ssh daemon, or you can use the instructions on that page to get reload.tgz on your box.

Size of the stick

The stick has to be at least 256MB. The provided rootfs uses 206MB. With nfs-kernel-server, samba, mc and ntp installed about 400MB is in use.

Debian on harddisk

You can also extract lenny.tgz to /home (which is /dev/sda2), and boot Lenny from harddisk. The startscript in reload.tgz will also work in that case. But of course you can't just pull the disk to get the firmware back.

Known issues

  • AFAICS the fan control doesn't work. But the fan runs, so no fear for overheating.
  • The box doesn't poweroff. (More in this thread). As work around you can use /sbin/ This will set a flag, reboot the box, and if the flag is detected /boot/ will execute halt on the stock kernel.
  • The power button doesn't work. I suppose some helper script is needed to get that running.

Building the rootfs

The rootfs in lenny.tgz was build from a already running Debian using these commands:

apt-get install cdebootstrap
mkdir new_lenny
cdebootstrap lenny new_lenny

mount proc new_lenny/proc -t proc
mount --bind /var new_lenny/var

chroot new_lenny /bin/sh
adduser user --home=/
apt-get purge dropbear
apt-get install dropbear

umount new_lenny/proc
umount new_lenny/var

cp /etc/fstab new_lenny/etc/
cp /etc/inittab new_lenny/etc/
cp /etc/network/interfaces new_lenny/network/

edit new_lenny/etc/init.d/dropbear to generate keys
rm new_lenny/etc/dropbear/dropbear*

cp /boot/* new_lenny/boot/
cp -R /lib/modules/* new_lenny/lib/modules/
mkdir new_lenny/lib/firmware
cp -R /lib/firmware/* new_lenny/lib/firmware/
cp /sbin/ new_lenny/sbin/
cp /usr/bin/ssh new_lenny/usr/bin/

chroot new_lenny /bin/sh
tar -czf lenny.tgz *


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