Install Debian Lenny on Stock Kurobox

From NAS-Central Buffalo - The Linkstation Wiki
Revision as of 15:55, 18 January 2013 by Lsuser1985 (Talk | contribs) (Add category `Lenny`.)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Nuvola apps important.png 

This procedure requires repartitioning and reformatting your Kurobox's hard drive, erasing ALL existing data.
Please backup ALL important data before proceeding!

This is a guide to installing the latest stable release of Debian Lenny 5.0.5 with kernel on a KuroboxHG with stock firmware.


Whilst much information is available for installing various Debian releases on the Kurobox/KuroboxHG, most installations require re-flashing the device's firmware with uBoot. This guide details installation on a Kurobox/KuroboxHG running the stock firmware, eliminating the risk of re-flashing with uBoot. This is achieved by installing Debian Sarge 3.1 as an auxiliary operating system, using loader.o to load a kernel and then booting Debian Lenny 5.0.5 from a separate partition.

The Installation procedure is very simple and summarised by the following steps:

  1. Force EM Mode
  2. Login via Telnet
  3. Partition the Hard Drive
  4. Transfer Debian Images
  5. Extract Debian Images
  6. Configure and Reboot

Following this, Basic Configuration is discussed:

  1. Initial Configuration
  2. Optional Configuration
  3. Install Services

Finally, Limitations are outlined to encourage further development.


Force EM Mode

EM mode is easily entered by installing a new drive in your Kurobox.


  • SSH into KuroBox
  • Erase MBR:
dd if=/dev/zero of=/dev/hda bs=512 count=1
  • Reboot:


  • Dismantle KuroBox by depressing tabs and sliding off sheath
  • Remove hard drive by further dismantling and removal of screws
  • Connect drive to another machine via IDE / USB->IDE converter
  • Erase MBR:
dd if=/dev/zero of=/dev/disk1 bs=512 count=1
  • Reassemble KuroBox
  • Boot KuroBox

Log In via Telnet

Assuming you have successfully entered EM mode, the Kurobox will assume the address in the absence of a DHCP server. If you are running DHCP, please consult your DHCP client list to determine the Kurobox's address.

Login via telnet:

  • Username: root
  • Password: kuroadmin

Partition the Hard Drive

Our goal is to create the following partiton-table:

/dev/hda1 Bootable Type 83(Linux) 2GB for Sarge
/dev/hda2 Type 82(LinuxSwap) 256MB 
/dev/hda3 Type 83(Linux) 4GB for Lenny
/dev/hda4 Type 83(Linux) the rest of the Disk 
  • Clear existing partitions:
mfdisk -e /dev/hda
  • Create new partitions map (2GB Sarge[boot], 256MB Swap, 4GB Lenny, xxGB Data):
mfdisk -c /dev/hda 
  • Create Sarge system partition:
n <enter> p <enter> 1 <enter> <enter> +2048M <enter>
  • Make Sarge system partition bootable:
a <enter> 1 <enter> 
  • Make Swap partition:
n <enter> p <enter> 2 <enter>  <enter>  +256M <enter>
  • Designate Swap:
t <enter> 2 <enter> 82 <enter>
  • Create Lenny system partition:
n <enter> p <enter> 3 <enter> <enter> +4096M <enter>
  • Make Data:
n <enter> p <enter> 4 <enter> <enter> <enter> 
  • Print partition map:
p <enter> 
  • Write partition map to disk:
w <enter>
  • Format partitions:
mkfs -j /dev/hda1
mkfs -j /dev/hda3
mkfs -j /dev/hda4
mkswap /dev/hda2
  • Mount Sarge partition:
mkdir /mnt/hda1
mount /dev/hda1 /mnt/hda1
  • Mount Lenny partition:
mkdir /mnt/hda3
mount /dev/hda3 /mnt/hda3

Transfer Debian Images

  • Connect to the KuroBox via FTP:
    • Address:
    • Username: root
    • Password: kuroadmin
  • Transfer debian-sarge- to /mnt/hda1
  • Transfer debian-lenny- to /mnt/hda3

Extract Debian Images

  • Extract Sarge image with:
cd /mnt/hda1
tar xvzf /mnt/hda1/debian-sarge-
  • Extract Lenny image with:
