Upgrade Debian 5.0 (Lenny) To Debian 6.0 (Squeeze) On Buffalo Linkstation Mini

Overview
The following process upgrades an existing installation of Debian 5.0 on a Buffalo Linkstation Mini (model LS-WSxxxxGL/R1) to Debian 6.0 (Squeeze) with the Debian Linux kernel (version 2.6.32-31). No disassembly required. Here is how the process works:
 * 1) Update package sources
 * 2) Upgrade distribution
 * 3) Install new kernel
 * 4) Restart device

Requirements

 * 1) Buffalo LinkStation Mini models LS-WSxxxxGL/R1 running Debian 5.0 (LS-WSXxxxxTL/R1 models will not work)
 * 2) * This process was tested with model LS-WS1.0TGL/R1, but other models may work as well

Instructions
 Note: Do not attempt to execute the following commands as a single script. Instead, copy and paste each block of commands into a shell window and monitor the resulting output for errors 

  Assign IP Address of device to environment variable IP_ADDRESS=192.168.1.77



 Use SSH to login as root ssh root@${IP_ADDRESS}



 Change package source to Debian 6 repository (replace lenny with squeeze in /etc/apt/sources.list) SED_FILE='/etc/apt/sources.list' SED_SEARCH='(\s)(lenny)(\s|/)' SED_REPLACE='\1squeeze\3' sed -r "s~${SED_SEARCH}~${SED_REPLACE}~" -i "${SED_FILE}"



 Update package lists (from Debian 6.0 repository) apt-get update



 Install screen package (to recover from possible disconnect during upgrade) apt-get -q -y install screen



 Start screen application (if you are disconnected during upgrade, then login again and run "screen -Dr" to resume your session) screen



 Install packages to support upgrade process apt-get -q -y install apt aptitude dpkg

</li>

 Upgrade to Debian 6 (when prompted with questions, choose default answers) apt-get -q -y dist-upgrade

</li>

 Workaround bug in Debian 6 (/etc/network/run links to /dev/shm/network, but directory is missing, which prevents network interfaces from starting) mv /etc/network/run run.original mkdir /etc/network/run touch /etc/network/run/ifstate

</li>

 Install custom kernel (Debian 6.0 kernel 2.6.32-31) cd / wget http://downloads.buffalo.nas-central.org/Users/rpinchbeck/lsmini/debian/6.0/kernel-2.6.32-31-debian-lsmini.tar.gz tar --extract --verbose --same-permissions --gzip --file kernel-2.6.32-31-debian-lsmini.tar.gz

</li>

 Wait for RAID synchronization to complete while egrep -iq '(recovery)|(resync)' /proc/mdstat; do    clear cat /proc/mdstat sleep 5 done clear cat /proc/mdstat sync

</li>

 Restart device sync; reboot; logout

</li>

</ol>

'''Congratulations! Your Buffalo Linkstation Mini should now be running Debian 6.0!'''