Difference between revisions of "Install Debian Lenny on Stock Kurobox"

From NAS-Central Buffalo - The Linkstation Wiki
Jump to: navigation, search
(Introduction)
m (Add category `Lenny`.)
 
(2 intermediate revisions by one user not shown)
Line 60: Line 60:
 
  /dev/hda1 Bootable Type 83(Linux) 2GB for Sarge
 
  /dev/hda1 Bootable Type 83(Linux) 2GB for Sarge
 
  /dev/hda2 Type 82(LinuxSwap) 256MB  
 
  /dev/hda2 Type 82(LinuxSwap) 256MB  
  /dev/hda1 Type 83(Linux) 4GB for Lenny
+
  /dev/hda3 Type 83(Linux) 4GB for Lenny
  /dev/hda3 Type 83(Linux) the rest of the Disk  
+
  /dev/hda4 Type 83(Linux) the rest of the Disk  
  
 
* Clear existing partitions:
 
* Clear existing partitions:
Line 141: Line 141:
 
** Lenny
 
** Lenny
 
  vi /mnt/hda3/etc/hostname
 
  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:
 
* Finally, to boot into Debian Lenny 5.05, type:
Line 239: Line 245:
  
 
Feedback and discussion is welcomed via [http://forum.buffalo.nas-central.org/viewtopic.php?f=41&t=22002 http://forum.buffalo.nas-central.org/viewtopic.php?f=41&t=22002]
 
Feedback and discussion is welcomed via [http://forum.buffalo.nas-central.org/viewtopic.php?f=41&t=22002 http://forum.buffalo.nas-central.org/viewtopic.php?f=41&t=22002]
 +
 +
[[Category:Debian]]
 +
[[Category:Lenny]]

Latest revision as of 15:55, 18 January 2013

Nuvola apps important.png 
WARNING!

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 2.6.25.1 kernel on a KuroboxHG with stock firmware.

Contents

Introduction

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 2.6.25.1 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.

Installation

Force EM Mode

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

Alternatively:

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

OR

  • 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 192.168.11.150 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:

telnet 192.168.11.150
  • 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: 192.168.1.150
    • Username: root
    • Password: kuroadmin
  • Transfer debian-sarge-2.6.25.1-kuroHG-20100722.tgz to /mnt/hda1
  • Transfer debian-lenny-2.6.25.1-kuroHG-20100722.tgz to /mnt/hda3

Extract Debian Images

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

Note: If you are using a non-HG Kurobox, both Sarge and Lenny kernel images should be replaced by extracting http://www.genbako.com/kernelimage-2.6.25.1-kuroBOX.tgz 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:
write_ok
reboot

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:
su	
    • Password = root
  • Change root password:
passwd
  • Create a user account:
adduser username
  • Reconnect via Telnet as username
  • Switch to super user
su
  • 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/kernel_check.sh
  • Add the following content (replacing 2.4.17_mvl21 with your stock firmware revision [uname -r]):
#!/bin/sh
# Check Kernel Version
KERNEL=`uname -r`
echo "Detected Kernel: $KERNEL"
if [ $KERNEL = '2.4.17_mvl21' ]; then
 echo 'Rebooting...'
 /sbin/reboot
fi
  • Save the script
<ctrl>+o, <ctrl>+x
  • Make the script executable:
 chmod +x /etc/init.d/kernel_check.sh
  • Register an @reboot crontab process:
crontab -e <enter>
@reboot /bin/sh /etc/init.d/kernel_check.sh > /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

Limitations

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

28/09/2010

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).

23/07/2010

The Sarge image referenced here is derived from http://www.genbako.com/debian-2.6.17.3/debian-sarge-2.6.17.3-kuroHG-20060702.tgz, patched with the 2.6.25.1 KuroboxHG image found at http://www.genbako.com/kernelimage-2.6.25.1-kuroHG.tgz / http://www.genbako.com/modules-2.6.25.1-kuroHG.tgz. 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 http://www.revulo.com/kuro-box/Debian/lenny.html, patched with the 2.6.25.1 KuroboxHG image found at http://www.genbako.com/kernelimage-2.6.25.1-kuroHG.tgz / http://www.genbako.com/modules-2.6.25.1-kuroHG.tgz. All updates as of 23/07/2010 have been applied.

Feedback

Feedback and discussion is welcomed via http://forum.buffalo.nas-central.org/viewtopic.php?f=41&t=22002