cd /mnt/hda3
tar xvzf /mnt/hda3/debian-lenny-
  • Delete the images with:
rm /mnt/hda1/debian-sarge-
rm /mnt/hda3/debian-lenny-

Note: If you are using a non-HG Kurobox, both Sarge and Lenny kernel images should be replaced by extracting to /mnt/hda1/boot' and /mnt/hda3/boot

Configure and Reboot

By default both debian installations are configured to acquire their address via DHCP with the hostname "KURO-BOX". If you need to change these details:

  • Configure interfaces:
    • Sarge
vi /mnt/hda1/etc/network/interfaces
    • Lenny
vi /mnt/hda3/etc/network/interfaces
  • Configure hostname:
    • Sarge
vi /mnt/hda1/etc/hostname
    • Lenny
vi /mnt/hda3/etc/hostname
  • Configure DNS servers:
    • Sarge
vi /mnt/hda1/etc/resolv.conf
    • Lenny
vi /mnt/hda3/etc/resolv.conf
  • Finally, to boot into Debian Lenny 5.05, type:

Basic Configuration

Initial Configuration

After a successful reboot, the following initial configuration steps are recommended:

  • Log in via telnet
    • Username: tmp-kun
    • Password: tmp-kun
  • Setup Terminal:
export TERM=vt100
  • Switch to super user:
    • Password = root
  • Change root password:
  • Create a user account:
adduser username
  • Reconnect via Telnet as username
  • Switch to super user
  • Remove user tmp-kun:
deluser tmp-kun
rm -Rf /home/tmp-kun/
  • Update Package List:
apt-get update
  • Upgrade installed packages:
apt-get dist-upgrade

Optional Configuration

By default the dual-boot installation will cycle between Sarge with stock kernel and Lenny with updated kernel after each reboot. Whilst this provides a safety net in the event that the Lenny installation fails to boot (i.e. reboot in Sarge, mount the Lenny filesystem and fix the problem), this behavior may be undesirable if you operate always-on services purely within Lenny.

To force the system to always boot Lenny with the updated kernel:

  • Boot into Sarge and login as root
  • Create a rebooter script:
nano /etc/init.d/
  • Add the following content (replacing 2.4.17_mvl21 with your stock firmware revision [uname -r]):
# Check Kernel Version
KERNEL=`uname -r`
echo "Detected Kernel: $KERNEL"
if [ $KERNEL = '2.4.17_mvl21' ]; then
 echo 'Rebooting...'
  • Save the script
<ctrl>+o, <ctrl>+x
  • Make the script executable:
 chmod +x /etc/init.d/
  • Register an @reboot crontab process:
crontab -e <enter>
@reboot /bin/sh /etc/init.d/ > /root/log.txt 2>&1
<ctrl>+o, <ctr>+x

Now, whenever the system boots into Sarge it will detect the stock firmware and force a reboot into Lenny with the updated firmware. This behavior will allow you to reboot the server remotely with confidence that it will return running Lenny. It also simplifies the boot procedure to a single button push.

Note: There are definitely much more elegant ways of achieving this behavior, this only serves as a simple example.

Install Services

Services will vary dependant on usage, however most users will require SSH, installed via:

apt-get install ssh


Ideally the auxiliary Sarge installation should not be necessary, however much work is required to facilitate this. Please let me know if you have such a solution.

Please let me know or amend this article if you discover solutions or further limitations.

Change Log


The shutdown and reboot limitations have now been resolved by means of a crontab @reboot script (detailed above). This script has not been incorporated into the repository images as it removes the built-in safety net that dual booting provides. (i.e. without the script if Lenny fails to boot you can reboot in Sarge, mount the Lenny filesystem and fix the problem; with the script if Lenny fails to boot you will need to force EM mode or remove the hard drive to rectify the problem).


The Sarge image referenced here is derived from, patched with the KuroboxHG image found at / The sources.list has been updated to reflect the current 'archived' status of Debian sarge and all updates as of 23/07/2010 have been applied.

The Lenny image referenced here is derived from, patched with the KuroboxHG image found at / All updates as of 23/07/2010 have been applied.


Feedback and discussion is welcomed via