After a flash drive crash I wanted to re-install Debian 5 on my NSLU2 however after visiting the authors website I found it’s no longer supported and thus forcing you to install Debian 6 Wheezy. Also you can no longer use the graphical install that we have all become accustomed to but rather manually partition and format your drive then download and extract the base file onto it. I tried it the new way and what a long winded process it is. After getting Debian 6 up and running I found my custom software install script failed at multiple points due previous packages not being available in the new release. I decided to find a way to re-install Debian 5 and this is how I did it.
Firstly the graphical install appears to be out of the window as no
matter what Debian mirror I tried it always through back an error so
looks like we are going to have to do it the long way round. I am doing
this on a USB Flash drive so you will have to tweak it if installing on a
HDD.
1, Insert USB stick into a working linux machine.
2, Run tail -f /var/log/messages and you should see output similar to this
Apr 28 09:07:09 box kernel: [2185915.404172] scsi4 : SCSI emulation for USB Mass Storage devices
Apr 28 09:07:09 box kernel: [2185915.408231] usb 4-4.4: New USB device found, idVendor=03f0, idProduct=b707
Apr 28 09:07:09 box kernel: [2185915.408237] usb 4-4.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Apr 28 09:07:09 box kernel: [2185915.408242] usb 4-4.4: Product: v195b
Apr 28 09:07:09 box kernel: [2185915.408246] usb 4-4.4: Manufacturer: HP
Apr 28 09:07:09 box kernel: [2185915.408250] usb 4-4.4: SerialNumber: UT19104700000257
Apr 28 09:07:14 box kernel: [2185920.743081] scsi 4:0:0:0: Direct-Access    hp      v195b           0.00 PQ: 0 ANSI: 2
Apr 28 09:07:14 box kernel: [2185920.743081] sd 4:0:0:0: [sde] 31711232 512-byte hardware sectors (16236 MB)
Apr 28 09:07:14 box kernel: [2185920.743081] sd 4:0:0:0: [sde] Write Protect is off
Apr 28 09:07:14 box kernel: [2185920.751042] sd 4:0:0:0: [sde] 31711232 512-byte hardware sectors (16236 MB)
Apr 28 09:07:14 box kernel: [2185920.751042] sd 4:0:0:0: [sde] Write Protect is off
Apr 28 09:07:14 box kernel: [2185920.751042]Â sde: sde1 sde2 sde3 < sde5 sde6 >
Apr 28 09:07:14 box kernel: [2185920.771013] sd 4:0:0:0: [sde] Attached SCSI removable disk
From this you get your device name mine being sde.
3, run fdisk /dev/sde
—————————————–
Command (m for help): d
No partition is defined yet!
Command (m for help): p
Disk /dev/sde: 16.2 GB, 16236150784 bytes
255 heads, 63 sectors/track, 1973 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x04dd5721
  Device Boot     Start        End     Blocks  Id System
Command (m for help): d
No partition is defined yet!
——————————————
create first primary partition
Command (m for help): n
Command action
  e  extended
  p  primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1973, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-1973, default 1973): 31
——————————————
create second primary partition
Command (m for help): nÂ
Command action
  e  extended
  p  primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (32-1973, default 32):
Using default value 32
Last cylinder or +size or +sizeM or +sizeK (32-1973, default 1973): 882
——————————————
create third extended partition
Command (m for help): n
Command action
  e  extended
  p  primary partition (1-4)
e
Partition number (1-4): 3
First cylinder (562-1973, default 562):
Using default value 562
Last cylinder or +size or +sizeM or +sizeK (562-1973, default 1973): 1973
——————————————–
create forth swap partition
Command (m for help): n
Command action
  l  logical (5 or over)
  p  primary partition (1-4)
l
First cylinder (562-1973, default 562):
Using default value 562
Last cylinder or +size or +sizeM or +sizeK (562-1973, default 1973): 592
——————————————–
create fifth partition
Command (m for help): n
Command action
  l  logical (5 or over)
  p  primary partition (1-4)
l
First cylinder (593-1973, default 593):
Using default value 593
Last cylinder or +size or +sizeM or +sizeK (593-1973, default 1973): 1973
———————————————
The partition table should now look like this
Command (m for help): p
Disk /dev/sde: 16.2 GB, 16236150784 bytes
255 heads, 63 sectors/track, 1973 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x04dd5721
  Device Boot     Start        End     Blocks  Id System
/dev/sde1Â Â Â Â Â Â Â Â Â Â Â Â Â Â 1Â Â Â Â Â Â Â Â Â 31Â Â Â Â Â 248976Â Â 83Â Linux
/dev/sde2Â Â Â Â Â Â Â Â Â Â Â Â Â 32Â Â Â Â Â Â Â Â 561Â Â Â Â 4257225Â Â 83Â Linux
/dev/sde3Â Â Â Â Â Â Â Â Â Â Â Â 562Â Â Â Â Â Â Â 1973Â Â Â 11341890Â Â Â 5Â Extended
/dev/sde5Â Â Â Â Â Â Â Â Â Â Â Â 562Â Â Â Â Â Â Â Â 592Â Â Â Â Â 248976Â Â 83Â Linux
/dev/sde6Â Â Â Â Â Â Â Â Â Â Â Â 593Â Â Â Â Â Â Â 1973Â Â Â 11092851Â Â 83Â Linux
———————————————
change partition five to swap
Command (m for help): t
Partition number (1-6): 5
Hex code (type L to list codes): 82
Changed system type of partition 5 to 82 (Linux swap / Solaris)
———————————————-
write the changes
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
———————————————-
format the drive
mkfs.ext2 /dev/sde1
mkfs.ext3 /dev/sde2
mkfs.ext3 /dev/sde6
mkswap /dev/sde5
———————————————–
mount the disk somewhere
mkdir /mnt/usbstick
mount /dev/sde2 /mnt/usbstick
mkdir /mnt/usbstick/boot
mount /dev/sde1 /mnt/usbstick/boot
———————————————–
Get the base system files
cd /tmp
wget http://www.theoutpost.org/downloads/slug/lenny/base.tar.bz2
———————————————–
untar the system and unmount the disk
cd /mnt/usbstick
tar -xjvf /tmp/base.tar.bz2
cd /
umount /mnt/usbstick/boot
umount /mnt/usbstick
———————————————–
Remove base file from host computer
rm /tmp/base.tar.bz2
————————————————
Put you nslu2 into upgrade mode
Download the lenny firmware http://www.theoutpost.org/downloads/slug/lenny/sda2-2.6.26-19
Write the firmware to your nslu2 upslug2 -i sda2-2.6.26-19
/usr/sbin/upslug2 -i /home/brianp/slug/sda2-2.6.26-19
After verification when it displays Rebooting… done insert your usbsitck into the nslu2.
The nslu2 should now boot into Debian login via root using password root.